Converting a manifest 3 extension to Safari/Firefox

2,941 views
Skip to first unread message

Rory

unread,
Jun 4, 2021, 2:36:56 AM6/4/21
to Chromium Extensions
Hey there,

I see there are some tools online that have historically been able to convert Chrome extensions to also work on other browsers. I've tried following this guide to convert a manifest 3 chrome extension to Safari but it doesn't like the manifest file:

https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari

I'm wondering if converting from manifest 3 is supported yet in other browsers - and if so, how have people managed to do it? Would rather avoid a full re-write to write a manifest 2 version for a different browser if possible but prepared to explore that option if necessary.

avm99963

unread,
Jun 4, 2021, 10:41:47 AM6/4/21
to Chromium Extensions, Rory
Hi!

I recently saw Firefox has plans to support Manifest v3:
In that blog post it says "we are hoping to complete enough work on this project to support developer testing in Q4 2021 and start accepting v3 submissions in early 2022. This schedule may be pushed back or delayed due to unforeseeable circumstances."

Unfortunately I don't have much experience with Safari's converter, although I also think it would be nice to know what plans they have with regards to their tool and MV3 extensions.

In case it helps you, in one of the extensions I'm developing, I maintain a generic manifest.json file for all targets (Firefox, Chromium MV2 and Chromium MV3)[1] and I use a Go program to generate the manifest for a specific target browser.[2][3] (in the case of this extension the Javascript code is very similar between targets so this is enough, although I'm thinking about extending my build process so some builds only include the files needed for the corresponding target)

Cheers :-)

Jon Howard

unread,
Jun 16, 2021, 6:56:18 AM6/16/21
to Chromium Extensions, avm99963, Rory
Hi Rory,
My extension works across Chrome, Edge, Firefox & Safari and is compliant with both MV2 and MV3 manifests.
My solution was to have two template manifest files, a v2 one and v3 one. My webpack powered build process then output's a 'dist.mv2' and 'dist.mv3' folder which I then pack for each browser.
The only difference I found was to rename the service worker to background page and make the background page persistent and also to change the popup action type.
I'm hoping that I'll also be compliant with iOS just by removing the persistent background flag.
The key thing was to make sure that any and all access to state was serialised to and from local storage and I also keep an in memory reference to the current state so that if it's valid (ie not undefined) then that is returned instead which keeps state access super fast for background pages and compliant with the fact that the page might not exist as a service worker.

Give me a shout if you need any further help.
Jon...

Simeon Vincent

unread,
Jun 16, 2021, 6:42:59 PM6/16/21
to Jon Howard, Chromium Extensions, avm99963, Rory
The only difference I found was to rename the service worker to background page and make the background page persistent and also to change the popup action type.
I'm hoping that I'll also be compliant with iOS just by removing the persistent background flag.

If I may, I'd recommend setting "persistent": false in your manifest if only to have all your implementations use temporary, event driven execution contexts. Also note that background pages are persistent by default, so removing  "persistent": true from your manifest (as implied by the second sentence I quoted) is a no-op.

Simeon - @dotproto
Chrome Extensions DevRel


--
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/2606adf4-f042-4624-a3dc-7aff26c9915dn%40chromium.org.

Dheeraj Reddy Anumula

unread,
May 17, 2022, 4:20:20 AM5/17/22
to Chromium Extensions, Simeon Vincent, Chromium Extensions, avm99963, Rory, Jon Howard
Can anyone please share the working manifest file using version 3?

Dheeraj Reddy Anumula

unread,
May 17, 2022, 4:21:03 AM5/17/22
to Chromium Extensions, Dheeraj Reddy Anumula, Simeon Vincent, Chromium Extensions, avm99963, Rory, Jon Howard
Safari 15.4 now supports manifest version 3. Link to realease notes - https://developer.apple.com/documentation/safari-release-notes/safari-15_4-release-notes

Dheeraj Reddy Anumula

unread,
May 17, 2022, 4:25:19 AM5/17/22
to Chromium Extensions, Dheeraj Reddy Anumula, Simeon Vincent, Chromium Extensions, avm99963, Rory, Jon Howard
@Jon Howard Can you please share how you have configured the webpack to use different manifest files and generated different builds in detail?
Reply all
Reply to author
Forward
0 new messages