@@ -242,7 +242,6 @@ export default class ReplayRecorder {
242242 stop ( fetchResources = false ) {
243243 this . stopped = true ;
244244 if ( ! this . rootFrame ) {
245- this . clearFakeFocus ( ) ;
246245 this . rootFrame = null ;
247246 return ;
248247 }
@@ -260,12 +259,12 @@ export default class ReplayRecorder {
260259 } ;
261260
262261 this . rootFrame . stop ( ) ;
263- this . clearFakeFocus ( ) ;
264262 this . rootFrame = null ;
265263
266264 this . finalizingResult = true ;
267265 if ( fetchResources ) {
268266 return this . fetchImageResources ( ) . then ( ( ) => {
267+ this . cleanupResources ( ) ;
269268 this . result = ret ;
270269 this . finalizingResult = false ;
271270 } ) ;
@@ -275,19 +274,11 @@ export default class ReplayRecorder {
275274 }
276275 }
277276
278- clearFakeFocus ( ) {
279- if ( ! this . focusedElement ) {
280- return ;
281- }
282- this . focusedElement . removeAttribute ( "fakeFocus" ) ;
283- let ancestor = this . focusedElement ;
284- while ( ancestor ) {
285- ancestor . removeAttribute ( "fakeFocusWithin" ) ;
286- const nextAncestor = ancestor . parentElement ;
287- if ( ! nextAncestor ) {
288- ancestor = ancestor . ownerDocument . ReplayRecInner . iframeElement ;
289- } else {
290- ancestor = nextAncestor ;
277+ cleanupResources ( ) {
278+ let resourceKeys = Object . keys ( this . resourcesToResolve ) ;
279+ for ( var i = 0 ; i < resourceKeys . length ; i ++ ) {
280+ if ( this . resourcesToResolve [ resourceKeys [ i ] ] === "--" ) {
281+ delete this . resourcesToResolve [ resourceKeys [ i ] ] ;
291282 }
292283 }
293284 }
@@ -311,11 +302,8 @@ export default class ReplayRecorder {
311302 if ( e === this . focusedElement ) {
312303 return ;
313304 }
314- this . clearFakeFocus ( ) ;
315- e . setAttribute ( "fakeFocus" , "" ) ;
316305 let ancestor = e ;
317306 while ( ancestor ) {
318- ancestor . setAttribute ( "fakeFocusWithin" , "" ) ;
319307 const nextAncestor = ancestor . parentElement ;
320308 if ( ! nextAncestor ) {
321309 ancestor . ownerDocument . ReplayRecInner . flushObserver ( ) ;
@@ -508,7 +496,6 @@ export default class ReplayRecorder {
508496 // eslint-disable-next-line @typescript-eslint/no-unused-vars
509497 observer
510498 ) {
511- // Observer callbacks can nest when we flush while detaching from an IFRAME
512499 if ( this . nestedObserverCallbacks === 0 ) {
513500 const now = Date . now ( ) ;
514501 if ( now > this . lastActionTime ) {
@@ -520,10 +507,6 @@ export default class ReplayRecorder {
520507 ++ this . nestedObserverCallbacks ;
521508
522509 try {
523- // A node has a ReplayRecID if and only if it was in the non-excluded DOM at the start of the records
524- // batch.
525- // If a node has a ReplayRecID and is not our root, then its parent must also
526- // have a ReplayRecID.
527510 for ( const r of records ) {
528511 if ( r . target . ReplayRecID && r . type === "childList" ) {
529512 for ( const child of r . removedNodes ) {
@@ -538,16 +521,12 @@ export default class ReplayRecorder {
538521 }
539522 }
540523 }
541- // A node has a ReplayRecID if and only if it was in the non-excluded DOM at the start of the records
542- // batch, and was not ever removed during this records batch.
543- // If a node has a ReplayRecID and is not our root, then its parent must also
544- // have a ReplayRecID.
524+
545525 const nodesWithAddedChildren = [ ] ;
546526 for ( const r of records ) {
547527 const target = r . target ;
548528 const id = target . ReplayRecID ;
549529 if ( ! id ) {
550- // Node not in non-excluded DOM at the start of the records batch.
551530 continue ;
552531 }
553532 // eslint-disable-next-line default-case
@@ -616,10 +595,6 @@ export default class ReplayRecorder {
616595 }
617596 -- this . nestedObserverCallbacks ;
618597 if ( this . nestedObserverCallbacks === 0 ) {
619- // Ignore time spent doing ReplayRec recording.
620- // Note that during this processing, the browser might be downloading stuff or
621- // doing other off-main-thread work, so this could give an optimistic picture
622- // of actual performance. Doesn't really matter.
623598 this . lastActionTime = Date . now ( ) ;
624599 }
625600 }
0 commit comments