1const sentryOptions = { 2 dsn: null, 3 environment: 'production', 4 release: null, 5 whitelistUrls: [], 6 ignoreErrors: [], 7 ignoreUrls: [], 8 sampleRate: 1.0, 9}; 10 11function canInitializeSentry() { 12 if (typeof Promise !== 'function') { 13 return false; 14 } 15 16 // Ignore IE 11, but gather Edge errors 17 if (!window.ActiveXObject && 'ActiveXObject' in window) { 18 return false; 19 } 20 21 // Ignore when adblock is active 22 if (!document.getElementById('laQJiOXGysHz')) { 23 return false; 24 } 25 26 return true; 27} 28 29function injectJavascriptFile(filePath, integrity) { 30 return new Promise((resolve, reject) => { 31 const script = document.createElement('script'); 32 script.type = 'text/javascript'; 33 34 if (integrity) { 35 script.integrity = integrity; 36 script.crossOrigin = 'anonymous'; 37 } 38 39 script.onload = () => resolve() 40 script.onerror = () => reject(new Error(`Could not load script: ${filePath}`)) 41 script.src = filePath; 42 43 document.head.appendChild(script); 44 }); 45} 46 47function injectRequiredFiles() { 48 return Promise.allSettled([ 49 injectJavascriptFile(window.sentryRuntimePath + '/adex.js'), 50 injectJavascriptFile(window.sentryRuntimePath + '/global-sentry-config.js'), 51 ]); 52} 53 54function injectSentrySdkForOptions(options) { 55 const promises = [ 56 injectJavascriptFile( 57 `https://browser.sentry-cdn.com/${window.sentrySdkVersion}/bundle.tracing.min.js`, 58 window.sentrySdkIntegrity 59 ) 60 ]; 61 62 return Promise.allSettled(promises); 63} 64 65function isInList(list, string) { 66 let isInListCheck = false; 67 for (const listKey in list) { 68 const listItem = list[listKey].toString(); 69 70 if (listItem.charAt(0) === '/') { 71 isInListCheck = new RegExp( 72 listItem.match(/\/(.+)\/.*/)[1], 73 listItem.match(/\/.+\/(.*)/)[1] || 'i' 74 ).test(string); 75 } else { 76 isInListCheck = string.toLowerCase().includes(listItem.toLowerCase()) 77 } 78 79 if (isInListCheck) { 80 return true; 81 } 82 } 83 84 return false; 85} 86 87function initializeSentryWithOptionsInternal(options) { 88 const mergedOptions = Object.assign(sentryOptions, options); 89 injectSentrySdkForOptions(mergedOptions) 90 .then(() => { 91 if (!mergedOptions.dsn || mergedOptions.environment === 'dev') { 92 throw new Error('Sentry logger disabled. DSN not configured or in dev mode'); 93 } 94 95 const errorsToIgnore = mergedOptions.ignoreErrors.concat(window.sentryGlobalSettings.ignoreErrors); 96 const urlsToWhitelist = mergedOptions.whitelistUrls.concat(window.sentryGlobalSettings.whitelistUrls); 97 98 window.Sentry.init({ 99 dsn: mergedOptions.dsn, 100 release: mergedOptions.release || mergedOptions.releaseHash, 101 environment: mergedOptions.environment, 102 sampleRate: mergedOptions.sampleRate, 103 allowUrls: urlsToWhitelist, 104 ignoreErrors: errorsToIgnore, 105 integrations: [], 106 beforeSend: (event, hint) => { 107 if (typeof hint.originalException === 'string') { 108 if ( 109 isInList(errorsToIgnore, hint.originalException) 110 ) { 111 return null; 112 } 113 114 return event; 115 } 116 117 if (!isInList(urlsToWhitelist, hint.originalException?.sourceURL)) { 118 return null; 119 } 120 121 if ( 122 isInList(errorsToIgnore, hint.originalException.message) 123 || isInList(errorsToIgnore, hint.originalException.name) 124 ) { 125 return null; 126 } 127 128 return event; 129 } 130 }); 131 }) 132 .catch((error) => { 133 console.info(`[SENTRY LOGGER] Sentry logging disabled because it could not load the Sentry SDK. Reason: ${error.message}`); 134 }); 135} 136 137window.initializeSentryWithOptions = function (options) { 138 injectRequiredFiles() 139 .then(() => { 140 if (!canInitializeSentry()) { 141 console.info('[SENTRY LOGGER] Sentry logging disabled because it did not qualify the minimal requirements'); 142 return; 143 } 144 145 initializeSentryWithOptionsInternal(options); 146 console.info('[SENTRY LOGGER] Sentry logger initialized'); 147 }) 148 .catch((error) => { 149 console.info(`[SENTRY LOGGER] Sentry logging disabled because of an error: ${error.message}`); 150 }); 151};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.