Skip to content
Merged
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions packages/replay/src/iframe-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,28 @@ describe('iframe guard: a blocked iframe is a placeholder, whatever the recorder
expect(guard(custom)).toBe(custom);
});

it('passes the rrweb 2.2.0 annotation (8) and asset (7) events through unchanged, whatever ids they mention', () => {
const { guard, onViolation } = make();
const inner = el('p', {});
const frame = el('iframe', { class: 'rr-block' }, [doc([inner])]);
guard(snapshot(doc([el('body', {}, [frame])])));
expect(onViolation).toHaveBeenCalledTimes(1); // the snapshot's stripped content (the once-per-session report)
const shapes = [
{ annotationData: { type: 'caption', text: 'marker' } },
{ url: 'asset://x', payload: 'p' },
// not rrweb's real shapes: id fields and an incremental `source` that would route them through the
// tainted-id / mutation checks if the guard stopped treating types 7 and 8 as node-less
{ id: inner.id, source: SOURCE.Mutation },
{ id: inner.id, source: SOURCE.Scroll },
];
for (const type of [8, 7]) {
for (const data of shapes) {
const e = { type, timestamp: 3, data } as unknown as eventWithTime;
expect(guard(e)).toBe(e); // the report latch is spent, so identity is the assertion that matters
}
}
});

it('scans nodes added while recording: an added blocked iframe is stripped, its later attach dropped', () => {
const { guard, onViolation } = make();
guard(snapshot(doc([el('body', {})])));
Expand Down
Loading