3
3
MaskInputOptions ,
4
4
SlimDOMOptions ,
5
5
createMirror ,
6
+ type Mirror ,
6
7
} from '@sentry-internal/rrweb-snapshot' ;
7
8
import { initObservers , mutationBuffers } from './observer' ;
8
9
import {
@@ -52,6 +53,8 @@ import {
52
53
registerErrorHandler ,
53
54
unregisterErrorHandler ,
54
55
} from './error-handler' ;
56
+ import './clean-array-from' ;
57
+
55
58
export type { CanvasManagerConstructorOptions } from './observers/canvas/canvas-manager' ;
56
59
57
60
declare global {
@@ -67,21 +70,6 @@ let _wrappedEmit:
67
70
| ( ( e : eventWithTime , isCheckout ?: boolean ) => void ) ;
68
71
let _takeFullSnapshot : undefined | ( ( isCheckout ?: boolean ) => void ) ;
69
72
70
- // Multiple tools (i.e. MooTools, Prototype.js) override Array.from and drop support for the 2nd parameter
71
- // Try to pull a clean implementation from a newly created iframe
72
- try {
73
- if ( Array . from ( [ 1 ] , ( x ) => x * 2 ) [ 0 ] !== 2 ) {
74
- const cleanFrame = document . createElement ( 'iframe' ) ;
75
- document . body . appendChild ( cleanFrame ) ;
76
- // eslint-disable-next-line @typescript-eslint/unbound-method -- Array.from is static and doesn't rely on binding
77
- Array . from = cleanFrame . contentWindow ?. Array . from || Array . from ;
78
- document . body . removeChild ( cleanFrame ) ;
79
- }
80
- } catch ( err ) {
81
- console . debug ( 'Unable to override Array.from' , err ) ;
82
- }
83
-
84
- const mirror = createMirror ( ) ;
85
73
function record < T = eventWithTime > (
86
74
options : recordOptions < T > = { } ,
87
75
) : listenerHandler | undefined {
@@ -129,6 +117,7 @@ function record<T = eventWithTime>(
129
117
} = options ;
130
118
131
119
registerErrorHandler ( errorHandler ) ;
120
+ const mirror = createMirror ( ) ;
132
121
133
122
const inEmittingFrame = recordCrossOriginIframes
134
123
? window . parent === window
@@ -721,9 +710,13 @@ export function takeFullSnapshot(isCheckout?: boolean) {
721
710
// record.freezePage is removed because Sentry Session Replay does not use it
722
711
723
712
// For backwards compatibility - we can eventually remove this when we migrated to using the exported `mirror` & `takeFullSnapshot`
724
- record . mirror = mirror ;
713
+ // record.mirror = mirror;
725
714
record . takeFullSnapshot = takeFullSnapshot ;
726
715
716
+ namespace record {
717
+ export var mirror : Mirror ;
718
+ }
719
+
727
720
export default record ;
728
721
729
722
function _getCanvasManager (
0 commit comments