Skip to content

fix: leave out errors thrown by browser extensions - #46

Merged
lxsmnsyc merged 1 commit into
mainfrom
fix/ignore-extension-errors
Nov 4, 2026
Merged

lxsmnsyc merged 1 commit into
mainfrom
fix/ignore-extension-errors

Conversation

@lxsmnsyc

@lxsmnsyc lxsmnsyc commented Nov 4, 2026

Copy link
Copy Markdown
Member

What and why

A browser extension's content script runs in the page, so its errors reach the window's error and unhandledrejection events. The toolbar listed them as the app's errors and opened the dock on them. While testing #45 in Chrome, an extension added over 160 TypeError: Cannot read properties of undefined (reading 'M_ID') errors from chrome-extension://…/executors/200.js.

Changes

  • src/dev-toolbar/extension-errors.ts: isExtensionError(error, filename?) is true when the event names a file from an extension, or when the first frame of the stack is in one. It covers the chrome-extension://, moz-extension://, safari-web-extension:// and ms-browser-extension:// schemes.
  • The window error and unhandledrejection handlers skip those errors.
  • An app error that only passes through an extension frame further down the stack is still listed, because only the first frame counts.

Proof

  • The new e2e test "leaves out errors thrown by browser extensions" dispatches an extension ErrorEvent and an extension rejection. It fails on main, where the dock opens on the error, and passes here. It also checks that an app error still opens the Errors tab.
  • Unit tests cover V8 and Firefox/Safari stack formats, the event's file name, an app error with an extension frame further down, and values with no stack.
  • pnpm format:check, pnpm typecheck, pnpm build, pnpm test and pnpm test:e2e (24 tests) pass.

Risk

  • An error thrown by an extension that wraps app code shows up only if its first frame is in the app.

Review

🤖 Generated with Claude Code

An extension's content script runs in the page, so its errors reach the
window's error and unhandledrejection events and were listed as the app's.
An error is now skipped when its event names an extension file, or when the
first frame of its stack is in one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lxsmnsyc
lxsmnsyc marked this pull request as ready for review November 4, 2026 04:46
@lxsmnsyc
lxsmnsyc merged commit 212dad4 into main Nov 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant