Skip to content

Commit 95700ba

Browse files
committed
fix(browser): Exclude NW.js from browser extension check
1 parent a79c566 commit 95700ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/browser/src/sdk.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {
6363
type ExtensionProperties = {
6464
chrome?: Runtime;
6565
browser?: Runtime;
66+
nw?: unknown;
6667
};
6768
type Runtime = {
6869
runtime?: {
@@ -85,7 +86,11 @@ function shouldShowBrowserExtensionError(): boolean {
8586
const isDedicatedExtensionPage =
8687
!!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));
8788

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

9196
/**

0 commit comments

Comments
 (0)