PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
8.84k stars 314 forks source link

Set `world` property directly in `manifest.json` to skip extra permission #1011

Closed flexchar closed 2 weeks ago

flexchar commented 2 weeks ago

Details

This PR disables loading Content Scripts, where world: 'MAIN' is set, using background script. The previous approach causes extra permission in to be added, which negatively impacts Chrome Store reviews and provides arguably a more scary warning popup (permission popup on install) to end users than what is necessary.

This PR passes on the world property directly to the manifest. It is officially supported by the chrome. https://developer.chrome.com/docs/extensions/reference/api/scripting#type-ExecutionWorld

It is however not supported by Firefox but that doesn't alter the current behaviour (it is not supported at all). https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld#browser_compatibility

This is also the answer to my question here https://github.com/PlasmoHQ/plasmo/pull/433#issuecomment-1811057098.

Legacy discussion for the initial implementation: https://github.com/PlasmoHQ/plasmo/issues/422

Code of Conduct

Contacts

If your PR is accepted, we will award you with the Contributor role on Discord server.

To join the server, visit: https://www.plasmo.com/s/d

flexchar commented 2 weeks ago

Replaced by https://github.com/PlasmoHQ/plasmo/pull/1013

I used wrong branch...