Commit Graph

1094 Commits

Author SHA1 Message Date
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
Justin Halsall
28111c14b1 Fix broken changeset release action (#1134)
* Fix broken changeset release action

* Create mighty-frogs-sparkle.md
2023-02-15 08:39:23 +11: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
227d43abb9 refine change logs (#1126) 2023-02-12 14:47:51 +01: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
Justin Halsall
2946f102ff Add needed dependency for changeset formatter (#1125) 2023-02-12 13:50:28 +01:00
Justin Halsall
fdce994018 Add friendly changelog message (#1124)
* Add friendly changelog message

* add empty changelog
2023-02-12 13:39:52 +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
Yun Feng
8d209a62f3 add change log and update readme (#1122) 2023-02-12 13:22:05 +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
dependabot[bot]
7e002b9bda chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1108)
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 10:27:30 +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
dependabot[bot]
55cc1b3487 chore(deps): bump loader-utils from 1.4.0 to 1.4.2 (#1051)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 09:37:09 +08:00
dependabot[bot]
9354636201 chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#1068)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 09:09:46 +08:00
dependabot[bot]
6be4437905 chore(deps): bump express from 4.17.1 to 4.18.2 (#1076)
Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.18.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.18.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 09:08:52 +08:00
dependabot[bot]
a596a1ea49 chore(deps): bump qs from 6.5.2 to 6.5.3 (#1072)
Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 09:04:12 +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