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

Inconsistency: scripting.registerContentScripts and contentScripts.register #125

Closed
carlosjeurissen opened this issue Oct 31, 2021 · 4 comments
Labels
inconsistency Inconsistent behavior across browsers

Comments

@carlosjeurissen
Copy link
Contributor

carlosjeurissen commented Oct 31, 2021

Currently Chromium and Firefox have a different API for registering contentScripts.

Firefox was the first to implement browser.contentScripts.register. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contentScripts/register.

Chromium added / is about to add chrome.scripting.registerContentScripts. See:
https://developer.chrome.com/docs/extensions/mv3/content_scripts/ and
https://bugs.chromium.org/p/chromium/issues/detail?id=1054624

Since these APIs seem to do about the same thing, we should find ways to bring them closer together / work towards a single API design.

@Rob--W Rob--W added the inconsistency Inconsistent behavior across browsers label Nov 4, 2021
@Rob--W
Copy link
Member

Rob--W commented Nov 4, 2021

Firefox will deprecate the contentScripts API in favor of the scripting API namespace.

One design issue with contentScripts.register is that the lifetime of the script is tied to the lifetime of the calling page (e.g. background page). The scripting API fixes that.

@carlosjeurissen
Copy link
Contributor Author

Thanks so much for the update Rob! Is Firefox considering supporting this in MV2 as well? Or are there any specific reasons either technical or others to restrict it to MV3?

@Rob--W
Copy link
Member

Rob--W commented Nov 4, 2021

We're currently developing "new" features behind a flag for MV3, but if the API is mature I wouldn't rule out the possibility of making it available under MV2 too.

@Rob--W
Copy link
Member

Rob--W commented Nov 11, 2021

I believe that this issue has been resolved. We may file new issues for the scripting API in the future, but the question asked here has been answered.

@Rob--W Rob--W closed this as completed Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inconsistency Inconsistent behavior across browsers
Projects
None yet
Development

No branches or pull requests

2 participants