Open dmlls opened 1 year ago
@NyanKiyoshi here is the PR, as promised :)
Do you think you could give it a try also on Chrome to see how things work there?
@dmlls that seems tricky to implement proper manifest v3 support.
The first issue is background.scripts
becomes background.service_worker
.
The second is permissions: webRequest
and webRequestBlocking
are no longer valid in manifest v3 (at least for chrome and chromium browsers). Thus instead of using browser.webRequest
in background.js
, we need to define JSON rules for the overrides.
The manifest changes required:
On the compatibility matrix I do not see any support for rules in Firefox thus it may not work: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest#browser_compatibility.
I do not personally see a way to re-implement background.js
without whether having a huge amount of dynamic rules, or redirecting to the extension's URL (e.g. extension://yang-extension-id/handle-yang.html?search=foo
) which sounds like bad UX due to having to redirect twice the user (doesn't work based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1262147).
Hi @NyanKiyoshi, thanks a lot for the detailed feedback! 💯
I see things are not looking all that great... I'll take a close look during the next week and see what we can do, but yeah, hope there's a solution that doesn't involve any ugly workarounds, as you mentioned.
@NyanKiyoshi So actually the webRequestBlocking
permission is not needed, so it can be simply removed.
As for the background.scripts
vs background.service_worker
conflict, it seems indeed there is currently no way of making them work simultaneously on both Firefox and Chrome. A possible solution would be to keep two separate manifest.json
as mentioned here. Since the change is minimal, at least for now this wouldn't add much overhead.
As discussed in https://github.com/dmlls/yang/pull/3, this PR implements the necessary changes to comply with Manifest V3, following the Firefox Manifest V3 migration guide.