Skip to content

Chromium/Helium compatibility for the --chromium build - #1

Open
icnatspell wants to merge 2 commits into
v5from
feat/chromium-helium-support
Open

Chromium/Helium compatibility for the --chromium build#1
icnatspell wants to merge 2 commits into
v5from
feat/chromium-helium-support

Conversation

@icnatspell

Copy link
Copy Markdown
Owner

Makes the existing --chromium build target produce a working extension on Chromium-based browsers (tested on Helium). A thin viable port: drops containers, per-container proxy, and native-strip tab hiding (no Chromium equivalent).

What's included

  • build/copy.js — emit a valid MV3 manifest for --chromium: sidebar_actionside_panel, background page→service worker, browser_actionaction, drop SVG icons, Chrome-valid permissions + sidePanel/contextMenus, hosts→(optional_)host_permissions.
  • build/scripts.js — inject the compat shim first in each entry, plus a banner defining the DOM globals a service worker lacks (window, inert document, getComputedStyle, localStorage, matchMedia) before any chunk runs.
  • src/injections/browser-compat.ts — feature-guarded chrome shims: menus (sanitizing wrapper), permissions filter, tabs (hide/show/onUpdated-filter/prop-strip/moveInSuccession/warmup/highlight/opener-self), windows.create prop strip, sessions tab/window value store, sidebarActionsidePanel, theme/contextualIdentities/proxy stubs.
  • build/sw-loadtest.js — Node harness that loads the built SW with a Chrome-faithful chrome mock to catch load-time crashes without a browser.

Status

Functional in Helium: tab tree renders, tabs create/switch/move, new windows work. Firefox build path is untouched.

Known limitations (by design)

  • No containers, per-container proxy, or native-strip tab hiding.
  • Tab-tree structure doesn't fully restore across a cold browser restart (Chrome reassigns window/tab ids; no persistent session store).

🤖 Generated with Claude Code

icnatspell and others added 2 commits July 16, 2026 15:16
Make the existing --chromium build target produce a working extension on
Chromium-based browsers (tested on Helium). Firefox-only; a "thin viable
port" that drops containers, per-container proxy, and native-strip tab
hiding (no Chromium equivalent).

build/copy.js: emit a valid MV3 manifest for --chromium — manifest_version 3,
sidebar_action -> side_panel, background page -> service worker (module),
browser_action -> action, drop SVG icons, filter permissions to Chrome-valid
+ sidePanel/contextMenus, move hosts to (optional_)host_permissions, strip
command suggested keys.

build/scripts.js: inject a compat shim as the first import of each entry
(onResolve sideEffects:true + onLoad prepend, since inject/bare-import get
tree-shaken under "sideEffects": false), and a banner defining the DOM globals
a service worker lacks (window, an inert document, getComputedStyle,
localStorage, matchMedia) before any chunk body runs.

src/injections/browser-compat.ts: patch `chrome` (the build renames browser ->
chrome) with feature-guarded shims — menus (sanitizing wrapper over
contextMenus: strip icons/viewTypes/command, route onclick -> onClicked, map
types/contexts), permissions filter (drop Firefox-only names), tabs
(hide/show no-op, onUpdated filter strip, create/query/update prop strip,
moveInSuccession/warmup no-op, highlight populate strip, opener-self guard),
windows.create prop strip, sessions tab/window value store (window values in
storage.local to survive SW restart/reload), sidebarAction bridge +
sidePanel.setPanelBehavior, and stubs for theme/contextualIdentities/proxy.

build/sw-loadtest.js: Node harness that loads the built service worker with a
Chrome-faithful `chrome` mock to catch SW load-time crashes without loading
the extension in a browser each iteration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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