Manifest 3 to manifest 2 converting

720 views
Skip to first unread message

Elliot

unread,
Nov 8, 2021, 6:46:23 AM11/8/21
to Chromium Extensions
I am a new extension api developer and am trying to have my extension work in Mozilla as well... Is there any scripts that can convert my Manifest v3 to a Manifest v2?

Cuyler Stuwe

unread,
Nov 8, 2021, 8:22:37 AM11/8/21
to Elliot, Chromium Extensions
Unless you have an extremely simple extension, your best bet to develop MV2 vs MV3 extensions is to start up a new codebase.

They're massively different from one another in too many ways.

On Mon, Nov 8, 2021 at 3:46 AM Elliot <ell...@elliotcs.dev> wrote:
I am a new extension api developer and am trying to have my extension work in Mozilla as well... Is there any scripts that can convert my Manifest v3 to a Manifest v2?

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/53405f1d-7891-493a-b4f2-b86635012363n%40chromium.org.

Simeon Vincent

unread,
Nov 8, 2021, 5:11:26 PM11/8/21
to Cuyler Stuwe, Elliot, Chromium Extensions
I don't agree with Cuyler's assessment.

The capabilities provided by Manifest V3 service workers can be thought of as a subset of what Manifest V2 event pages provide. As such, it's possible to create an extension that can be deployed as either a Manifest V2 extension with an event page, a Manifest V3 extension with a service worker, or even a Manifest V2 extension with a service worker. If you've already created a Manifest V3 extension, I'd be willing to bet it's probably pretty close to being  able to deploy it as a Manifest V2 extension.

As for automating tooling, one of the engineers working on Chrome's extensions team created a Python tool that handles the basic parts of moving a Manifest V2 extensions to Manifest V3 and vice versa. I'd recommend giving it a look. https://github.com/GoogleChromeLabs/extension-manifest-converter

Simeon - @dotproto
Chrome Extensions DevRel


Cuyler Stuwe

unread,
Nov 8, 2021, 5:34:17 PM11/8/21
to Simeon Vincent, Chromium Extensions, Elliot
Yeah, converting the manifest is about as close as you can get to a reasonable downgrade “conversion” process as of today; If that doesn’t make something that’s compatible, then there’s no real simple automation that will fix your problem. Maybe that will “just work”, and for simple extensions, it probably will. But if it doesn’t work, then you’re likely going to have to sort it out by hand.

This is a public thread that will appear in search results in the future and will likely be read more by passers-by than by the asker. With that in mind, it’s worth noting that not all of the planned MV3 features are actually an a subset of MV2, and OP presumably wants to be able to set up a conversion process where he can reliably continue porting things back to MV2 even after new features might be added to MV3 and used in the future (e.g., this discussion about directly fetching frame IDs, and implementation plans derived from it:
https://github.com/w3c/webextensions/issues/12). Solutions generally need to work for longer than just the present day.

Cuyler Stuwe

unread,
Nov 8, 2021, 5:38:04 PM11/8/21
to Cuyler Stuwe, Chromium Extensions, Elliot, Simeon Vincent
And with the portrayal of MV3 as a “subset” of MV2’s features, that seems like a bit of a backtrack in formerly suggesting that e.g. the non-blocking DNR and scripting APIs are useful “features” that devs should be excited about. 🤷‍♂️

Simeon Vincent

unread,
Nov 8, 2021, 9:14:26 PM11/8/21
to Cuyler Stuwe, Cuyler Stuwe, Chromium Extensions, Elliot
I apologize for giving the impression that Manifest V3 is a subset of Manifest V2; that was not my intention. I was trying to get at the idea that a service worker is (generally speaking) a more limited execution environment than a page. Most of what you can do in a service worker script can also be done in a page script. In that sense, moving from a service worker in Manifest V3 to a page in Manifest V2 will likely be a more straightforward process than moving from a Maniest V2 page to a Manifest V3 service worker. As Cuyler said, there are API incompatibilities in both directions, but I expect that you're more likely to have challenges moving away from pages than to them.

Beyond that, though, my comment was intentionally framed as optimistic encouragement for the question asker. I mostly wanted to stress that (with some modifications) their extension may be able to support Firefox's Manifest V2 platform and Chrome's Manifest V3 platform at the same time. While there are API incompatibilities between the manifest versions and browsers, developers can work around many of these differences via shims or utility libs that abstract away the implementation details of their build targets. For example, you could write an executeScript wrapper function that uses tabs.executeScript in Manifest V2 and scripting.executeScript in Manifest V3. 

BTW, the Declarative Net Request API is available in both Manifest V2 and V3 on Chrome and other browser vendor(s) are also currently working on implementing support.

Simeon - @dotproto
Chrome Extensions DevRel

Carlos

unread,
Nov 9, 2021, 6:29:11 AM11/9/21
to Chromium Extensions, Simeon Vincent, salem...@gmail.com, Chromium Extensions, Elliot, cuyler...@gmail.com
Currently working on an npm package which can convert the manifest file from v3 to v2 and handle other compatibility issues. Let me know if you are interested. https://apps.jeurissen.co/contact

Op dinsdag 9 november 2021 om 03:14:26 UTC+1 schreef Simeon Vincent:
Reply all
Reply to author
Forward
0 new messages