chrome-NewWindowWithTabsToRight icon indicating copy to clipboard operation
chrome-NewWindowWithTabsToRight copied to clipboard

Update to Chrome Extension Manifest v3

Open 0xdevalias opened this issue 3 years ago • 7 comments

  • https://developer.chrome.com/blog/mv2-transition/
    • Manifest V3 is more secure, performant, and privacy-preserving than its predecessor. It is an evolution of the extension platform that takes into consideration both the changing web landscape and the future of browser extensions.

    • 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.

  • https://developer.chrome.com/blog/more-mv2-transition/
    • Starting in January in Chrome 112, Chrome may run experiments to turn off support for Manifest V2 extensions in Canary, Dev, and Beta channels.

    • Starting in June in Chrome 115, Chrome may run experiments to turn off support for Manifest V2 extensions in all channels, including stable channel.

    • For developers who still own extensions running Manifest V2, we recommend completing migration to Manifest V3 well ahead of the release of these Chrome versions because those extensions may stop working at any time following the aforementioned dates.

  • https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/
    • December 9, 2022: The Manifest V2 deprecation timelines are under review and the experiments scheduled for early 2023 are being postponed. For more information, read the update in the chromium-extensions Google Group.

    • https://groups.google.com/u/1/a/chromium.org/g/chromium-extensions/c/zQ77HkGmK9E
      • Pausing Manifest V2 phase-out changes

      • we’re postponing any January experiments to turn off Manifest V2 in pre-release channels of Chrome and changes to the featured badge in the Chrome Webstore, and we'll be evaluating all downstream milestones as well. Expect to hear more about the updated phase-out plan and schedule by March of 2023. Our guiding principle will be to give developers sufficient time to update and test their extensions after the launch of these new capabilities before turning off Manifest V2.

  • https://developer.chrome.com/blog/resuming-the-transition-to-mv3
    • Resuming the transition to Manifest V3

    • The phase-out timeline We will begin disabling Manifest V2 extensions in pre-stable versions of Chrome (Dev, Canary, and Beta) as early as June 2024, in Chrome 127 and later. Users impacted by the rollout will see Manifest V2 extensions automatically disabled in their browser and will no longer be able to install Manifest V2 extensions from the Chrome Web Store. Also in June 2024, Manifest V2 extensions will lose their Featured badge in the Chrome Web Store if they currently have one.

      • https://chromestatus.com/roadmap
        • Chrome 127 Beta between Jun 12 - Jun 27 Stable Jul 17, 2024

  • https://blog.chromium.org/2024/05/manifest-v2-phase-out-begins.html
    • Manifest V2 phase-out begins

    • Starting on June 3 on the Chrome Beta, Dev and Canary channels, if users still have Manifest V2 extensions installed, some will start to see a warning banner when visiting their extension management page - chrome://extensions - informing them that some (Manifest V2) extensions they have installed will soon no longer be supported. At the same time, extensions with the Featured badge that are still using Manifest V2 will lose their badge.

  • https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline
    • Manifest V2 support timeline Understand when Manifest V2 will stop working for extensions

    • June 3 2024: the Manifest V2 phase-out begins. Starting on June 3 on the Chrome Beta, Dev and Canary channels, if users still have Manifest V2 extensions installed, some will start to see a warning banner when visiting their extension management page - chrome://extensions - informing them that some (Manifest V2) extensions they have installed will soon no longer be supported. At the same time, extensions with the Featured badge that are still using Manifest V2 will lose their badge.

      This will be followed gradually in the coming months by the disabling of those extensions. Users will be directed to the Chrome Web Store, where they will be recommended Manifest V3 alternatives for their disabled extension. For a short time after the extensions are disabled, users will still be able to turn their Manifest V2 extensions back on, but over time, this toggle will go away as well.

  • https://developer.chrome.com/docs/extensions/mv3/known-issues/
  • https://developer.chrome.com/docs/extensions/whatsnew/#m104-favicon-api
    • Manifest V3 extensions can now access favicons using a new URL pattern: chrome-extension://<id>/_favicon/, where is the ID of your extension. This replaces the Manifest V2 platform's chrome://favicons API. See the Favicon API docs for more information.

0xdevalias avatar Dec 13 '22 20:12 0xdevalias

Here is the official migration guide:

  • https://developer.chrome.com/docs/extensions/develop/migrate
    • Migrate to Manifest V3

      A guide to converting Manifest V2 extensions to Manifest V3 extensions.

      Note: Manifest V3 is supported generally in Chrome 88 or later. For extension features added in later Chrome versions, see the API reference documentation for support information. If your extension requires a specific API, you can specify a minimum chrome version in the manifest file.

  • https://developer.chrome.com/docs/extensions/develop/migrate/checklist
    • Manifest V3 migration checklist

      Keep track of your migration progress

And this may also be potentially useful:

  • https://developer.chrome.com/blog/extension-manifest-converter/
    • https://github.com/GoogleChromeLabs/extension-manifest-converter
      • Extension Manifest Converter Extension Manifest Converter is an open source tool that helps convert existing Chrome extensions to Manifest V3.

0xdevalias avatar Apr 16 '24 04:04 0xdevalias

It seems like Chrome 127 is when MV2 extensions will start getting disabled, and according to the release timeline, that will hit stable release tomorrow (Jul 17 2024):

  • https://developer.chrome.com/blog/resuming-the-transition-to-mv3
    • Resuming the transition to Manifest V3

    • The phase-out timeline We will begin disabling Manifest V2 extensions in pre-stable versions of Chrome (Dev, Canary, and Beta) as early as June 2024, in Chrome 127 and later. Users impacted by the rollout will see Manifest V2 extensions automatically disabled in their browser and will no longer be able to install Manifest V2 extensions from the Chrome Web Store. Also in June 2024, Manifest V2 extensions will lose their Featured badge in the Chrome Web Store if they currently have one.

      • https://chromestatus.com/roadmap
        • Chrome 127

          • Beta between Jun 12 - Jun 27
          • Stable tomorrow (Jul 17, 2024)

