microsoft / MicrosoftEdge-Extensions

This is a community space for Microsoft Edge Add-ons developers, to share resources and information about building, publishing and growing their Microsoft Edge extension.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug - Partner Center] Certification fails for MV3 extension having both background.service_worker and background.script defined in manifest

StigNygaard opened this issue · comments

The issue

Google/Chrome, Mozilla/Firefox and Apple/Safari all allow MV3 webextensions defining both background.service_worker and background.script in the manifest. In such cases browser will use only one of them and prefer the service_worker if the browser supports it. As documented here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support

While making the latest version of my Flickr Fixr webextension, I didn't even consider there could be a problem when uploading to MS Partner Center. I have tested the extension by manually installing in Edge, and it works perfect.

However when I upload to Partner Center, I get "package failed certification" error:

The following checks failed:
Package acceptance validation error: The background.scripts field cannot be used with manifest version 3. Use the background.service_worker field instead. Error code: background: { "scripts": [ "background/flickr_fixr.js" ], "service_worker": "background/flickr_fixr.js", "type": "module" } Line: 38 Column: 17

To Reproduce

I'm guessing issue can be reproduced by uploading any MV3 webextension having both background.service_worker and background.script defined in the manifest.

Expected behavior

I had hoped/assumed it would accept the extension. Maybe with a warning, but not an error stopping me from publishing it.

Screenshots

Edge-backgroundscript-error-cropped

Desktop

Probably not relevant, but I logged into Partner Center using Firefox 128 on Windows 11.

Additional context

https://discourse.mozilla.org/t/mv3-background-scripts-vs-serviceworkers-ms-edge-didnt-get-the-memo/133613
https://blog.mozilla.org/addons/2024/03/13/manifest-v3-manifest-v2-march-2024-update/
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support
https://github.com/StigNygaard/Stigs_Flickr_Fixr
https://github.com/StigNygaard/Stigs_Flickr_Fixr/blob/master/WebExtension/manifest.json
Current Flickr Fixr available for Edge: https://microsoftedge.microsoft.com/addons/detail/ieinimkepkfmmpeakdgnoikimokffneh

Okay, I see I'm not the first one reporting this:
#136
#165

Hi @StigNygaard, we want to express our gratitude for your understanding and patience. Please be assured that the similar feedback has already been forwarded to our engineering team, and they are diligently working on it. Your patience during this process is greatly appreciated.

We understand the importance of this issue and once we have an update or need further information, we will get back to you promptly. We appreciate your contribution to improving the platform.

Bonus question/comment. A bit off-topic. But only a bit, it is still about cross-browser flexibility in manifest file and what Partner Center will allow me to upload...

I have another extension which requests the two related permissions "menus" and "contextMenus". Safari recognize "menus" as an alias for "contextMenus" and in Firefox "menus" represents a superset of "contextMenus" adding support for finding the exact DOM-element a context-menu was opened from. I don't think Chromium browsers recognize the "menus" permission(?), but I can still manually install and use the extension of mine in Chromium browsers.

My extension takes advantage of the extra feature (in Firefox) of "menus" when available, but also works without the extra feature. I use it by eventually redefining contextMenus like this:

globalThis.browser ??= chrome;
if (browser.menus?.getTargetElement) {
  browser.contextMenus = browser.menus;
}

So the question is, would Partner Center accept a manifest defining permissions something like this (with both "menus" and "contextMenus"):

  "permissions": [
    "scripting",
    "contextMenus",
    "menus",
    "storage"
  ],

I can install the extension manually in Edge. It works fine.

Maybe I should just try it, but there's some more work I want to do on extension and especially documentation (introduction) before eventually making it "officially" available for Chromium browsers.

Hey @StigNygaard, thank you for providing additional information. We will respond with an update once we hear back from our team. We appreciate your patience in the meantime.