Commit Graph

368 Commits

Author SHA1 Message Date
Eoghan Murray
11f6567fd8 Extend to run fixBrowserCompatibilityIssuesInCSS over inline stylesheets (#1279)
* Extend to run fixBrowserCompatibilityIssuesInCSS over styles in inline style sheets

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
2023-08-11 15:19:33 +02:00
github-actions[bot]
8a48e42378 Version Packages (alpha) (#1252)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-07 10:21:52 +02:00
Justin Halsall
a3de582e9c Canvas recording: Preserve drawing buffer (#1273)
* Upgrade jest to 29 and puppeteer to 16 in rrweb

* Apply formatting changes

* Upgrade rrweb's puppeteer to v20

* Apply formatting changes

* Canvas: Reduce flickering and capturing of empty canvas elements

Turn on `preserveDrawingBuffer` by default for canvas FPS recording.
Has some negative performance implications, but really helps when capturing canvas.

* Apply formatting changes

* Include all test image snapshots in ci

* Apply formatting changes

* Allow more flexibility when capturing hover

* Apply formatting changes

* Create tiny-chairs-build.md

* Apply formatting changes

* Update hover.test.ts

* Apply formatting changes

* Document snapshotFormat jest config

* Freeze `yarn.lock` in ci for reproducible dependencies

* Apply formatting changes

* Apply formatting changes

* Revert to old style of puppeteer evaluation script notation

* Apply formatting changes

* Make test less flaky

* Apply formatting changes

* Apply formatting changes

* Make tests less flaky

* Apply formatting changes

* Make test more robust

* Apply formatting changes

* Apply formatting changes

* Add debugging code for test

* Apply formatting changes

* Also test not ignored input

* Apply formatting changes

* Apply formatting changes

* Apply formatting changes

* escape ignoreSelector

* Apply formatting changes

* Apply formatting changes
2023-08-04 18:35:49 +02:00
Billy Vong
36da39db36 feat: Add ignoreSelector option (#1262)
* feat: Add `ignoreSelector` option

Similar to `ignoreClass`, but accepts a CSS selector so that you can use any CSS selector.

* Apply formatting changes

* Create clean-shrimps-lay.md

* Apply formatting changes
2023-08-04 10:30:03 +02:00
Eoghan Murray
7103625b46 Mutation (attribute & text) duplicate info elimination (#1269)
* Add a test which demonstrates how no mutations are generated when an element is created & destroyed in the same 'cycle' (a cylce here being enforced by freezePage)

* Test demonstrating current behaviour I'm about to modify; the data-test="x" attribute is present twice in the mutation, as is the textContent value of 'y'

* Attribute or text modifications on just-added nodes are redundant as demonstrated in test case

* Some correct test changes from other tests; I've manually inspected each of these mutation removals and confirmed that the attribute values are already present in the newly added nodes elsewhere in the same mutation

* Improve reliability of test case as per Justin's advice
2023-08-03 17:11:43 +01:00
Eoghan Murray
d872d2809e Compact style mutation fixes and improvements (#1268)
* Don't use the CSSOM when there's `var()` present as it fails badly https://github.com/rrweb-io/rrweb/pull/1246

* As the CSS Object Model expands out shorthand properties, do a check on the string length before choosing which format to go for

 - this approach allows 'var()' in a styleOMValue as it's only a problem when combined with a shorthand property
 - before this change background:black; was getting expaned to 10 OM properties as follows:

'style': {
    'background-color': 'black',
    'background-image': false,
    'background-position-x': false,
    'background-position-y': false,
    'background-size': false,
    'background-repeat-x': false,
    'background-repeat-y': false,
    'background-attachment': false,
    'background-origin': false,
    'background-clip': false
}

* Updates to remainder of tests based on refined compact style mutations

* Apply suggestions from code review by: Justin Halsall <Juice10@users.noreply.github.com>

---------

Authored-by: eoghanmurray <eoghan@getthere.ie>
2023-08-03 13:56:31 +01:00
Francesco Novy
c6600e742b fix: Fix CSS rules captured in Safari (#1253)
* fix: Fix CSS rules captured in Safari

* Apply formatting changes

* add changeset

* fix

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
2023-07-07 15:23:38 +02:00
Francesco Novy
d0fbe23c63 fix: Handle case where event is null/undefined (#1254)
* fix: Handle case where `event` is null/undefined

* add changeset
2023-07-07 15:22:54 +02:00
fukang wang
bbbfa226fc fix: Resize and MediaInteraction events repeat generated after the iframe appeared (#1251)
* fix: Resize and MediaInteraction events repeat generated after the iframe appeared

* Create nervous-buses-pump.md

* Apply formatting changes

---------

Co-authored-by: wangfukang <wangfukang@kuaishou.com>
Co-authored-by: wfk007 <wfk007@users.noreply.github.com>
2023-07-07 11:57:37 +02:00
github-actions[bot]
46df5cd988 Version Packages (alpha) (#1216)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-30 10:54:51 +02:00
Justin Halsall
a01a12ef67 Fix types in rrwebPlayer (#1247)
* Export correct mirror in player

Was using DeprecatedMirror in its types, that shouldn't be used anymore.

* Add playRange to types

* Create smooth-poems-bake.md

* Apply formatting changes

* Add $set to player type

* Update smooth-poems-bake.md

* Apply formatting changes

* Last two arguments of playRange are optional
2023-06-30 02:35:38 +02:00
Eoghan Murray
490b3e2b62 Guard against redefinition of Date.now (#1196)
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. https://github.com/datejs/Datejs/issues/92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

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

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2023-06-02 12:20:14 +02:00
Eoghan Murray
325a9f093e Update test commands (#1205)
* As per @Yun Feng: everyone has npm installed globally but maybe not yarn

* Add command to enable test result updating

* Default to running tests HEADLESS on rrweb

* Add command to build:all in a low memory environment

* Add a 'retest' command for when the code hasn't changed, but you are working on the test cases

* Add commands to reformat according to prettier. Named 'reformat' to indicate that we are doing a `--write`

* Update package.json

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

* Apply suggestions from code review

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

* Create few-turkeys-reflect.md

* Apply formatting changes

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-06-02 12:19:35 +02:00
Francesco Novy
d7c72bff07 fix: Ensure attributes are lowercased when checking (#1183)
* fix: Ensure attributes are lowercased when checking

* add changeset

* fix to lower case

* Apply formatting changes

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
2023-06-02 12:16:37 +02:00
Yun Feng
b798f2dbc0 Fix rrdom bugs (#1222)
* fix: rrdom bug

1. fix one bug of the diff algorithm
2. omit srcdoc attribute of iframe

* use linked list to iterate children

* fix the bug that the children of shadowRoot don't get diffed

* add test cases

* add change log
2023-06-02 11:44:00 +02:00
Eoghan Murray
a6ce7182ce Avoid triggering a CSP (content security policy) error (#846)
* Fix for #816 - avoid triggering a CSP (content security policy) error with `.setAttribute('style')`

* The bare unattachedDoc that I previously naively created didn't have a doctype and wasn't a HTML document, so the child style element didn't have the `old.style` attribute available

* Add a try/catch to provide some robustness in case `document.implementation.createHTMLDocument` isn't available
2023-05-22 12:53:36 +10:00
fukang wang
a1ec9a273e perf: optimize performance of the DoubleLinkedList get (#1220)
* perf: optimize performance of the DoubleLinkedList get

* fix: delete addedNodeIndexArr
2023-05-22 12:19:28 +10:00
Ben White
4dcdcf7ec4 fix: Rrror parser throw (#1225)
* Warn instead of throwing error when parsing for console logs

* Added error to warning
2023-05-15 22:19:42 +10:00
Yun Feng
23d01387f4 rrvideo: improve the video quality and add a progress bar for the CLI tool (#1197)
* refactor rrvideo: use playwright rather than puppeteer

* add a progress bar for the tool

* add tests for cli.ts

* fix build error

* add change log

* update readme file

* Apply a scaling method to improve the resolution of the output video
2023-05-01 14:04:38 +02:00
fukang wang
ebcbe8b0d7 perf: record processMutation (#1214)
* perf: record processMutation

* Create mean-tips-impress.md

* Apply formatting changes
2023-05-01 10:15:58 +08:00
github-actions[bot]
db66eb47a6 Version Packages (alpha) (#1199) 2023-04-16 14:33:43 +08:00
Eoghan Murray
c550cfa614 Reduce verbosity/redundancy of new pointerType attribute (#1206)
* Reduce verbosity/redundancy of output of new pointerType attribute by confining it only to clicks (and to a MouseDown/MouseUp from a PointerTypes.Pen, as these don't yet have a dedicated PendDown/PenUp)

* Update how the changeset will read for the next release based on the trimming in this PR

* Prefer triple equals

* The assignment to the outer `pointerType` variable in an anonymous function was somehow missed by the `typings` check

* Apply formatting changes

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

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

---------

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-04-16 14:28:47 +08:00
Ben White
bc84246f78 feat: Added support maskInputFn with HTMLElement (#1188) 2023-04-15 09:31:39 +02:00
re-fort
94d06536e3 fix: change default value of input type from null to text (#1200)
* fix: change default value of input type from null to text

* Apply formatting changes

* add changeset

* add a comment related to the type of input element
2023-04-14 16:04:02 +08:00
Eoghan Murray
f88471184c Merge pull request #1201 from eoghanmurray/pointerTypeFixups
Pointer type fixups
2023-04-13 11:25:40 +01:00
Eoghan Murray
004d29ba70 eslint was giving an error here 2023-04-12 15:11:51 +01:00
Eoghan Murray
961abec782 Get puppeteer to produce a touch event - this also uncovered an error where a subsequent click would be picked up as a touch (see thisEventKey change) 2023-04-12 15:11:51 +01:00
Eoghan Murray
3ce6903122 Add a baseline test for clicking links 2023-04-12 13:55:05 +01:00
Eoghan Murray
777ab9a7cd pointerType shows up in clicks in these tests on my machine; 0=PointerTypes.Mouse is expected 2023-04-12 13:14:04 +01:00
Eoghan Murray
0228137f51 The type system was complaining about the remote possibility that e ended up as a TouchEvent instead of an individual Touch object I think 2023-04-12 13:13:53 +01:00
Eoghan Murray
b00798099a Fixup type errors 2023-04-12 12:10:04 +01:00
Eoghan Murray
41cc822f1d Merge pull request #1129 from eoghanmurray/pointerType
Record pointerType on clicks
2023-04-12 11:20:10 +01:00
Charlie Gracie
b5e30cf6cc fix: Set finished=false in goto instead of handleProgressClick (#1198)
* Reset the finished flag in goto

If the player finishes a replaying a video the `finished` boolean is set to true. This allows the video to be restarted at the beginning if the controller is toggled again. If a user clicks on the progress bar the `finished` boolean is reset so if the `toggle` API is called it starts at the right place. If a user programatically calls `goto` which is the underlying API that handling the progress click calls the next invocation of `toggle` will start the video at the beginning instead of the proper location.

* Create controller-finish-flag.md

* Update controller-finish-flag.md
2023-04-08 11:50:25 +10:00
Francesco Novy
aa79db7568 fix: Fix input.type check (#1184)
* fix: Fix input.type check

Actually I noticed that `el.type` returns `text` when type is not explicitly set, so this is slightly incorrect.

* fix linting

* Apply formatting changes
2023-04-08 00:18:22 +10:00
Yun Feng
d0fdc0f273 improve: add try catch to snapshot.ts 's masking text function (#1148)
* improve: add try catch to snapshot.ts to make it robust

* add change log
2023-04-07 19:25:22 +10:00
eoghanmurray
be856443dd Apply formatting changes 2023-04-05 15:51:24 +00:00
Eoghan Murray
3a6de4b129 Make the pointerType into an Enum to be consistent with other values in events 2023-04-05 16:49:44 +01:00
eoghanmurray
73ee29f208 Apply formatting changes 2023-03-30 16:12:33 +00:00
Eoghan Murray
351c5551da Record pointerType on clicks - could be useful for displaying e.g. a circle rather than a point during replay
- We have to switch to 'onpointerdown' & 'onpointerup' in order to actually capture `e.pointerType`
 - this replaces 4 event listeners (MouseDown/MouseUp/TouchStart/TouchEnd) with 2 pointer ones which should fire in all 4 scenarios. We still output the old types according to the MouseInteractions enum
 - there is no Pointer equivalent of Click, so we leave that is, but use the last Pointer event to attach a pointerType to (only) the click event, where it is most useful
 - we can fallback to the old method for any browsers not supporting `window.PointerEvent`, in which case \`pointerType\` will be absent from all events
2023-03-30 17:06:52 +01:00
github-actions[bot]
1b2855bde1 Version Packages (alpha) (#1175)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-28 19:05:18 +02:00
Yun Feng
f1f5865dcf move rrvideo to monorepo (#1181)
* first commit

* rrvideo v0.1.0

First version of rrvideo.

1. Use as a Node.JS lib.
2. Use as a CLI.

Features are implemented via puppeteer, ffmpeg and rrweb-player.

* add readme

* update publish script

* add node env in cli file and change package.json bin to same like README (#4)

Co-authored-by: Xu Yinjie <xuyinjie@xiaobangtouzi.com>

* release 0.2.0

* fix #6 avoid assign undefined to config

* Fix: Solve the inconsistency between rrvideo and the real recorded page rendering when rendering the page with a headless browser (https://github.com/rrweb-io/rrvideo/pull/26)

Author: xujiujiu <906784584@qq.com>

---------

Co-authored-by: xujiujiu <906784584@qq.com>

* refactor rrvideo

1. refactor code
2. change monorepo config
3. remove separate TS dependencies

* add changeset

* fix: eslint errors

---------

Co-authored-by: Yanzhen Yu <yanzhen@smartx.com>
Co-authored-by: xyj <593500664@qq.com>
Co-authored-by: Xu Yinjie <xuyinjie@xiaobangtouzi.com>
Co-authored-by: xujiujiu <906784584@qq.com>
2023-03-28 19:02:22 +02:00
Justin Halsall
1e6f71b3cd Fix: Trigger mouse movement & hover with mouse up/down in sync mode (#1191)
* Trigger mouse movement & hover with mouse up/down in sync mode

* Trigger touchActive and mouseDown on flush
2023-03-28 18:59:40 +02:00
Yun Feng
267e990dc0 Fix: processed-node-manager is created even in the environment that doesn't need a recorder (#1186)
* Fix: processed-node-manager is created even in the environment that doesn't need a recorder

* apply Justin's suggestion

End the RAF loop when the recorder stops
2023-03-24 17:55:22 +11:00
Francesco Novy
a225d8e141 feat: Allow to pass errorHandler as record option (#1107)
* feat: Allow to pass `errorHandler` as record option

* add docs

* Apply formatting changes
2023-03-22 10:24:36 +08:00
Francesco Novy
d2582e9a81 feat: Ensure password inputs are masked when switching type (#1170)
* feat: Ensure password inputs are masked when switching type


Apply formatting changes

use data- attribute


ref: Ensure type is always lowercased


add changeset

* extract into util

* Apply formatting changes
2023-03-20 20:13:23 +08:00
Eoghan Murray
a82a3b42b1 Extend the suppression of warnings to take into account anscestors (#1145)
* Extend the suppression of warnings to take account that a prior removal may not have been against the immediate parent of a subsequent removal, but rather some anscestor

* Create proud-experts-jam.md

* Apply formatting changes
2023-03-18 17:51:52 +11:00
fukang wang
e0f862bac7 fix: worker_thread warning (#1179)
* fix: worker_thread warning

* Create fast-chefs-smell.md

* Apply formatting changes

* Update fast-chefs-smell.md
2023-03-18 17:21:49 +11:00
fukang wang
5982c8972a fix: Cannot set property attributeName of #<MutationRecord> which has only a getter (#1173)
* fix: Cannot set property attributeName of #<MutationRecord> which has only a getter

* fix: attributeName readonly
2023-03-15 18:11:02 +08:00
sky
4cb4d0e95a improve: some websites rebuild imcomplete (#1163)
* improve: mutation.ts, loop use Set replace Array

* improve: add a try-catch to utils.ts to make it robust

* Create yellow-mails-cheat.md

---------

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-03-13 14:29:48 +08:00
fukang wang
e7f0c808c3 fix: inline images onload (#1174)
* fix: inline images onload

* add integration test case

* Apply formatting changes

* Create small-olives-arrive.md

---------

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2023-03-13 13:56:09 +08:00