Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
42009f3
inline stylesheets when loaded
Juice10 May 31, 2022
b9ddfae
set empty link elements to loaded by default
Juice10 Jun 1, 2022
4c10804
Clean up stylesheet manager
Juice10 Jun 1, 2022
e9f8e06
Remove attribute mutation code
Juice10 Jun 2, 2022
c11e052
Update packages/rrweb/test/record.test.ts
Juice10 Jun 7, 2022
244a26a
Update packages/rrweb/test/record.test.ts
Juice10 Jun 7, 2022
1edb1ea
Update packages/rrweb/test/record.test.ts
Juice10 Jun 7, 2022
45bafbd
Merge branch 'master' of https://github.com/rrweb-io/rrweb into seria…
Juice10 Jun 7, 2022
401c503
Update packages/rrweb/scripts/repl.js
Juice10 Jun 7, 2022
2ec406b
Update packages/rrweb/test/record.test.ts
Juice10 Jun 7, 2022
2e8492e
Update packages/rrweb/src/record/index.ts
Juice10 Jun 7, 2022
217bd7c
Add todo
Juice10 Jun 7, 2022
c0371f0
Move require out of time sensitive assert
Juice10 Jun 7, 2022
fd38d43
Merge branch 'serialize-stylesheet-contents' of https://github.com/rr…
Juice10 Jun 7, 2022
dee14a6
Add waitForRAF, its more reliable than waitForTimeout
Juice10 Jun 7, 2022
1965152
Remove flaky tests
Juice10 Jun 7, 2022
8ff7bc6
Add recording stylesheets in iframes
Juice10 Jun 7, 2022
d5a83be
Remove variability from flaky test
Juice10 Jun 7, 2022
7e3a1a8
Make test more robust
Juice10 Jun 7, 2022
8c7a38f
Fix naming
Juice10 Jun 27, 2022
6878711
Merge branch 'master' of https://github.com/rrweb-io/rrweb into seria…
Juice10 Jun 27, 2022
d2cb411
Add test cases for inlineImages
Juice10 Jun 29, 2022
18c4475
Add test cases for inlineImages
Juice10 Jun 29, 2022
9efecfe
Merge branch 'inline-image-test-cases' of https://github.com/rrweb-io…
Juice10 Jun 30, 2022
da245bd
Record iframe mutations cross page
Juice10 Jun 30, 2022
be618d3
Test: should record images inside iframe with blob url after iframe w…
Juice10 Jun 30, 2022
9fc54b4
Merge branch 'master' of https://github.com/rrweb-io/rrweb into inlin…
Juice10 Jul 1, 2022
d63a529
Handle negative ids in rrdom correctly
Juice10 Jul 1, 2022
83102f0
Update packages/rrdom/src/diff.ts
Juice10 Jul 25, 2022
f872f76
Merge branch 'master' into rrdom-negative-ids
Juice10 Jul 25, 2022
3cabbf7
Start unserialized nodes at -2
Juice10 Jul 25, 2022
3a8ce08
Set unserialized id starting number at -2
Juice10 Jul 25, 2022
14179d6
Remove duplication
Juice10 Jul 25, 2022
452cabf
Merge branch 'master' into rrdom-negative-ids
YunFeng0817 Aug 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Start unserialized nodes at -2
This way we don't accidentally think of them as mirror misses
  • Loading branch information
