Skip to content

Firefox MV3 compatibility (background scripts + gecko settings) - #98

Open
lhero-org wants to merge 4 commits into
WordPress:mainfrom
lhero-org:lh-ghp/firefox-mv3-compatibility-declare-background-scripts-alongside-004c97
Open

Firefox MV3 compatibility (background scripts + gecko settings)#98
lhero-org wants to merge 4 commits into
WordPress:mainfrom
lhero-org:lh-ghp/firefox-mv3-compatibility-declare-background-scripts-alongside-004c97

Conversation

@lhero-org

@lhero-org lhero-org commented Aug 15, 2026

Copy link
Copy Markdown

Addresses the Firefox Add-ons (AMO) item on the roadmap — the next post-1.0 target, flagged there as needing "a manifest v2/v3 compatibility audit; Firefox's WebExtension surface diverges from Chromium in a few places."

Changes:

  • manifest.json: adds background.scripts alongside service_worker — Chrome uses service_worker, Firefox (121+) uses scripts as an event page. Both keys can coexist safely per current Firefox/Chrome behavior.
  • manifest.json: adds browser_specific_settings.gecko for AMO signing. Note: the id value (browser-extension@wordpress.org) is a placeholder — this needs to be a real, permanent identifier the WordPress Foundation controls, since AMO uses it to track the extension across updates. Please confirm the actual value before merge.
  • background.js: guards the importScripts() calls, since importScripts is a WorkerGlobalScope method unavailable in Firefox's event-page context (a plain script, not a worker). Firefox loads the two dependency files via manifest.json's scripts array instead, ahead of background.js.
  • Safari resource mirror (safari/.../Resources/) synced to match, via the existing scripts/sync-safari.sh.

Tested:

  • Full test suite passes (test/npm test), npm run build clean.
  • Manually verified in Firefox desktop on Linux, loaded as a temporary add-on (about:debugging): WordPress detection, popup, admin bar shortcuts (edit/view/profile/logout), Mobile Preview, cache-busting, Clear Site Data (Keep Login), and Highlight Blocks all confirmed working correctly.

Known gap, not addressed here: Firefox for Android has no windows API, so Mobile Preview (which calls chrome.windows.create) will silently no-op there rather than open a preview window. Scoping that out of this PR since it's Android-specific and this PR is focused on desktop Firefox compatibility — happy to follow up separately if that's wanted.

…ce_worker (Chrome uses service_worker, Firefox 121+
…ce_worker (Chrome uses service_worker, Firefox 121+
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