Skip to content

extension: support Firefox packaging and runtime #778

Description

@wolf31o2

ui/extension/public/manifest.json currently produces a Chrome-only Manifest V3 artifact. It declares only background.service_worker, which Firefox does not support, and the extension documentation and CI only load and exercise Chrome. In Firefox the background relay cannot start, so pairing and CIP-30 calls cannot work.

Required implementation

Build and manifests

  • Keep one manifest source of truth. Either generate browser-specific manifests during the build or use one Manifest V3 manifest with both background.service_worker and background.scripts; do not maintain divergent hand-edited manifests.
  • If one manifest contains both background keys, set minimum_chrome_version to at least 121. Set browser_specific_settings.gecko.strict_min_version to at least 128 because the required content_scripts[].world support starts there.
  • Add a stable browser_specific_settings.gecko.id for Manifest V3 signing. Add browser_specific_settings.gecko.data_collection_permissions after tracing the data sent from dApps to the local Bursa service; do not default it to none without verifying the AMO classification.
  • Keep background.js valid as both a Chromium service worker and a Firefox non-persistent event page. Do not depend on service-worker-only globals or in-memory state surviving background suspension.
  • Produce deterministic, clearly named Chrome and Firefox packages with manifest.json at the archive root. The Firefox package must be ready for AMO signing; credentials and publication may remain separate release work.
  • Add a pinned web-ext development dependency and repository scripts for Firefox linting and packaging. CI must run web-ext lint --warnings-as-errors against the packaged Firefox tree.

Provider and extension execution contexts

  • Generalize extension: inject provider in the page main world #762 to both browsers: load injected.js directly in world: "MAIN" at document_start, and keep content.js in the default isolated world for extension API access and page/background message relay.
  • Do not move the relay into MAIN; scripts there cannot use extension-only APIs and the page can inspect or modify their state.
  • Remove the DOM-appended <script> and the injected.js web-accessible-resource entry once direct main-world registration is used. The provider must still load on a page with restrictive script-src CSP.
  • Preserve origin checks, per-origin authorization, and token isolation. Pairing tokens and extension storage must never enter the page main world.
  • Resolve extension: implement the CIP-30 provider contract #761 before declaring the Firefox provider usable by dApps; the same CIP-30 contract tests must run against both browser builds.
  • Verify the current chrome.runtime and chrome.storage calls in Firefox. Introduce a small API wrapper or webextension-polyfill only where real-browser tests show that the existing callback/Promise usage is not portable.

Validation

Add automated tests using real Chrome/Chromium and Firefox instances. Do not use a DOM-only test as the Firefox acceptance test. Both browser runs must cover:

  • unpacked/temporary installation without manifest or background-context errors;
  • provider availability at document_start on a restrictive-CSP page;
  • popup pairing with a local Bursa test backend and persistence of the token in extension storage;
  • enable() approval followed by a successful CIP-30 request such as getNetworkId();
  • deterministic unpaired, rejected-approval, and unavailable-background errors;
  • background suspension/restart followed by a successful request using persisted state;
  • no authorization reuse across different page origins.

Run the existing lint, type-check, unit-test, and build checks for both manifest outputs. Add a CI browser matrix and upload separate Chrome and Firefox artifacts. Update ui/extension/e2e/README.md with Chrome unpacked-loading and Firefox about:debugging instructions, the supported minimum versions, and the commands used to lint and package each artifact.

Acceptance criteria

  • The packaged extension loads in the declared minimum Firefox version and current Firefox Release without manifest, injection, or background errors.
  • A dApp can pair, enable the wallet, and complete a CIP-30 round trip through a running Bursa backend in Firefox.
  • Restrictive page CSP does not prevent window.cardano.bursa from being registered.
  • Chrome continues to pass the same provider, pairing, and authorization tests.
  • CI publishes distinct Chrome and Firefox packages, and the Firefox package passes web-ext lint --warnings-as-errors.

References:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions