From be3579f1a05e73ee85c96c2a6d034089a25f7865 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 2 Dec 2026 14:18:02 +0000 Subject: [PATCH 1/3] fix(docs): ignore a host script's undefined LIDNotifyId global in Sentry Some host app or browser evaluates a snippet in the page that calls its own LIDNotifyId global before defining it, and the ReferenceError reaches Sentry through the global onerror handler. The snippet is evaluated rather than loaded, so the only frame is :1:1, which allowUrls skips, and the event passes. Nothing in this build defines or calls LIDNotifyId, and other sites report the same error. Drop that exact message with ignoreErrors; other undefined globals are still reported. Assisted-by: AI --- apps/docs/lib/sentry-filters.ts | 2 ++ apps/docs/scripts/sentry-filters.test.mjs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/apps/docs/lib/sentry-filters.ts b/apps/docs/lib/sentry-filters.ts index 5f7ad5e7..eaab1adf 100644 --- a/apps/docs/lib/sentry-filters.ts +++ b/apps/docs/lib/sentry-filters.ts @@ -31,6 +31,8 @@ const ignoreErrors: RegExp[] = [ // Chromium's LevelDB storage (used by extensions and embedding browsers) failing to create a // file on a full disk or a locked profile. This build doesn't use IndexedDB. /^Non-Error promise rejection captured with value: IO error: .*\.ldb: Unable to create writable file\b/, + // A host app or browser evaluating its own snippet; the only frame is :1:1. + /^ReferenceError: LIDNotifyId is not defined$/, ]; export const sentryEventFilters = { allowUrls, ignoreErrors }; diff --git a/apps/docs/scripts/sentry-filters.test.mjs b/apps/docs/scripts/sentry-filters.test.mjs index f1b8c217..ed48e5d9 100644 --- a/apps/docs/scripts/sentry-filters.test.mjs +++ b/apps/docs/scripts/sentry-filters.test.mjs @@ -101,6 +101,19 @@ test("keeps other IO error rejections", () => { assert.equal(kept(exception("UnhandledRejection", message)), true); }); +test("drops a host script's undefined LIDNotifyId global", () => { + // The host evaluates the snippet, so the only frame is and allowUrls passes. + const evaluated = { filename: "", lineno: 1, colno: 1, in_app: true }; + assert.equal(kept(exception("ReferenceError", "LIDNotifyId is not defined", [evaluated])), false); +}); + +test("keeps other undefined globals from an evaluated script", () => { + const evaluated = { filename: "", lineno: 1, colno: 1, in_app: true }; + for (const value of ["LIDNotifyIdx is not defined", "docsSearch is not defined"]) { + assert.equal(kept(exception("ReferenceError", value, [evaluated])), true, value); + } +}); + test("keeps errors thrown by this build's code", () => { const frames = [ourFrame]; assert.equal( From 684bf82a56bf577ab54b2759ff06ff0428dd0b2a Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Thu, 3 Dec 2026 22:47:43 +0000 Subject: [PATCH 2/3] fix(docs): ignore Picture-in-Picture requests without a user gesture in Sentry A browser feature or extension called requestPictureInPicture on a video in the page without a user gesture, and the browser rejected it with "NotAllowedError: The request is not triggered by a user activation." The only frame is the native requestPictureInPicture, which has no URL for allowUrls to check, so the event passes. This build never calls requestPictureInPicture, and the existing NotAllowedError filter only covers refused clipboard writes. Drop that exact message; other NotAllowedError rejections are still reported. Assisted-by: AI --- apps/docs/lib/sentry-filters.ts | 2 ++ apps/docs/scripts/sentry-filters.test.mjs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/apps/docs/lib/sentry-filters.ts b/apps/docs/lib/sentry-filters.ts index eaab1adf..69eb00fa 100644 --- a/apps/docs/lib/sentry-filters.ts +++ b/apps/docs/lib/sentry-filters.ts @@ -33,6 +33,8 @@ const ignoreErrors: RegExp[] = [ /^Non-Error promise rejection captured with value: IO error: .*\.ldb: Unable to create writable file\b/, // A host app or browser evaluating its own snippet; the only frame is :1:1. /^ReferenceError: LIDNotifyId is not defined$/, + // Browser features or extensions requesting Picture-in-Picture without a user gesture. + /^NotAllowedError: The request is not triggered by a user activation\.$/, ]; export const sentryEventFilters = { allowUrls, ignoreErrors }; diff --git a/apps/docs/scripts/sentry-filters.test.mjs b/apps/docs/scripts/sentry-filters.test.mjs index ed48e5d9..c76c9db8 100644 --- a/apps/docs/scripts/sentry-filters.test.mjs +++ b/apps/docs/scripts/sentry-filters.test.mjs @@ -114,6 +114,19 @@ test("keeps other undefined globals from an evaluated script", () => { } }); +test("drops a Picture-in-Picture request made without a user gesture", () => { + // Browser features or extensions call it on the page's video; the only frame is native. + const native = { filename: "[native code]", function: "requestPictureInPicture", in_app: true }; + const value = "The request is not triggered by a user activation."; + assert.equal(kept(exception("NotAllowedError", value, [native])), false); +}); + +test("keeps other NotAllowedError rejections", () => { + const native = { filename: "[native code]", function: "requestFullscreen", in_app: true }; + const value = "Permission denied by the user."; + assert.equal(kept(exception("NotAllowedError", value, [native])), true); +}); + test("keeps errors thrown by this build's code", () => { const frames = [ourFrame]; assert.equal( From cf0e785a445c61c88f2bb16ac565274681c76a72 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Fri, 4 Dec 2026 15:53:13 +0000 Subject: [PATCH 3/3] fix(docs): ignore XBrowser-family bridge ReferenceErrors in Sentry Android in-app browsers in the XBrowser family inject autofill and CSS scripts via evaluateJavascript that call their own missing xbrowser/swbrowser globals (DOCS-ENGINE-16, DOCS-ENGINE-17). The throw site is , so allowUrls lets them through. --- apps/docs/lib/sentry-filters.ts | 3 ++ apps/docs/scripts/sentry-filters.test.mjs | 41 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/apps/docs/lib/sentry-filters.ts b/apps/docs/lib/sentry-filters.ts index 69eb00fa..028ca62a 100644 --- a/apps/docs/lib/sentry-filters.ts +++ b/apps/docs/lib/sentry-filters.ts @@ -35,6 +35,9 @@ const ignoreErrors: RegExp[] = [ /^ReferenceError: LIDNotifyId is not defined$/, // Browser features or extensions requesting Picture-in-Picture without a user gesture. /^NotAllowedError: The request is not triggered by a user activation\.$/, + // Android in-app browsers (XBrowser family) injecting autofill/CSS scripts that call their own + // missing bridge globals. + /^ReferenceError: (?:sw|x)browser is not defined$/, ]; export const sentryEventFilters = { allowUrls, ignoreErrors }; diff --git a/apps/docs/scripts/sentry-filters.test.mjs b/apps/docs/scripts/sentry-filters.test.mjs index c76c9db8..511a09b2 100644 --- a/apps/docs/scripts/sentry-filters.test.mjs +++ b/apps/docs/scripts/sentry-filters.test.mjs @@ -127,6 +127,47 @@ test("keeps other NotAllowedError rejections", () => { assert.equal(kept(exception("NotAllowedError", value, [native])), true); }); +test("drops XBrowser's injected autofill script calling its missing bridge global", () => { + // XBrowser-family browsers inject via evaluateJavascript; the throw site is , so + // allowUrls sees only Sentry's setTimeout wrapper in our chunk (DOCS-ENGINE-16). + const timerWrapper = { + filename: "app:///_next/static/chunks/3u-vo9sql_7c2.js", + function: "n", + lineno: 5, + colno: 14159, + in_app: true, + }; + const autofill = { + filename: "", + function: "execute_auto_fill", + lineno: 1, + colno: 226, + in_app: true, + }; + const event = exception("ReferenceError", "xbrowser is not defined", [timerWrapper, autofill]); + assert.equal(kept(event), false); +}); + +test("drops XBrowser's injected CSS script calling its missing bridge global", () => { + // Reaches global_handlers.onerror with only frames, so allowUrls passes + // (DOCS-ENGINE-17). + const frames = [ + { filename: "", lineno: 1, colno: 1669, in_app: true }, + { filename: "", function: "needInjectCss", lineno: 1, colno: 1410, in_app: true }, + ]; + assert.equal(kept(exception("ReferenceError", "swbrowser is not defined", frames)), false); +}); + +test("keeps other undefined *browser globals from an injected script", () => { + const frames = [ + { filename: "", lineno: 1, colno: 1669, in_app: true }, + { filename: "", function: "needInjectCss", lineno: 1, colno: 1410, in_app: true }, + ]; + for (const value of ["zzbrowser is not defined", "browser is not defined"]) { + assert.equal(kept(exception("ReferenceError", value, frames)), true, value); + } +}); + test("keeps errors thrown by this build's code", () => { const frames = [ourFrame]; assert.equal(