Juice10 committed Jul 25, 2022
commit 3cabbf74ea3b029c56c8ff6af6662eed4a08c669
2 changes: 1 addition & 1 deletion packages/rrdom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class RRDocument extends BaseRRDocumentImpl(RRNode) {
// In the rrweb replayer, there are some unserialized nodes like the element that stores the injected style rules.
// These unserialized nodes may interfere the execution of the diff algorithm.
// The id of serialized node is larger than 0. So this value less than 0 is used as id for these unserialized nodes.
private _unserializedId = -1;
private _unserializedId = -2;

/**
* Every time the id is used, it will minus 1 automatically to avoid collisions.
Expand Down
71 changes: 69 additions & 2 deletions packages/rrweb/test/__snapshots__/replayer.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,80 @@ file-cid-3
`;

exports[`replayer can fast forward past StyleSheetRule deletion on virtual elements 1`] = `
"file-frame-0
"file-frame-4
<html>
<head>
<meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=UTF-8\\" />
</head>
<body></body>
<body>
<div class=\\"replayer-wrapper\\">
<div class=\\"replayer-mouse\\"></div>
<canvas
class=\\"replayer-mouse-tail\\"
width=\\"1000\\"
height=\\"800\\"
style=\\"display: inherit\\"
></canvas
><iframe
sandbox=\\"allow-same-origin\\"
scrolling=\\"no\\"
width=\\"1000\\"
height=\\"800\\"
style=\\"display: inherit; pointer-events: none\\"
></iframe>
</div>
</body>
</html>


file-frame-5
<!DOCTYPE html>
<html lang=\\"en\\" class=\\"rrweb-paused\\">
<head>
<meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=UTF-8\\" />
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"file-cid-0\\" />
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"file-cid-1\\" />
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"file-cid-2\\" />
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"file-cid-3\\" />
</head>
<body>
<a class=\\"css-added-at-1000-deleted-at-2500\\">string</a>
</body>
</html>


file-cid-0
@charset \\"utf-8\\";

.rr-block { background: currentcolor; }

noscript { display: none !important; }

html.rrweb-paused *, html.rrweb-paused ::before, html.rrweb-paused ::after { animation-play-state: paused !important; }


file-cid-1
@charset \\"utf-8\\";

.css-added-at-400 { padding: 1.3125rem; flex: 0 0 auto; width: 100%; }


file-cid-2
@charset \\"utf-8\\";

.css-added-at-200-overwritten-at-3000 { opacity: 1; transform: translateX(0px); }

.css-added-at-500-overwritten-at-3000 { border: 1px solid blue; }


file-cid-3
@charset \\"utf-8\\";

.css-added-at-200 { position: fixed; top: 0px; right: 0px; left: 4rem; z-index: 15; flex-shrink: 0; height: 0.25rem; overflow: hidden; background-color: rgb(17, 171, 209); }

.css-added-at-200.alt { height: 0.25rem; background-color: rgb(190, 232, 242); opacity: 0; transition: opacity 0.5s ease 0s; }

.css-added-at-200.alt2 { padding-left: 4rem; }
"
`;

Expand Down
29 changes: 12 additions & 17 deletions packages/rrweb/test/replayer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,7 @@ describe('replayer', function () {
).length,
);

await assertDomSnapshot(
page,
__filename,
'style-sheet-rule-events-play-at-1500',
);
await assertDomSnapshot(page);
});

it('should apply fast forwarded StyleSheetRules that where added', async () => {
Expand Down Expand Up @@ -194,21 +190,20 @@ describe('replayer', function () {
).length,
);

await assertDomSnapshot(
page,
__filename,
'style-sheet-remove-events-play-at-2500',
);
await assertDomSnapshot(page);
});

it('can fast forward past StyleSheetRule deletion on virtual elements', async () => {
await page.evaluate(`events = ${JSON.stringify(styleSheetRuleEvents)}`);

await assertDomSnapshot(
page,
__filename,
'style-sheet-rule-events-play-at-2500',
);
const actionLength = await page.evaluate(`
const { Replayer } = rrweb;
const replayer = new Replayer(events);
replayer.pause(2600);
replayer['timer']['actions'].length;
`);

await assertDomSnapshot(page);
});

it('should delete fast forwarded StyleSheetRules that where removed', async () => {
Expand Down Expand Up @@ -634,7 +629,7 @@ describe('replayer', function () {
`);
await page.waitForTimeout(50);

await assertDomSnapshot(page, __filename, 'ordering-events');
await assertDomSnapshot(page);
});

it('replays same timestamp events in correct order (with addAction)', async () => {
Expand All @@ -648,6 +643,6 @@ describe('replayer', function () {
`);
await page.waitForTimeout(50);

await assertDomSnapshot(page, __filename, 'ordering-events');
await assertDomSnapshot(page);
});
});
6 changes: 1 addition & 5 deletions packages/rrweb/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,7 @@ export function replaceLast(str: string, find: string, replace: string) {
return str.substring(0, index) + replace + str.substring(index + find.length);
}

export async function assertDomSnapshot(
page: puppeteer.Page,
filename: string,
name: string,
) {
export async function assertDomSnapshot(page: puppeteer.Page) {
const cdp = await page.target().createCDPSession();
const { data } = await cdp.send('Page.captureSnapshot', {
format: 'mhtml',
Expand Down