Commit Graph

210 Commits

Author SHA1 Message Date
Neil Han
be54981358 chore: web-extension vite.config.ts needs these changes to work for node 14 (#1146) 2023-02-19 15:57:47 +08:00
Yun Feng
3416c3a769 fix: isCheckout is not included in fullsnapshot event (#1141)
* fix: isCheckout is not included in fullsnapshot event

* add change log
2023-02-17 08:50:58 +01:00
Ben White
aaabdbdff5 fix: Recursive logging bug with console recording (#1136)
* fix: Recursive logging bug with console recording

* Create violet-melons-itch.md
2023-02-16 17:11:31 +08:00
Prateek Karnal
f6f07e9533 Fix relative path detection in stylesheet URLs (#1130)
* Fix relative path detection in stylesheet URLs

* Add a check for www.

* Update packages/rrweb-snapshot/src/snapshot.ts

* Update packages/rrweb-snapshot/src/snapshot.ts

* Create large-ants-prove.md

* Update large-ants-prove.md

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-02-15 16:42:29 +01:00
github-actions[bot]
06031a6486 Version Packages (alpha) (#1135) 2023-02-15 06:37:19 +08:00
Yun Feng
033d2d18b4 some minor changes for releasing the extension and revert failed publish PR #1123 (#1132)
* improve extension bundle

* Revert "Version Packages (alpha) (#1123)"

This reverts commit 39f8c24f1d.
2023-02-15 06:32:43 +08:00
github-actions[bot]
39f8c24f1d Version Packages (alpha) (#1123)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-14 15:51:42 +01:00
Billy Vong
b540c047c2 fix: Exclude scripts loaded with rel=modulepreload from snapshots (#1128)
* fix: Exclude `modulepreload` as well

We were only excluding `<link rel="preload" as="script" />` but we should include `rel="modulepreload"` as well

* Apply formatting changes
2023-02-14 12:06:59 +01:00
Justin Halsall
f9affc9747 Chore: Bump up all package versions together whenever any one version changes (#1131)
* Bump up all package versions together whenever any one version changes.

Keeps everything in sync to make it easy to see if you have the correct dependencies.

https://github.com/changesets/changesets/blob/main/docs/fixed-packages.md

* Empty changeset as this changes nothing for the packages them selves

* Bring @rrweb/web-extension version inline with other packages

* separate the extension version from package.json's to avoid errors

---------

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-02-14 11:54:59 +01:00
Yun Feng
3cc4323094 improve rrdom performance (#1127)
* add more check to rrdom to make diff algorithm more robust

* fix: selector match in iframe is case-insensitive

add try catch to some fragile points

* test: increase timeout value for Jest

* improve code style

* fix: failed to execute insertBefore on Node in the diff function

this happens when ids of doctype or html element are changed in the virtual dom

also improve the code quality

* refactor diff function to make the code cleaner

* fix: virtual nodes are passed to plugin's onBuild function

* refactor the diff function and adjust the order of diff work.

* call afterAppend hook in a consistent traversal order

* improve the performance of the "contains" function

reduce the complexity from O(n) to O(logn)
a specific benchmark is needed to add further

* add a real events for benchmark

* refactor: change the data structure of childNodes from array to linked list

* remove legacy code in rrweb package

* update unit tests

* update change log
2023-02-14 11:54:30 +01:00
Yun Feng
282c8fa415 rrweb extension implementation (#1044)
* feat: add rrweb web-extension package

* refactor: make the extension suitable for manifest v3

* update tsconfig.json

* use version_name rather than recorder_version in manifest.json

* update manifest.json

* enable to keep recording after changing tabs

* enable to record between tabs and urls

* fix CI error

* try to fix CI error

* feat: add pause and resume buttons

* feat: add a link to new session after recording

* improve session list

* refactor: migrate session storage from chrome local storage to indexedDB

* feat: add pagination to session list

* fix: multiple recorders are started after pausing and resuming process

* fix: can't stop recording on firefox browser

* update type import of 'eventWithTime'

* fix CI error

* doc: add readme

* Apply suggestions from Justin's code review

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>

* refactor: make use of webNavigation API to implement recording consistent during page navigation

* fix firefox compatibility issue and add title to pages

* add mouseleave listener to enhance the recording liability

* fix firefox compatibility issue and improve the experience of recording resume after closing tabs

* update tsconfig

* upgrade vite-plugin-web-extension config to fix some bugs on facebook web page

* update import links

* refactor: cross tab recording mechanism

apply Justin's suggestion

* refactor: slipt util/index.ts into multiple files

* implement cross-origin iframe recording

* fix: regression of issue: ShadowHost can't be a string (issue 941)

* refactor shadow dom recording to make tests cover key code

* Apply formatting changes

* increase the node memory limitation to avoid CI failure

* Create lovely-pears-cross.md

* Apply formatting changes

* Update packages/web-extension/package.json

* Update .changeset/lovely-pears-cross.md

* update change logs

* delete duplicated property

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2023-02-14 07:15:34 +08:00
Yun Feng
1385f7acc0 fix duplicated shadow dom (#1095)
* fix: duplicated elements in shadow doms

clean observers before taking new full snapshots

* add checker for replayer to make it stable when data has duplicated nodes

* apply review suggestions

* add change log

* Apply formatting changes

* update prettier to fit the master branch

---------

Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
2023-02-12 14:00:18 +01:00
Yun Feng
502d15df9f fix: outdated ':hover' styles can't be removed from iframes or shadow doms (#1121)
* fix :hover class can't be removed in iframes

* add test case and change log
2023-02-12 13:25:21 +01:00
Justin Halsall
5a1e5e919e Automate NPM package releases (#1119) 2023-02-11 10:19:52 +01:00
Yun Feng
174b9ac066 fix: mutation Failed to execute 'insertBefore' on 'Node': Only one doctype on document allowed (#1112)
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2023-02-09 20:21:45 +08:00
Yun Feng
0627d4df7c add option to record on DOMContentLoaded event (#1109) 2023-02-09 10:14:49 +01:00
Yun Feng
07d22e7cd9 enable to customize logger in the replayer (#1111) 2023-02-09 10:14:33 +01:00
Yun Feng
4ee86fe66d improve rrdom robustness (#1091) 2023-02-09 10:10:32 +01:00
Yun Feng
3a26e36f6f fix: regression of issue: ShadowHost can't be a string (issue 941) (#1092) 2023-02-09 10:09:58 +01:00
Eoghan Murray
3caa25ed9b Don't have requestAnimationFrame looping in background for Live Mode (#1098) 2023-02-09 10:02:38 +01:00
Yun Feng
07326182f9 fix: wrong rootId value in special iframes (#1100)
1. When some same-origin iframes are nested in cross-origin iframes, their `rootId`s are wrong.

2. The property `rootId` is missing in serialized cross-origin iframes
2023-02-09 16:23:19 +08:00
Francesco Novy
cb1580008d fix: Ensure CSS support is checked more robustly (#1106)
* fix: Ensure CSS support is checked more robustly

* Apply formatting changes

* apply eslint changes

* Update packages/rrweb/src/record/observer.ts

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>

* fix: do not use window in module scope

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2023-02-09 09:19:53 +01:00
Justin Halsall
25a4f5ab6c [fix] Don't trigger Finish event when in liveMode (#1115) 2023-02-09 08:48:57 +01:00
James Berry
a77e302178 [console-plugin] Feat: Record unhandledrejection event (#1104)
* feat/console-plugin/add-unhandledrejection-handler

* better error

* change the window object to the passed in 'win'

* empty

* improve serialized error messages

---------

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-02-06 10:28:51 +08:00
Yun Feng
fc82869409 Fix cross origin iframe bugs (#1093)
* fix: error data while recording some websites are integrated  with stripe

These websites will usually have an iframe with src "https://js.stripe.com/v3/m-outer-xxx.html"

* add test case for the bug

* fix: recordCrossOriginIframes: true does not work with pack/unpack fn

1. bugfix
2. add test case
3. add rrweb-all.js to the result of command: bundle:browser
4. make puppeteer headless in CI by default to increase the speed and stability
2023-01-16 15:26:33 +08:00
Francesco Novy
57a2e140ea feat: Guard against missing window.CSSStyleSheet (#1088) 2023-01-13 13:11:57 +08:00
Justin Halsall
07aa1b2807 Fix: shadow dom bugs (#1049)
* Add test cases for bugs

* Fix shadow dom recording

When moving an element containing shadow dom
When adding an element to shadow dom before its attached to the dom

* Apply formatting changes

* Refactor in dom checking code

* Nodes don't get processed in more than one mutation buffer

* Constrain node mutations to one mutation buffer per request animation frame

* Make tests less flaky under heavy load

* Apply suggestions from code review

* Update packages/rrweb-snapshot/test/rebuild.test.ts

* Remove unused nodeSet

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-01-10 18:51:24 +08:00
dbseel
66abe17832 Fix: isBlocked throws on invalid HTML element (#1032) 2023-01-10 17:23:29 +08:00
Yun Feng
d08913d0dc Fix missed adopted style sheets of shadow doms in checkout full snapshot (#1086)
* fix: adoptedStyleSheets in shadow doms are missed when a full snapshot is checked out after recording has started

* fix: avoid removing monkey patch of all existed shadow doms when take a new full snapshot

* Apply formatting changes

* Update packages/rrweb/test/record.test.ts

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>

* fix typo

* update outdated snapshot

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2023-01-10 17:21:20 +08:00
Yun Feng
fe69bd6456 fix: module error (#1087)
* fix: module error

refactor all suffix of bundled scripts with commonjs module from 'js' to cjs

error:
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '.../rrweb/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

* update jest config files
2023-01-10 17:20:03 +08:00
Justin Halsall
cfac5e7c73 Chore: Make tests less flakey & upgrade puppeteer to rrweb-snapshot test suite to run (#1084)
* Upgrade puppeteer to 17.1.3 in rrweb-snapshot

* Apply formatting changes

* Add ?

* Make tests less flakey

* Make attribute-setting more explicit

* Make test less flakey

* Make test less flakey

* Upgrade puppeteer for rrdom

* Use wait for request animation frame instead of timeout

* Force append to happen in second event

* Wait till iframe was loaded (now 100ms)

* Round the currentTime to 1 decimal place
2023-01-10 08:30:41 +08:00
Eoghan Murray
03821d9b9f harmonize on a single getWindowScroll (#1054)
* Fix issue where only indication I could see in any attribute that the document was scrolling was on `window.pageYOffset`, so we hadn't been able to replay scrolling

* Apply formatting changes

* Update observer.ts

help you fix typescript error

* Update utils.ts

help you fix typescript error

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-01-09 14:59:24 +08:00
Justin Halsall
729b8bf38c Fix: Catch iframe manager & fix formatting issues (#1083)
* Catch any errors observing iframes

* Fix formatting
2023-01-09 11:47:21 +08:00
Francesco Novy
44e92cbff9 Handle errors when observing iframes (#1058) 2023-01-09 11:44:33 +08:00
fukang wang
36b44e104b fix: Failed to execute insertBefore on Node (#1042)
Co-authored-by: wangfukang <wangfukang@kuaishou.com>
2023-01-09 09:35:54 +08:00
Francesco Novy
b655361a5f Export recordOptions type (#1067) 2023-01-06 21:50:06 +11:00
Jimmy Liu
7e8dcdb11d Fix muted false -> true not being set 2023-01-06 18:43:11 +08:00
Justin Halsall
a220835eeb Fix: Post message can break cross origin iframe recording (#1053) 2022-11-16 21:25:36 +08:00
Yanzhen Yu
59a1e4f7d9 fix @rrweb prefix package access 2022-11-16 14:57:54 +08:00
Yanzhen Yu
7bb68625e3 chore(release): publish new version
- rrdom-nodejs@0.1.7
 - rrdom@0.1.7
 - rrweb-player@1.0.0-alpha.4
 - rrweb-snapshot@2.0.0-alpha.4
 - rrweb@2.0.0-alpha.4
 - @rrweb/types@2.0.0-alpha.4
2022-11-16 13:12:31 +08:00
Justin Halsall
2a80949948 Cross origin iframe support (#1035)
* Add `recordCrossOriginIframe` setting

* Set up messaging between iframes

* should emit full snapshot event from iframe as mutation event

* this.mirror was dropped on attachIframe

* should use unique id for child of iframe

* Cross origin iframe recording in `yarn live-stream`

* Root iframe check thats supported by firefox

* Live stream: Inject script in all frames

* Record same origin and cross origin iframes differently

* Should map Input events correctly

* Turn on other tests

* Fix compatibility with newer puppeteer

* puppeteer vs 12 seems stable without to many changes needed

* normalize port numbers in snapshots

* Handle scroll and ViewportResize events in cross origin iframe

* Correctly map cross origin mutations

* Map selection events for cross origin iframes

* Map canvas mutations for cross origin iframes

* Update snapshot to include canvas events

* Skip all meta events

* Support custom events as best we can in cross origin iframes

* Use earliest version of puppeteer that works with cross origin live-stream

* Map mouse/touch interaction events

* Update snapshots for correctly mapped click events

* Tweak tests for new puppeteer version

* Map MediaInteraction correctly for cross origin iframes

* Make tests consistent between high and low dpi devices

* Make test less flaky

* Make test less flaky

* Make test less flaky

* Make test less flaky

* Add support for styles in cross origin iframes

* Map traditional stylesheet mutations on cross origin iframes

* Add todo

* Add iframe mirror

* Get iframe manager to use iframe mirrors internally

* Rename `IframeMirror` to `CrossOriginIframeMirror`

* Setup basic cross origin canvas webrtc streaming

* Clean up removed canvas elements

* reset style mirror on new full snapshot

* Fix cross origin canvas webrtc streaming

* Make emit optional

* Run tests on github actions

* Upload image artifacts from failed tests

* Use newer github actions

* Test: hopefully adding more wait will fix it

* add extra wait

* Fix image snapshot tests

* Make tests run with new puppeteer version

* upgrade eslint-plugin-jest

* Chore: Remove travis ci as ci's running on github actions

* Chore: Support recording cross origin iframe in repl

* Force developers to update the cross origin iframe mapping when adding new events

https://github.com/rrweb-io/rrweb/pull/1035#discussion_r1012516277

* Document cross origin iframe recording

* Docs: cross origin iframes recording methods

* Docs: AI translated, cross origin iframe recording

* rename getParentId to getId

* Migrate to @rrweb/types

* Run on pull request

* doc: improve Chinese doc

* Rename `parentId` to `Id`

Co-authored-by: Mark-Fenng <f18846188605@gmail.com>
2022-11-16 13:11:11 +08:00
luocongqiu
a9fffb3bc0 shadow root use the correct dom in iframe (#1037)
Co-authored-by: luocq3 <luocq3@asiainfo.com>
2022-11-13 16:18:58 +08:00
Justin Halsall
fdb7135fbe Fix: scrolling on elements being is ignored (#1029)
In certain cases when scrollLeft is being set, but the value doesn't change. Then scrollTop is also ignored, even if that value was changed.
In this case we use the `scrollTo` api as it doesn't have that issue.
2022-11-12 16:03:30 +08:00
Justin Halsall
9bbc3e0073 Fix: Capture css background-clip: text with browser prefix (#1047) 2022-11-12 16:02:30 +08:00
Justin Halsall
75e2280bf6 Add rrweb-player readme (#1050)
* Add rrweb-player readme

* Apply formatting changes
2022-11-12 14:02:03 +08:00
MF
e08d03988f fix CI error (#1045)
* fix CI error

* change the CI triggering event to pull_request
2022-11-07 12:54:36 +08:00
MF
1990524ebb fix: bug when handling shadow doms (#1041)
On the website https://mixpanel.com/project/2195193/view/139237/app/dashboards#id=3679845, the bottom chart makes the recorder crash (infinite loop)
2022-11-07 09:12:52 +08:00
Justin Halsall
ad9bc3ed19 Chore: Move most types from rrweb to @rrweb/types package (#1031)
* Chore: Add move most types from rrweb to @rrweb/types package

* Split off type imports

* Split off type import to its own line

* Get vite to generate type definitions

* Apply formatting changes

* noEmit not allowed in tsconfig, moved it to build step

* Align version of @rrweb/types with main rrweb package

Based on @mark-fenng's comments https://github.com/rrweb-io/rrweb/pull/1031/files#r1002298176

* Move up keywords
2022-11-04 17:25:15 +08:00
fukang wang
5012b1eb60 fix: wrappedEmit is not a function (#1034)
Co-authored-by: wangfukang <wangfukang@kuaishou.com>
2022-11-01 08:27:30 +08:00
DexxDing
bdd89400d2 Implement: Inactive activity indicator on progress bar (#1039)
* update utils.ts: add a tool function to detect inactive periods

* update Controller.svelte: add a fixed div element as an indicator

* update Controller.svelte: add one blank space at the end

* update Controller.svelte: add a variable inactivePeriods and use util function to get inactive periods

* update Controller.svelte: add width property for inactive activity indicators

* update Controller.svelte: combine calculation value with indicator UI

* update utils.ts: fix error https://github.com/HurricaHjz/rrweb_2120_ga_3/pull/5#discussion_r1008677230 and add comments

update Controller.svelte: apply Zihan's suggestion https://github.com/HurricaHjz/rrweb_2120_ga_3/pull/5#discussion_r1008678403

* update Controller.svelte: make the color of indicator customizable

update index.d.ts: add type definition for the color option

Co-authored-by: u7149141 <fengyun5264@outlook.com>
Co-authored-by: Jerry Zhang <u7305891@anu.edu.au>
Co-authored-by: fengyun5264 <115444501+fengyun5264@users.noreply.github.com>
Co-authored-by: Zihan Meng <u7354208@anu.edu.au>
Co-authored-by: HurricaHjz <105645379+HurricaHjz@users.noreply.github.com>
Co-authored-by: u6924169 <u6924169@anu.edu.au>
Co-authored-by: Majia0712 <55265314+MengZihan712@users.noreply.github.com>
2022-10-31 22:17:35 +08:00