fix(sentry): filter Greasemonkey/Tampermonkey x-plugin-script noise (#2209)

Two Sentry issues (7360458445, 7360459898) from Chrome WebView on
Android traced to Greasemonkey/Tampermonkey userscript errors injected
via x-plugin-script URLs. Both resolved in Sentry as noise.

- ignoreErrors: add /^"use strict" is not a function$/ (gm_idle pattern)
- beforeSend: suppress any event where all frames originate from
  /x-plugin-script/ paths (covers gm_idle and gm_start script variants)
This commit is contained in:
Elie Habib
2026-03-24 20:18:52 +04:00
committed by GitHub
parent 75bc73428c
commit 78f517036d

View File

@@ -251,6 +251,7 @@ Sentry.init({
/^(?:Error: )?uncaught exception: undefined$/,
/Can't find variable: ss_bootstrap_config/,
/undefined is not an object \(evaluating '[a-z]\.includes'\)/,
/^"use strict" is not a function$/,
],
beforeSend(event) {
const msg = event.exception?.values?.[0]?.value ?? '';
@@ -296,6 +297,8 @@ Sentry.init({
if (frames.length > 0 && frames.every(f => /^blob:/.test(f.filename ?? ''))) return null;
// Suppress errors originating from UV proxy (Ultraviolet service worker)
if (frames.some(f => /\/uv\/service\//.test(f.filename ?? '') || /uv\.handler/.test(f.filename ?? ''))) return null;
// Suppress Greasemonkey/Tampermonkey userscript errors (x-plugin-script)
if (frames.length > 0 && frames.every(f => !f.filename || /\/x-plugin-script\//.test(f.filename))) return null;
// Suppress YouTube IFrame widget API internal errors
if (frames.some(f => /www-widgetapi\.js/.test(f.filename ?? ''))) return null;
// Suppress Sentry beacon XHR transport errors (readyState on aborted XHR — not our code)