-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
aecaefb
commit f1b23dd
Showing
5 changed files
with
232 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types'; | ||
|
||
const now = Date.now(); | ||
|
||
const events: eventWithTime[] = [ | ||
{ | ||
type: EventType.DomContentLoaded, | ||
data: {}, | ||
timestamp: now, | ||
}, | ||
{ | ||
type: EventType.Load, | ||
data: {}, | ||
timestamp: now + 100, | ||
}, | ||
{ | ||
type: EventType.Meta, | ||
data: { | ||
href: 'http://localhost', | ||
width: 1200, | ||
height: 500, | ||
}, | ||
timestamp: now + 100, | ||
}, | ||
{ | ||
type: EventType.FullSnapshot, | ||
data: { | ||
node: { | ||
type: 0, | ||
childNodes: [ | ||
{ | ||
type: 2, | ||
tagName: 'html', | ||
attributes: {}, | ||
childNodes: [ | ||
{ | ||
type: 2, | ||
tagName: 'head', | ||
attributes: {}, | ||
childNodes: [ | ||
{ type: 3, textContent: '\n ', id: 4 }, | ||
{ | ||
type: 2, | ||
tagName: 'meta', | ||
attributes: { charset: 'utf-8' }, | ||
childNodes: [], | ||
id: 5, | ||
}, | ||
{ type: 3, textContent: ' \n ', id: 6 }, | ||
], | ||
id: 3, | ||
}, | ||
{ type: 3, textContent: '\n ', id: 7 }, | ||
{ | ||
type: 2, | ||
tagName: 'body', | ||
attributes: {}, | ||
childNodes: [ | ||
{ type: 3, textContent: '\n ', id: 9 }, | ||
{ | ||
type: 2, | ||
tagName: 'iframe', | ||
attributes: { id: 'target' }, | ||
childNodes: [], | ||
id: 19, | ||
}, | ||
{ type: 3, textContent: '\n\n', id: 27 }, | ||
], | ||
id: 8, | ||
}, | ||
], | ||
id: 2, | ||
}, | ||
], | ||
compatMode: 'BackCompat', | ||
id: 1, | ||
}, | ||
initialOffset: { left: 0, top: 0 }, | ||
}, | ||
timestamp: now + 200, | ||
}, | ||
// add an iframe | ||
{ | ||
type: EventType.IncrementalSnapshot, | ||
data: { | ||
source: IncrementalSource.Mutation, | ||
adds: [ | ||
{ | ||
parentId: 19, | ||
nextId: null, | ||
node: { | ||
type: 0, | ||
childNodes: [ | ||
{ | ||
type: 2, | ||
tagName: 'html', | ||
attributes: {}, | ||
childNodes: [ | ||
{ | ||
type: 2, | ||
tagName: 'head', | ||
attributes: {}, | ||
childNodes: [], | ||
rootId: 30, | ||
id: 32, | ||
}, | ||
{ | ||
type: 2, | ||
tagName: 'body', | ||
attributes: {}, | ||
childNodes: [], | ||
rootId: 30, | ||
id: 33, | ||
}, | ||
], | ||
rootId: 30, | ||
id: 31, | ||
}, | ||
], | ||
compatMode: 'BackCompat', | ||
id: 30, | ||
}, | ||
}, | ||
], | ||
removes: [], | ||
texts: [], | ||
attributes: [], | ||
isAttachIframe: true, | ||
}, | ||
timestamp: now + 500, | ||
}, | ||
// add two canvas, one is blank ans the other is filled with data | ||
{ | ||
type: EventType.IncrementalSnapshot, | ||
data: { | ||
source: 0, | ||
texts: [], | ||
attributes: [], | ||
removes: [], | ||
adds: [ | ||
{ | ||
parentId: 33, | ||
nextId: null, | ||
node: { | ||
type: 2, | ||
tagName: 'canvas', | ||
attributes: { | ||
width: '10', | ||
height: '10', | ||
id: 'blank_canvas', | ||
}, | ||
childNodes: [], | ||
rootId: 30, | ||
id: 34, | ||
}, | ||
}, | ||
{ | ||
parentId: 33, | ||
nextId: null, | ||
node: { | ||
type: 2, | ||
tagName: 'canvas', | ||
attributes: { | ||
width: '10', | ||
height: '10', | ||
rr_dataURL: | ||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAB5JREFUKFNjZCASMBKpjmEQKvzPwIDqrEHoRozgBQC/ZQELU4DiXAAAAABJRU5ErkJggg==', | ||
id: 'canvas_with_data', | ||
}, | ||
childNodes: [], | ||
rootId: 30, | ||
id: 35, | ||
}, | ||
}, | ||
], | ||
}, | ||
timestamp: now + 500, | ||
}, | ||
]; | ||
|
||
export default events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters