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.
However, it keeps the existing behaviour for development to take advantage of automatically triggered browser refreshes.
I had some quirks running updated code. I got it to work but I would like extra pairs of eyes as I am not familiar with the original code base as well. :)
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.However, it keeps the existing behaviour for development to take advantage of automatically triggered browser refreshes.
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