@@ -242,7 +242,6 @@ export default class ReplayRecorder {
242
242
stop ( fetchResources = false ) {
243
243
this . stopped = true ;
244
244
if ( ! this . rootFrame ) {
245
- this . clearFakeFocus ( ) ;
246
245
this . rootFrame = null ;
247
246
return ;
248
247
}
@@ -260,12 +259,12 @@ export default class ReplayRecorder {
260
259
} ;
261
260
262
261
this . rootFrame . stop ( ) ;
263
- this . clearFakeFocus ( ) ;
264
262
this . rootFrame = null ;
265
263
266
264
this . finalizingResult = true ;
267
265
if ( fetchResources ) {
268
266
return this . fetchImageResources ( ) . then ( ( ) => {
267
+ this . cleanupResources ( ) ;
269
268
this . result = ret ;
270
269
this . finalizingResult = false ;
271
270
} ) ;
@@ -275,19 +274,11 @@ export default class ReplayRecorder {
275
274
}
276
275
}
277
276
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 ] ] ;
291
282
}
292
283
}
293
284
}
@@ -311,11 +302,8 @@ export default class ReplayRecorder {
311
302
if ( e === this . focusedElement ) {
312
303
return ;
313
304
}
314
- this . clearFakeFocus ( ) ;
315
- e . setAttribute ( "fakeFocus" , "" ) ;
316
305
let ancestor = e ;
317
306
while ( ancestor ) {
318
- ancestor . setAttribute ( "fakeFocusWithin" , "" ) ;
319
307
const nextAncestor = ancestor . parentElement ;
320
308
if ( ! nextAncestor ) {
321
309
ancestor . ownerDocument . ReplayRecInner . flushObserver ( ) ;
@@ -508,7 +496,6 @@ export default class ReplayRecorder {
508
496
// eslint-disable-next-line @typescript-eslint/no-unused-vars
509
497
observer
510
498
) {
511
- // Observer callbacks can nest when we flush while detaching from an IFRAME
512
499
if ( this . nestedObserverCallbacks === 0 ) {
513
500
const now = Date . now ( ) ;
514
501
if ( now > this . lastActionTime ) {
@@ -520,10 +507,6 @@ export default class ReplayRecorder {
520
507
++ this . nestedObserverCallbacks ;
521
508
522
509
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.
527
510
for ( const r of records ) {
528
511
if ( r . target . ReplayRecID && r . type === "childList" ) {
529
512
for ( const child of r . removedNodes ) {
@@ -538,16 +521,12 @@ export default class ReplayRecorder {
538
521
}
539
522
}
540
523
}
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
+
545
525
const nodesWithAddedChildren = [ ] ;
546
526
for ( const r of records ) {
547
527
const target = r . target ;
548
528
const id = target . ReplayRecID ;
549
529
if ( ! id ) {
550
- // Node not in non-excluded DOM at the start of the records batch.
551
530
continue ;
552
531
}
553
532
// eslint-disable-next-line default-case
@@ -616,10 +595,6 @@ export default class ReplayRecorder {
616
595
}
617
596
-- this . nestedObserverCallbacks ;
618
597
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.
623
598
this . lastActionTime = Date . now ( ) ;
624
599
}
625
600
}
0 commit comments