Skip to content

Migrate Chrome extension to Manifest V3#99

Open
arkanovicz wants to merge 1 commit intoosnr:masterfrom
arkanovicz:fix-manifest-version
Open

Migrate Chrome extension to Manifest V3#99
arkanovicz wants to merge 1 commit intoosnr:masterfrom
arkanovicz:fix-manifest-version

Conversation

@arkanovicz
Copy link
Copy Markdown

Chrome 139+ no longer supports Manifest V2 extensions. This commit updates TabFS to use Manifest V3 for Chrome compatibility.

Changes:

  • manifest.json: Update to manifest_version 3

    • Move <all_urls> from permissions to host_permissions
    • Add "scripting" permission for chrome.scripting API
    • Replace background scripts with service_worker
    • Remove deprecated content_security_policy format
  • background.js: Adapt for MV3 service worker environment

    • Replace browser.tabs.executeScript with chrome.scripting.executeScript
    • Add executeScript() helper that uses eval in MAIN world context
    • Replace window.Routes with globalThis.Routes for service worker
    • Replace window.fetch with fetch (service workers have fetch natively)
    • Add browser shim (const browser = globalThis.browser || chrome)

Notes:

  • Native messaging keeps service worker alive (Chrome 100+)
  • Firefox users can continue using MV2 (Firefox doesn't deprecate MV2)
  • The eval-based script execution maintains compatibility with TabFS's dynamic code execution features (evals/, watches/, inputs/)

Note: this must be carefully reviewed, most changes were performed by a coding agent.

Chrome 139+ no longer supports Manifest V2 extensions. This commit
updates TabFS to use Manifest V3 for Chrome compatibility.

Changes:
- manifest.json: Update to manifest_version 3
  - Move <all_urls> from permissions to host_permissions
  - Add "scripting" permission for chrome.scripting API
  - Replace background scripts with service_worker
  - Remove deprecated content_security_policy format

- background.js: Adapt for MV3 service worker environment
  - Replace browser.tabs.executeScript with chrome.scripting.executeScript
  - Add executeScript() helper that uses eval in MAIN world context
  - Replace window.Routes with globalThis.Routes for service worker
  - Replace window.fetch with fetch (service workers have fetch natively)
  - Add browser shim (const browser = globalThis.browser || chrome)

Notes:
- Native messaging keeps service worker alive (Chrome 100+)
- Firefox users can continue using MV2 (Firefox doesn't deprecate MV2)
- The eval-based script execution maintains compatibility with TabFS's
  dynamic code execution features (evals/, watches/, inputs/)
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