Content scripts not injected for manifest v3 extension app?
Categories
(WebExtensions :: Compatibility, task, P2)
Tracking
(firefox101 affected, firefox102 affected, firefox103 affected)
People
(Reporter: hoseong.a.lee, Unassigned)
Details
(Keywords: dev-doc-needed)
Attachments
(1 file)
4.28 KB,
application/zip
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Steps to reproduce:
- Installed Firefox Nightly Build
- Downloaded a sample web extension "borderify" from https://github.com/mdn/webextensions-examples/tree/master/borderify.
- Updated the manifest version 2 -> 3
- Reloaded the extension, the content script does not seem working anymore.
Actual results:
The borderify extension should add red border to the target page. However, after upgrading manifest version 2 to 3, it stopped working.
Expected results:
It should continue working. I also tested in Chrome, and it worked perfectly fine with manifest version 3.
Comment 1•2 years ago
|
||
I can confirm this problem.
Comment 2•2 years ago
|
||
Hello,
I reproduced the issue on the latest Nightly (103.0a1/20220605213032), Beta (102.0b4/20220605185654) and Release (101.0/20220526203855) under Windows 10 x64 and Ubuntu 16.04 LTS using the attached extension. For testing, the “extensions.manifestV3.enabled” pref has been flipped to “true”.
With manifest version updated from 2 to 3, the red border inserted by the extension on the target page no longer shows up. With manifest version 2, the red border is displayed as expected.
Reporter | ||
Comment 3•2 years ago
|
||
Hi team. Is there any ETA on the bug fix? We would like to check to see if our current MV3 is compatible with Firefox MV3.
Comment 4•2 years ago
|
||
This is intended behavior, in Firefox version of MV3, all host permissions (including content script match patterns) are optional, and not granted automatically on install, but instead user needs to grant them at some point.
Depending on what’s appropriate for your extension, you could ask the user using promise.request()
, or they can grant it by going to about:addons, selecting your addon, and flipping the toggle in the permissions tab.
We’re also working on an easier UI to do this, tied to your extension browser action, but that’s not final yet. Additionally, I’ll work to get the migration guide updated with this info as well.
Updated•2 years ago
|
Reporter | ||
Comment 5•2 years ago
|
||
Okay Safari also asks user permission for content script injections. So this sounds like similar to it. Is this also documented in the current migration doc? Would really appreciate if you can point me to the link of the doc. Thanks.
Comment 6•2 years ago
|
||
Depending on what’s appropriate for your extension, you could ask the user using
promise.request()
, or they can grant it by going to about:addons, selecting your addon, and flipping the toggle in the permissions tab.
I guess you mean permissions.request()
? The problem is that this can only be called inside a handler for a user action.
It would be helpful if you can include an example in the migration guide on how to prompt the user on add-on install for a host permission e.g. <all_urls
>. Otherwise any extension that just modifies webpages or operates on top of them without any prior user interaction won't work.
Comment 7•2 years ago
|
||
Has anyone had any luck getting content scripts to run after prompting for permissions on <all_urls>
?
I just tried this with with an extension installed from file (as opposed to one via about:debugging
which is implicitly granted all optional permissions for dev purposes), and it has no effect, no content scripts run even with the preferences toggled on.
Reporter | ||
Comment 8•2 years ago
|
||
Any update on document for developers in how to run content script in FF's MV3? Are users supposed to go to the settings and toggle the button for "Access your data for all websites"?
Also, one mentioned permission.request API. But is it something we can run in the background? Or if we're supposed to call in the content script, how can we call it even without being able to run a content script first place?
I checked the guide doc (https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/), but was not able to find any updated info. Would you be able to provide some document around how to run content script in FF's MV3 smoothly?
Comment 9•2 years ago
|
||
I'm gonna come up with a first draft for explaining this better in the migration guide.
Description
•