Skip to content

Commit

Permalink
fix(browser): Exclude NW.js from browser extension check
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Jul 10, 2024
1 parent a79c566 commit 95700ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
type ExtensionProperties = {
chrome?: Runtime;
browser?: Runtime;
nw?: unknown;
};
type Runtime = {
runtime?: {
Expand All @@ -85,7 +86,11 @@ function shouldShowBrowserExtensionError(): boolean {
const isDedicatedExtensionPage =
!!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));

return !!runtimeId && !isDedicatedExtensionPage;
// Running in NW.js, which appears like a browser extension but isn't is also fine
// see: https://github.com/getsentry/sentry-javascript/issues/12668
const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';

return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;
}

/**
Expand Down

0 comments on commit 95700ba

Please sign in to comment.