firefox-remove-safelinks icon indicating copy to clipboard operation
firefox-remove-safelinks copied to clipboard

Migrate to Manifest V3

Open wtimme opened this issue 9 months ago • 1 comments
trafficstars

As a user, I want that the add-on uses Manifest V3, so that I can grant and revoke host permissions individually

Acceptance criterias

  • The manifest_version in manifest.json is set to "3"
  • Users who freshly install the add-on are prompted/asked/suggested to grant the host permissions
  • Users who update know when/if they need to grant the host permissions
    • Ideally, the update is seamless
  • The existing functionality of the add-on is maintained

wtimme avatar Feb 08 '25 15:02 wtimme

Mozilla has provided a migration guide.

I was not sure regarding the benefit of the migration for the user, besides the fine-grained control over the host permissions. For the add-on as a whole, however, I believe that an upgrade is beneficial, for example to improve/pave the way for compatibility with Chrome (cp. #2).

Here's a first step for the manifest.json:

diff --git a/manifest.json b/manifest.json
index 8669634..bddc1df 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,13 +1,15 @@
 {
   "description": "Disables Microsoft SafeLink protection by redirecting to the original URL instead of going through Microsoft",
-  "manifest_version": 2,
+  "manifest_version": 3,
   "name": "Disable Microsoft Safe Links",
   "version": "1.9.0",
   "homepage_url": "https://github.com/wtimme/firefox-remove-safelinks",
   "permissions": [
     "storage",
     "webRequest",
-    "webRequestBlocking",
+    "webRequestBlocking"
+  ],
+  "host_permissions": [
     "https://statics.teams.cdn.office.net/evergreen-assets/safelinks/1/atp-safelinks.html*",
     "https://safelinks.protection.outlook.com/*",
     "https://*.safelinks.protection.outlook.com/*",
@@ -22,8 +24,7 @@
   "background": {
     "scripts": [
       "background.js"
-    ],
-    "persistent": false
+    ]
   },
   "browser_specific_settings": {
     "gecko": {

What is missing is to ask/remind the user to grant the host permissions and, of course, proper testing.

Feel free to contribute! I'm always happy about a helping hand.

wtimme avatar Feb 08 '25 15:02 wtimme