refactor(chrome-ext): keep popup-side fixes, drop runtime-bridge ext patches
Sets up the foundation for the native chrome.runtime.sendMessage
cross-origin polyfill in the next commit. Two threads of work landed
together:
1. Late-night debugging of Proton Pass auth-fork added diagnostic
logging + several patch-the-extension hacks (RUNTIME_BRIDGE_*,
peek-runtime-polyfill.js content_script, orchestrator.js append).
The extension-internals approach mechanically worked but interacted
poorly with Electron's webview sandbox bootstrap (SIGSEGV on /reauth)
and required modifying every extension we wanted to support. All of
that hack-layer is reverted here.
2. New fixes that are general-purpose and worth keeping:
- chrome-extensions.ts: setWindowOpenHandler on extension popup
BrowserWindows that routes window.open() through invokeWindowOpen,
so Proton's "open auth URL externally" path opens a Peek page tile
instead of failing silently.
- chrome-extensions.ts: console-message forwarding from extension
popups to main stderr in DEBUG mode (visibility for popup-side JS
errors that would otherwise be swallowed by Sentry handlers).
- entry.ts: webview-guest console-message forwarding + DevTools
auto-open for proton.me URLs in DEBUG mode (general extension
diagnostics).
- patch-chrome-extensions.js peek-permissions.js (popup-side):
chrome.tabs.create polyfill + window.error / unhandledrejection
trap. Electron's native chrome.tabs in extension-popup
BrowserWindow contexts exposes query() but not create(); without
the polyfill, Proton's login click throws "rR.tabs.create is not
a function" and the popup self-closes.
- patch-chrome-extensions.js PERMISSIONS_SHIM (BG-side):
globalThis.chrome accessor-lock fix — use getter/no-op-setter
instead of writable:false so Proton's bundled "extension API
isolation" forEach (which assigns globalThis.chrome = proxy)
doesn't throw mid-loop and abort BG init.
Net effect on chrome-extensions/proton-pass/: orchestrator.js stays
un-modified, manifest.json has no Peek content_script entries, no
peek-runtime-polyfill.js file ships. The patcher is now scoped to
background.js + popup HTML files (peek-permissions.js script tag).
The cross-origin chrome.runtime.sendMessage → onMessageExternal
pathway lands as a proper chrome-api-polyfill module in the next
commit.