Skip to content

Commit

Permalink
feat(browser): Allow sentry in safari extension background page (#13209)
Browse files Browse the repository at this point in the history
Add `safari-web-extension:` to the list of allowed extension protocols.
This chage should allow sentry/browser to work in safari browser
extensions.
  • Loading branch information
undead-voron authored Aug 13, 2024
1 parent 6aeaf42 commit e03df37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function shouldShowBrowserExtensionError(): boolean {
const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id;
const href = (WINDOW.location && WINDOW.location.href) || '';

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

// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
const isDedicatedExtensionPage =
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('init', () => {
consoleErrorSpy.mockRestore();
});

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

0 comments on commit e03df37

Please sign in to comment.