sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

fix(browser): Improve browser extension error message check

Open Lms24 opened this issue 1 year ago • 1 comments

This PR makes our check for when we abort and log an error due to Sentry.init being used in a browser extension a bit more fine-gained. In particular, we now do not abort the SDK initialization if we detect that the SDK is running in a browser-extension dedicated window (e.g. a URL starting with chrome-extension://).

This was raised in https://github.com/getsentry/sentry-javascript/issues/12025. h/t @Thomas101 for providing the initial idea how to check for the dedicated pages. I expanded on the check a bit to add other browsers. This list is not complete but probably good enough for start.

Also rewrote the function a bit to hopefully save a few bytes 🤞

Lms24 avatar May 21 '24 15:05 Lms24

size-limit report 📦

Path Size
@sentry/browser 21.76 KB (+0.18% 🔺)
@sentry/browser (incl. Tracing) 32.92 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing, Replay) 68.27 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.66 KB (+0.08% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 72.31 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.34 KB (+0.06% 🔺)
@sentry/browser (incl. Feedback) 37.76 KB (+0.14% 🔺)
@sentry/browser (incl. sendFeedback) 26.33 KB (+0.16% 🔺)
@sentry/browser (incl. FeedbackAsync) 30.74 KB (+0.16% 🔺)
@sentry/react 24.45 KB (+0.18% 🔺)
@sentry/react (incl. Tracing) 35.9 KB (+0.1% 🔺)
@sentry/vue 25.71 KB (+0.21% 🔺)
@sentry/vue (incl. Tracing) 34.73 KB (+0.11% 🔺)
@sentry/svelte 21.89 KB (+0.18% 🔺)
CDN Bundle 24.31 KB (+0.18% 🔺)
CDN Bundle (incl. Tracing) 34.36 KB (+0.14% 🔺)
CDN Bundle (incl. Tracing, Replay) 68.05 KB (+0.07% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) 73.05 KB (+0.07% 🔺)
CDN Bundle - uncompressed 71.43 KB (+0.14% 🔺)
CDN Bundle (incl. Tracing) - uncompressed 101.84 KB (+0.1% 🔺)
CDN Bundle (incl. Tracing, Replay) - uncompressed 211.46 KB (+0.05% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 223.81 KB (+0.05% 🔺)
@sentry/nextjs (client) 35.13 KB (+0.12% 🔺)
@sentry/sveltekit (client) 33.49 KB (+0.1% 🔺)
@sentry/node 128.41 KB (+0.13% 🔺)
@sentry/aws-serverless 114.42 KB (+0.13% 🔺)

github-actions[bot] avatar May 22 '24 08:05 github-actions[bot]