Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web Extension] Add content script world property to manifest schema validation #9510

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

carterworks
Copy link
Contributor

@carterworks carterworks commented Jan 29, 2024

↪️ Pull Request

Resolves #9482.

Adds the isolation context property world to the @parcel/transformer-webextension schema validation code.

It's Chrome-only currently, but I think that Firefox support is currently on the way.

💻 Examples

This following manifest.json would throw an error while validating the schema because of content_scripts[0].world

{
  "name": "MV3 Migration - content script example",
  "description": "Source: https://github.com/GoogleChrome/chrome-extensions-samples",
  "version": "0.1",
  "manifest_version": 3,
  "background": {
    "service_worker": "background.js"
  },
  "permissions": [
    "scripting",
    "activeTab"
  ],
  "content_scripts": [{
    "matches": ["https://*.google.com/*"],
    "js": ["other-content-script.js"],
    "world": "ISOLATED"
  }],
  "action": {
    "default_popup": "popup.html"
  },
  "side_panel": {
    "default_path": "side-panel.html"
  }
}

🚨 Test instructions

cd packages/core/integration-tests && yarn test test/webextension.js

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@carterworks
Copy link
Contributor Author

carterworks commented Jan 29, 2024

@101arrowz or @mischnic Please review this.
This does block me on a work project, but I'll patch it locally until this PR is merged and released.

@101arrowz 101arrowz merged commit 86922d7 into parcel-bundler:v2 Jan 30, 2024
13 of 16 checks passed
@carterworks carterworks deleted the webext-isolated-world branch January 30, 2024 15:03
lettertwo added a commit that referenced this pull request Jan 30, 2024
* upstream/v2: (22 commits)
  Add source map support to the inline-require optimizer (#9511)
  [Web Extension] Add content script world property to manifest schema validation (#9510)
  feat: add getCurrentPackageManager (#9505)
  Default Bundler Contributor Notes (#9488)
  rename parentAsset to root for msb config and remove unstable (#9486)
  Macro errors -> v2 (#9501)
  Statically evaluate constants referenced by macros (#9487)
  Multiple css bundles in Entry bundle groups issue (#9023)
  Fix macro issues (#9485)
  Bump follow-redirects from 1.14.7 to 1.15.4 (#9475)
  Revert more CI changes to centos job (#9472)
  Use lightningcss to implement CSS packager (#8492)
  Fixup CI again (#9471)
  Clippy and use napi's Either3 (#9047)
  Upgrade to eslint 8 (#8580)
  Add support for JS macros (#9299)
  Fixup REPL CI (#9467)
  Drop per-pipeline transformation cache (#9459)
  Upgrade some CI actions (#9466)
  REPL (#9365)
  ...
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.

[Web Extension]: Parcel doesn't accept Manifest v3 "world" key for content scripts
3 participants