Edit: At 4:11pm on 17/07/2024, it says stable will release in ~8hrs; which would basically be at midnight/the start of 18/07/2024 (AEST)

0xdevalias avatar Jul 15 '24 05:07 0xdevalias

I tried running the extension-manifest-converter:

  • https://github.com/GoogleChromeLabs/extension-manifest-converter

It seems to have merged all of the existing .js files (src/bg/background.js, js/chromeExtensionApiAbstractions.js, js/googleAnalytics.js ) into a single service_worker.js file (and maybe makes some tweaks to that code in doing so). Not sure if this is a requirement, or it's just a limitation of this tool and we can still maintain separate files. Need to look deeper into that:

  • https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#update-bg-field
    • Replace "background.scripts" with "background.service_worker" in the manifest.json. Note that the "service_worker" field takes a string, not an array of strings.

    • The "service_worker" field takes a single string. You will only need the "type" field if you use ES modules (using the import keyword). Its value will always be "module". For more information, see Extension service worker basics

      • https://developer.chrome.com/docs/extensions/develop/concepts/service-workers/basics
  • https://developer.chrome.com/docs/extensions/develop/concepts/service-workers/basics#import-scripts
    • There are two methods of importing scripts into a service worker: the import statement and the importScripts() method. Note that import(), often called a dynamic import, is not supported.

It also made the following minimal changes to manifest.json (ignoring whitespace changes):

diff --git a/manifest.json b/manifest.json
index 404abe8..a4494be 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,10 +1,12 @@
 {
   "name": "New Window With Tabs To Right",
   "version": "1.0.1",
-  "manifest_version": 2,
+  "manifest_version": 3,
   "description": "This extension creates a new window with the tabs to the right of the currently selected tab.",
   "homepage_url": "http://devalias.net/dev/chrome-extensions/",
-  "content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'",
+  "content_security_policy": {
+    "extension_pages": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'"
+  },
   "permissions": [
     "tabs",
     "contextMenus"
@@ -16,12 +18,8 @@
   },
   "default_locale": "en",
   "background": {
-    "scripts": [
-      "js/googleAnalytics.js",
-      "js/chromeExtensionApiAbstractions.js",
-      "src/bg/background.js"
-    ],
-    "persistent": true
+    "persistent": true,
+    "service_worker": "service_worker.js"
   },
   "commands": {
     "newWindowWithCurrentAndTabsToRight": {

Given the simplicity of this extension, I assume there probably won't be a lot of changes to be made to convert it; and so it's not all that surprising that the changes this conversion tool made were so minimal; but now we really need to go through the migration checklist to figure out more specifically what needs to be done; and if these changes are required/optimal:

0xdevalias avatar Jul 17 '24 06:07 0xdevalias

Last time I was working on this, I was exploring a way to implement 'options toggles' in the contextMenu, so that, as an example, the user could toggle on/off the 'page' context menu (eg. right-click on page) as per this issue:

  • https://github.com/0xdevalias/chrome-NewWindowWithTabsToRight/issues/16

And tangentially this issue:

  • https://github.com/0xdevalias/chrome-NewWindowWithTabsToRight/issues/5

Here is the (private) ChatGPT reference that I was exploring that in for context:

  • https://chatgpt.com/c/8c6ee698-6b16-4192-acd6-10ceb8d750a9

My notes from then was that "it is seeming like it might be more effort than it's worth, and maybe implementing a proper options page would be a better choice"; though I this was before the ChatGPT o1-preview and o1-mini models were released; so they may be able to come up with a better 'wholistic solution' than I was struggling with with the 4o model on its own.

Here is a new (private) ChatGPT o1-preview reference exploring how to implement this using the same method I was exploring previously:

  • https://chatgpt.com/c/66f5127b-a710-8008-954e-4f8448dc1fe2

0xdevalias avatar Sep 26 '24 07:09 0xdevalias

I'm exploring some ideas for refactoring everything into more modular code files/patterns in this (private) ChatGPT o1-preview conversation:

  • https://chatgpt.com/c/66f8e70f-ce4c-8008-92f8-673f9c8c56ae

0xdevalias avatar Sep 29 '24 06:09 0xdevalias

I'm exploring some ideas for implementing settings / context menu options toggles for changing the default onClick action of the extensions 'action icon' in this (private) ChatGPT o1-preview conversation:

  • https://chatgpt.com/c/66f911d6-7e94-8008-88a2-f869748086e2

This relates to the following issues:

  • https://github.com/0xdevalias/chrome-NewWindowWithTabsToRight/issues/16
  • https://github.com/0xdevalias/chrome-NewWindowWithTabsToRight/issues/5

0xdevalias avatar Sep 29 '24 08:09 0xdevalias

Since I haven't had a chance to get back to working on this in ages, I just did a quick check that the main functionality in https://github.com/0xdevalias/chrome-NewWindowWithTabsToRight/pull/20 seems to work; and then created a 2.0.0-alpha build of that + submitted it to the Chrome store.

I still intend to get back to finishing that PR 'properly' at some stage and getting it merged/etc; but at the very least, this should unblock the 'removed from the store because no MV3 version' blocker that currently exists from people being able to use the extension.

0xdevalias avatar Aug 14 '25 06:08 0xdevalias