treestyletab
treestyletab copied to clipboard
Support Manifest v3
Mozilla announced that the background page is deprecated and we need to migrate to service workers on manifest v3. https://blog.mozilla.org/addons/2021/05/27/manifest-v3-update/
There are some information to migrate background page to service workers:
I understand their rationale for wanting to do this, but I would imagine the requirement to migrate from background pages to services workers will likely break addons that haven't been updated for a long time. That is unfortunate. I guess we will know more when they update us on that specific portion of the change.
Background pages will be replaced by background service workers (bug 1578286). This is a substantial change and will continue to be developed over the next few months. We will make a new announcement once we have something that can be tested in Nightly.
Currently TST's functionality looks impossible to be migrated to service workers. My comment at bugzilla.mozilla.org: https://bugzilla.mozilla.org/show_bug.cgi?id=1578286#c5
@piroor other than the 2 points you mentioned are you aware of any other challenges with the basic functionality at least working? It will be interesting to see how they reply to you and what other feedback they get with this transition.
There maybe some more possible incompatibilities. Until the manifest v2 become unsupported, I'll need to do more efforts...
@piroor I think the good thing is that they have said they plan on supporting manifest v2 for at least a year AFTER manifest v3 lands. So there will be some time especially considering I think v3 won't land for several months.
Chrome transition dates seem to be agreed upon: (September 23, 2021) https://developer.chrome.com/blog/mv2-transition/
January 17, 2022: New Manifest V2 extensions will no longer be accepted by the Chrome Web Store. Developers may still push updates to existing Manifest V2 extensions, but no new Manifest V2 items may be submitted.
January 2023: The Chrome browser will no longer run Manifest V2 extensions. Developers may no longer push updates to existing Manifest V2 extensions.
I haven't been able to find anything more recent about Firefox's plan, scope, and dates other than what we were given in May 2021.
Kind of an interesting comment at the last WECG Meeting on Nov 11: (Meeting Minutes)
Meeting notes
- [alexei] Google has given a timeline, with the appearance that MV3 is stable. The community response has been largely negative. Wonderful that Devlin can join us. Would like to have a discussion to discuss the trade-offs and whether they make sense.
If you look over the meeting minutes, there appears to still be a lot of questions about how the different browsers are going to handle different aspects of Manifest v3. I'm glad to see the WECG are concerned how Google are moving forward without agreement across the community. It will be interesting to see what Devlin (from Google) will say at the December 9th meeting.
A new update today: https://blog.mozilla.org/addons/2022/05/18/manifest-v3-in-firefox-recap-next-steps/
Some important parts:
In MV3, we’re introducing a new architecture: the background script must be designed to be restartable. To support this, we’ve reworked existing and introduced new APIs, enabling extensions to declare how the browser should behave without requiring the background script.
In launching our Developer Preview program for Manifest v3, our hope is that authors will test out our MV3 implementation to help us identify gaps or incompatibilities in our implementation. Work is continuing in parallel, and we expect to launch MV3 support for all users by the end of 2022. As we get closer to completion, we will follow up with more detail on timing and how we will support extensions through the transition.
I'm glad to see the WECG are concerned how Google are moving forward without agreement across the community.
Good glimpse into the future of how Google/Blink will act with a full on browser monopoly.
New blog post: https://blog.mozilla.org/addons/2022/10/31/begin-your-mv3-migration-by-implementing-new-features-today/
https://blog.mozilla.org/addons/2022/11/17/manifest-v3-signing-available-november-21-on-firefox-nightly/ MV3 will be available on v109 general release.
Another Mozilla blog post on MV2 & MV3 from March 13, 2024: https://blog.mozilla.org/addons/2024/03/13/manifest-v3-manifest-v2-march-2024-update/
Nothing drastic other them reiterating there will still be at least 1 year transition if\when they ever decide to deprecate MV2 for Firefox. They also mention Google's intent to start the MV2 deprecation timeline for Chrome again.
While TST 4.0 development I tried to think how to implement TST with short-live (unpersistent) background page.
- When the sidebar UI is invisible
- Tab changes would be handled with
tabs.onXXX
events but they would be delayed if the background script is unloaded. - On the initial startup, the script fetches all tabs via
tabs.query()
, and loads previous status viasessions.getTabValue()
. The script constructs status of tabs and saves it to the session storage viastorage.session.set()
as a RAM cache. And after a while Firefox will unload the script (to save the RAM). - When tab events (
tabs.onCreated
,tabs.onRemoved
,tabs.onMoved
and so on) are notified to the addon, the script is loaded again. On this case the script just loads cached status viastorage.session.get()
instead of constructing status from live information got viatabs.query()
andsessions.getTabValue()
. The script handles the notified event and updates Firefox's native tabs. (E.g. the script may move the tab to next to the active tab based on the tree information.) And the script also updates the cached status in parallel. Before the script is unloaded, the script saves the updated cached status to the session storage viastorage.session.set()
.
- Tab changes would be handled with
- When the sidebar UI is visible
- Tab changes would be handled with
tabs.onXXX
events without delay by the sidebar script. The script handles the notified event and updates Firefox's native tabs. (E.g. the script may move the tab to next to the active tab based on the tree information.) And the script also saves the result as a cached status (which is constructed by the background script) in parallel. - The background script does nothing in this case, to avoid conflicting of changes by both the background script and the sidebar script.
- Tab changes would be handled with
We need to measure performance of these processes, especially the overhead of saving/loading cached status.