Skip to content

Commit e03df37

Browse files
authored
feat(browser): Allow sentry in safari extension background page (#13209)
Add `safari-web-extension:` to the list of allowed extension protocols. This chage should allow sentry/browser to work in safari browser extensions.
1 parent 6aeaf42 commit e03df37

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/browser/src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function shouldShowBrowserExtensionError(): boolean {
9393
const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id;
9494
const href = (WINDOW.location && WINDOW.location.href) || '';
9595

96-
const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:'];
96+
const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];
9797

9898
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
9999
const isDedicatedExtensionPage =

packages/browser/test/sdk.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe('init', () => {
199199
consoleErrorSpy.mockRestore();
200200
});
201201

202-
it.each(['chrome-extension', 'moz-extension', 'ms-browser-extension'])(
202+
it.each(['chrome-extension', 'moz-extension', 'ms-browser-extension', 'safari-web-extension'])(
203203
"doesn't log a browser extension error if executed inside an extension running in a dedicated page (%s)",
204204
extensionProtocol => {
205205
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});

0 commit comments

Comments
 (0)