Skip to content

Commit

Permalink
Fix: Post message can break cross origin iframe recording (rrweb-io#1053
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Juice10 authored Nov 16, 2022
1 parent 59a1e4f commit a220835
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/rrweb/src/plugins/canvas-webrtc/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,12 @@ export class RRWebPluginCanvasWebRTCRecord {
}

private isCrossOriginIframeMessageEventContent(
event: MessageEvent,
event: MessageEvent<unknown>,
): event is MessageEvent<CrossOriginIframeMessageEventContent> {
return Boolean(
'type' in event.data &&
event.data &&
typeof event.data === 'object' &&
'type' in event.data &&
'data' in event.data &&
(event.data as CrossOriginIframeMessageEventContent).type ===
'rrweb-canvas-webrtc' &&
Expand Down

0 comments on commit a220835

Please sign in to comment.