1
1
/* global cloneInto, exportFunction, mozProxies */
2
+ import { Set } from './captured-globals.js'
2
3
3
4
// Only use globalThis for testing this breaks window.wrappedJSObject code in Firefox
4
5
// eslint-disable-next-line no-global-assign
5
6
let globalObj = typeof window === 'undefined' ? globalThis : window
6
7
let Error = globalObj . Error
7
8
let messageSecret
8
- const CapturedSet = globalObj . Set
9
- // Capture prototype to prevent overloading
10
- const createSet = ( ) => hasMozProxies ? new Set ( ) : new CapturedSet ( )
11
9
12
10
// save a reference to original CustomEvent amd dispatchEvent so they can't be overriden to forge messages
13
11
export const OriginalCustomEvent = typeof CustomEvent === 'undefined' ? null : CustomEvent
@@ -160,7 +158,7 @@ export function matchHostname (hostname, exceptionDomain) {
160
158
161
159
const lineTest = / ( \( ) ? ( h t t p s ? : [ ^ ) ] + ) : [ 0 - 9 ] + : [ 0 - 9 ] + ( \) ) ? /
162
160
export function getStackTraceUrls ( stack ) {
163
- const urls = createSet ( )
161
+ const urls = new Set ( )
164
162
try {
165
163
const errorLines = stack . split ( '\n' )
166
164
// Should cater for Chrome and Firefox stacks, we only care about https? resources.
@@ -178,7 +176,7 @@ export function getStackTraceUrls (stack) {
178
176
179
177
export function getStackTraceOrigins ( stack ) {
180
178
const urls = getStackTraceUrls ( stack )
181
- const origins = createSet ( )
179
+ const origins = new Set ( )
182
180
for ( const url of urls ) {
183
181
origins . add ( url . hostname )
184
182
}
0 commit comments