Commit Graph

1013 Commits

Author SHA1 Message Date
fukang wang
ce6019d274 feat: support media playbackRate (#1000)
Co-authored-by: wangfukang <wangfukang@kuaishou.com>
2022-09-15 23:05:10 +08:00
fukang wang
a9a255931f fix: add mutation lost in slimDOMOptions (#994)
* fix: add mutation lost in slimDOMOptions

* fix: slimDOMOptions-mutation-lost

Co-authored-by: wangfukang <wangfukang@kuaishou.com>
2022-09-15 23:02:10 +08:00
Justin Halsall
a8478f1da4 [Plugin] Live stream canvas via webrtc (#976)
* inline stylesheets when loaded

* set empty link elements to loaded by default

* Clean up stylesheet manager

* Remove attribute mutation code

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

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

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

* Update packages/rrweb/scripts/repl.js

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

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

* Add todo

* Move require out of time sensitive assert

* Add waitForRAF, its more reliable than waitForTimeout

* Remove flaky tests

* Add recording stylesheets in iframes

* Remove variability from flaky test

* Make test more robust

* Fix naming

* Add test cases for inlineImages

* Add test cases for inlineImages

* Record iframe mutations cross page

* Test: should record images inside iframe with blob url after iframe was reloaded

* Handle negative ids in rrdom correctly

When iframes get inserted they create untracked elements, both on the dom and rrdom side.
Because they are untracked they generate negative numbers when fetching the id from mirror.
This creates a problem when comparing and fetching ids across mirrors.
This commit tries to get away from using negative ids as much as possible in rrdom's comparisons

* Update packages/rrdom/src/diff.ts

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>

* Start unserialized nodes at -2

This way we don't accidentally think of them as mirror misses

* Set unserialized id starting number at -2

* Remove duplication

* Use turbo instead of lerna

* Skip benchmark as it is unreliable when executed in parallel

* Strip port number from serialization, it can vary

* Add settimeout to virtual dom test

* Remove console.log and refactor blob:url serialization

* Include references in tsconfig to indicate which monorepo packages are being used

* Add stream setup

* Migrate project to es module

* Add reference to rrweb from rrdom

* Move jest config to ESM

* Setup basic WebRTC canvas streaming

* Cleanup and refactor WebRTC streaming

* Remove ? which isn't propper javascript

* Yarn lock

* Remove webrtc code from rrweb

* Add plugin hooks

Record/Replay plugins
`.getMirror` exposes the mirror to plugins

Replay plugins
`.onBuild` called whenever a node was added to the dom

* Expose plugins with server

* Use unminified version for tests

* Don't include simple-peer in rrweb main project

* Add canvas webrtc plugin

Streams contents of canvas via webrtc

* ignore tsconfig.tsbuildinfo

* Cleanup unused code

* type definition files are no longer committed

* Devtools off by default

* Extract .css into its own file

* Refactor plugin apis and fix multi canvas streaming support

* Add readme to rrweb canvas webrtc plugin

* Reference canvas-webrtc plugin in documentation

* Forbidden non-null assertion

* Remove linting of each project, yarn lint:report will do this

* Remove test code

* Cut down line length

* fix CI failure and improve the zh_CN doc

* Update packages/rrweb/src/plugins/canvas-webrtc/replay/index.ts

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>

* Cleaner styling of replay

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>

* Clean up stream.js based on @Mark-Fenng's feedback

* Remove duplicate send

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2022-09-15 11:24:05 +08:00
dbseel
49d143f777 Ensure positions has length before referencing (#998) 2022-09-15 11:23:38 +08:00
luocongqiu
7be26b07eb fix: iframe input hook (#991)
* fix: iframe input hook (#990)

* Update observer.ts

* format code with prettier

* format all code with prettier

Co-authored-by: luocq3 <luocq3@asiainfo.com>
Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
2022-09-09 11:25:21 +08:00
Yun Feng
31890f0021 fix error for prettier action (#992)
* create a bait error for prettier

* refactor github action config

* Apply formatting changes

Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
2022-09-09 00:42:34 +08:00
luocongqiu
6eaec0424d fix: Iframe replay fails after the second full snapshot #983 (#984) 2022-09-08 21:51:39 +08:00
Yun Feng
e7fdf53366 fix: can't record shadow root's children except the last one (#956)
* fix: can't record shadow root's children except the last one

* remove unnecessary type cast
2022-09-07 13:35:55 +08:00
Yun Feng
f1b5cb2738 CI: add a prettier GitHub action to format code automatically (#988)
* CI: add a prettier GitHub action to format code automatically

* improve GitHub Action config and format some files

* Apply formatting changes

* CI: make the prettier action a standalone action

* Apply formatting changes

* CI: add push as new trigger event

Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
2022-09-06 09:38:43 +08:00
dbseel
5ba933cce3 isBlocked factors in the selector (#894)
* isBlocked factors in the selector

* Ensure contains parameter is a node

* Fix blockSelector blocking for closest nodes

* Fix integration test

* adding ignoreCSSAttributes to ignore the addition of certain css attributes

* tested ignoreCSSAttributes

* Update test snapshot

* swapped the wrapping of htmlelement to be element

* Fix linter errors

* Address MR feedback

* Rebase

Co-authored-by: Filip <filipslatinac@gmail.com>
2022-08-30 13:27:24 +08:00
何遇
ac7935e378 fix: record canvas by fps when blockClass is RegExp (#966)
* fix: Fixed a bug where FPSObserver cannot record Canvas when blockClass is a regular expression

* Update packages/rrweb/src/record/observers/canvas/canvas-manager.ts

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-08-27 09:04:26 +08:00
Justin Halsall
e0ca9158f8 Create CONTRIBUTING.md (#969) 2022-08-22 20:36:31 +08:00
Justin Halsall
5f3e027604 Create CODE_OF_CONDUCT.md (#968) 2022-08-22 20:35:51 +08:00
Yun Feng
1fb1102eba add more questions for issue template (#965) 2022-08-21 16:36:06 +08:00
Justin Halsall
0554408cc0 Include eslint jest (#959) 2022-08-19 17:59:19 +08:00
Yun Feng
5f59f9171e feat: add a destroy function to destroy the whole player (#953)
* feat: add a destroy function to destroy the whole player

* doc: update guidance document

* Update packages/rrweb/src/replay/index.ts

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

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-08-11 19:39:16 +08:00
Yun Feng
a0d53738f8 fix: errors when fast-forward selection events (#952) 2022-08-11 13:08:42 +08:00
Justin Halsall
fd85c79ea9 Handle negative ids in rrdom correctly + extra tests (#927)
* inline stylesheets when loaded

* set empty link elements to loaded by default

* Clean up stylesheet manager

* Remove attribute mutation code

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

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

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

* Update packages/rrweb/scripts/repl.js

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

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

* Add todo

* Move require out of time sensitive assert

* Add waitForRAF, its more reliable than waitForTimeout

* Remove flaky tests

* Add recording stylesheets in iframes

* Remove variability from flaky test

* Make test more robust

* Fix naming

* Add test cases for inlineImages

* Add test cases for inlineImages

* Record iframe mutations cross page

* Test: should record images inside iframe with blob url after iframe was reloaded

* Handle negative ids in rrdom correctly

When iframes get inserted they create untracked elements, both on the dom and rrdom side.
Because they are untracked they generate negative numbers when fetching the id from mirror.
This creates a problem when comparing and fetching ids across mirrors.
This commit tries to get away from using negative ids as much as possible in rrdom's comparisons

* Update packages/rrdom/src/diff.ts

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>

* Start unserialized nodes at -2

This way we don't accidentally think of them as mirror misses

* Set unserialized id starting number at -2

* Remove duplication

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
2022-08-06 17:00:05 +08:00
Jinxing Lin
b2d56898a8 rrweb: add selection observer (#936)
* rrweb: add selection observer

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

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

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

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* Update packages/rrweb/src/replay/index.ts

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* remove: repeat updateSelection

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

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* remove: utils sample events

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2022-08-06 16:59:42 +08:00
Yanzhen Yu
abc035fd00 chore(release): publish new version
- rrdom-nodejs@0.1.4
 - rrdom@0.1.4
 - rrweb-player@1.0.0-alpha.1
 - rrweb-snapshot@2.0.0-alpha.1
 - rrweb@2.0.0-alpha.1
2022-07-31 11:48:29 +08:00
Yun Feng
cb24aaf6aa add benchmark for replayer's fast-forward mode (#947)
* add benchmark for replayer's fast-forward mode

* add comments

* change the title

* build: make benchmark a seperate command
2022-07-31 11:45:57 +08:00
Yun Feng
f1b23ddccc fix: canvas data in iframe wasn't applied in the fast-forward mode (#944)
* fix: canvas data in iframe wasn't applied in the fastforward mode

* add more comments

* Update packages/rrdom/src/diff.ts

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

* apply Juice10's suggestion

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-07-31 09:01:04 +08:00
Yun Feng
aecaefbf45 chore: remove all typings, add them all to .gitignore file and update turbo.json (#949) 2022-07-31 08:38:22 +08:00
Eoghan Murray
b618f095df Remove typings files as these can be regenerated with npm run typings from their src/types.ts masters, and are an extra source of conflicts if they remain in git (#946) 2022-07-26 22:54:27 +08:00
Yanzhen Yu
16089fc6b5 fix console plugin example 2022-07-25 23:56:01 +08:00
Eoghan Murray
ba4bcbea8d Bump jsdom to latest version as was getting error TS2305: Module '"parse5"' has no exported member 'ElementLocation'. (#945) 2022-07-25 23:44:55 +08:00
Yun Feng
df9d5bb02c fix: eslint action error in a PR from a fork repo (#943)
* fix: eslint action error in a PR from a fork repo

error message: 'Resource not accessible by integration'

* try to fix the github action error
2022-07-23 12:51:51 +08:00
Yun Feng
f03504a731 fix issue #933 (#942)
* fix: style not applied to polyfillled shadow dom

* test: add integration test for shadydom and @lwc/synthetic-shadow

* improve the implementation of function isNativeShadowDom

* apply lele0108's review suggestion
2022-07-22 20:36:43 +08:00
Yun Feng
999f1a5242 style: remove all tslint related comments (#934) 2022-07-22 20:33:41 +08:00
Yun Feng
8ad43254ff add special handling for undefined console content (#935) 2022-07-22 19:02:08 +08:00
dependabot[bot]
1fefbd8eb8 chore(deps-dev): bump svelte from 3.40.0 to 3.49.0 (#937)
Bumps [svelte](https://github.com/sveltejs/svelte) from 3.40.0 to 3.49.0.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/compare/v3.40.0...v3.49.0)

---
updated-dependencies:
- dependency-name: svelte
  dependency-type: direct:development
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-22 19:01:35 +08:00
dependabot[bot]
a014e61736 chore(deps): bump terser from 5.7.1 to 5.14.2 (#940)
Bumps [terser](https://github.com/terser/terser) from 5.7.1 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-22 19:01:19 +08:00
Jimmy Liu
f3064c1f2d Fix href in <use> to not use absolute url (#938) 2022-07-16 14:51:56 +08:00
Yun Feng
72874f2fd2 add Eslint action and update travis CI (#931)
* refactor: eliminate eslint errors as many as I can

* refactor: fix more eslint errors in the record module

* LINT: fix @typescript-eslint/unbound-method

* LINT: fix all eslint errors in source code

* LINT: fix as many eslint warnings as possible

* CI: add a github action to check ESLINT status

* CI: update github action

* build: update travis CI and github action

* CI: update github action

* CI: update job name

* CI: restore test command from turbo to lerna

* Merge branch master into eslint-action

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-07-10 16:15:48 +08:00
Yanzhen Yu
2d4dd22966 chore(release): publish new version
- rrdom-nodejs@0.1.3
 - rrdom@0.1.3
 - rrweb-player@1.0.0-alpha.0
 - rrweb-snapshot@2.0.0-alpha.0
 - rrweb@2.0.0-alpha.0
2022-07-10 15:51:45 +08:00
Yun Feng
83394c3db4 refactor: eliminate eslint errors (#920)
* refactor: eliminate eslint errors as many as I can

* refactor: fix more eslint errors in the record module

* LINT: fix @typescript-eslint/unbound-method

* LINT: fix all eslint errors in source code

* LINT: fix as many eslint warnings as possible

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-07-10 15:49:20 +08:00
dependabot[bot]
15cb0b8cd3 Bump parse-url from 6.0.0 to 6.0.2 (#930)
Bumps [parse-url](https://github.com/IonicaBizau/parse-url) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/IonicaBizau/parse-url/releases)
- [Commits](https://github.com/IonicaBizau/parse-url/commits)

---
updated-dependencies:
- dependency-name: parse-url
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-08 12:21:05 +08:00
Yun Feng
01612b7a75 update cssom package to rrweb self-owned package 'rrweb-cssom' (#925)
* test: update cssom package to rrweb self-owned package 'rrweb-cssom'

* style: remove outdated comments
2022-07-02 13:55:45 +08:00
Justin Halsall
d5d877e380 Inline stylesheets on load (#909)
* inline stylesheets when loaded

* set empty link elements to loaded by default

* Clean up stylesheet manager

* Remove attribute mutation code

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

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

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

* Update packages/rrweb/scripts/repl.js

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

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

* Add todo

* Move require out of time sensitive assert

* Add waitForRAF, its more reliable than waitForTimeout

* Remove flaky tests

* Add recording stylesheets in iframes

* Remove variability from flaky test

* Make test more robust

* Fix naming
2022-07-01 13:29:09 +08:00
Justin Halsall
a31e272bf2 Remove children of Document even if doc not in mirror (#923)
* Remove children of Document even if doc not in mirror

* fix flaky test

* Update packages/rrdom/test/diff.test.ts

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
2022-07-01 12:26:24 +08:00
Justin Halsall
c81e609d7b Lock yarn to 1.23.0 (#922)
* Lock yarn to 1.23.0

* fix flaky test

* Fix flaky tests
2022-06-30 23:20:26 +08:00
yz-yu
af8ed5513c unify typescript version and rollup plugins (#921) 2022-06-25 21:08:06 +08:00
yz-yu
d35110521a integrate turborepo in monorepo (#918)
* integrate turborepo in monorepo

* integrate turborepo in monorepo
2022-06-20 22:55:10 +08:00
yz-yu
74f553afc3 move browser-only rrdom features to the new rrdom package (#913) 2022-06-20 22:02:21 +08:00
eliyabar
0fb8a6bfa8 Update dive-into-event.md (#914) 2022-06-16 22:43:05 +08:00
Justin Halsall
058c4579b4 Speed up snapshotting of many new dom nodes (#903)
* Speed up snapshotting of many new dom nodes

By avoiding reflow we shave about 15-25% off our snapshotting time

* Improve newlyAddedElement docs

* Optimize needMaskingText by using el.closest and less recursion

* Serve all rrweb dist files

* Split serializeNode into smaller functions

Makes it easier to profile

* Slow down cpu enhance tracing on fast machines

* Increase timeout

* Perf: only loop through ancestors when they have something to compare to

* Perf: `hasNode` is cheaper than `getMeta`

* Perf: If parents where already checked, no need to do it again

* Perf: reverse for loops are faster

Because they only do the .lenght check once. In this case I don't think we'll see much performance gains if any

* Clean up code

* Perf: check ancestors once with isBlocked

* guessing this might fixes canvas test

* Update packages/rrweb/src/record/observers/canvas/webgl.ts

Co-authored-by: yz-yu <yanzhen@smartx.com>

* Fix #904 (#906)

Properly remove crossorigin attribute

* Bump minimist from 1.2.5 to 1.2.6 (#902)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: yz-yu <yanzhen@smartx.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-06 22:55:15 +08:00
dependabot[bot]
9e249b9761 Bump minimist from 1.2.5 to 1.2.6 (#902)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-05 14:42:06 +08:00
Justin Halsall
9da1e432cc Fix #904 (#906)
Properly remove crossorigin attribute
2022-05-31 16:15:48 +08:00
Justin Halsall
1355917e1b Chore: Add issue/pr template and general housekeeping tools and docs (#900)
* Add linting

* Add issue templates and docs

* Add root eslint config and remove tslint

* Autofix lint issues
2022-05-22 09:59:42 +08:00
yz-yu
a43d4e4255 Introduce benchmark tests and improve snapshot attributes traversing (#897)
* housekeeping: refine test utils

* setup benchmark tests

* improve snapshot attributes loop perf
2022-05-14 14:52:26 +08:00