diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index effe7538178b..5d09cde3cbbe 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -55,7 +55,9 @@ const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; -const chrome: StackLineParserFn = line => { +// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments +// See: https://github.com/getsentry/sentry-javascript/issues/6880 +const chromeStackParserFn: StackLineParserFn = line => { const parts = chromeRegex.exec(line); if (parts) { @@ -82,7 +84,7 @@ const chrome: StackLineParserFn = line => { return; }; -export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chrome]; +export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn]; // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js diff --git a/packages/utils/src/vendor/supportsHistory.ts b/packages/utils/src/vendor/supportsHistory.ts index 8dc16b43f1cc..35af156eb96f 100644 --- a/packages/utils/src/vendor/supportsHistory.ts +++ b/packages/utils/src/vendor/supportsHistory.ts @@ -38,8 +38,8 @@ export function supportsHistory(): boolean { // borrowed from: https://github.com/angular/angular.js/pull/13945/files /* eslint-disable @typescript-eslint/no-unsafe-member-access */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - const chrome = (WINDOW as any).chrome; - const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; + const chromeVar = (WINDOW as any).chrome; + const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime; /* eslint-enable @typescript-eslint/no-unsafe-member-access */ const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState;