File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
packages/rrweb/src/record Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " rrweb " : patch
3
+ ---
4
+
5
+ fix potential mem leaks by deleting unloaded iframes from crossOriginIframeMap
Original file line number Diff line number Diff line change @@ -77,12 +77,16 @@ export class IframeManager {
77
77
} ) ;
78
78
79
79
// Receive messages (events) coming from cross-origin iframes that are nested in this same-origin iframe.
80
- if ( this . recordCrossOriginIframes )
80
+ if ( this . recordCrossOriginIframes ) {
81
81
iframeEl . contentWindow ?. addEventListener (
82
82
'message' ,
83
83
this . handleMessage . bind ( this ) ,
84
84
) ;
85
85
86
+ iframeEl . contentWindow ?. addEventListener ( 'unload' , ( ) => {
87
+ this . crossOriginIframeMap . delete ( iframeEl . contentWindow ! ) ;
88
+ } ) ;
89
+ }
86
90
this . loadListener ?.( iframeEl ) ;
87
91
88
92
if (
You can’t perform that action at this time.
0 commit comments