Skip to content

Commit

Permalink
Migrate manifest v2 -> v3 (#13)
Browse files Browse the repository at this point in the history
Loading this extension as-is throws a warning about v2's deprecation.
This is in preparation for:
https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/
Following:
https://developer.chrome.com/docs/extensions/mv3/mv3-migration/#man-sw

The extension's version number should probably be incremented as well.
(Either in this commit or one directly following it.)

I'm running this on Vivalid and it seems to work (when on top of
#11), but otherwise this
is not extensively tested.

***

Extra note:
It doesn't seem required, but it might be better to move
`background.js`'s content to another file.
Then change `bacground.js` to something that looks like the (now
deleted) `background.html` page, except using `importScripts` instead of
`<script>` tags.
As-is, `background.ts` seems to import `./tabs_helpers.js`
anyway/explicitly so it doesn't seem to make a difference when iusing
`"type": "module"`.

Co-authored-by: Benjamin Orsini <github.o7tgl@simplelogin.com>
  • Loading branch information
djdv and borsini committed Aug 6, 2023
1 parent 1eaf5b5 commit 2e626bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
2 changes: 0 additions & 2 deletions static/background.html

This file was deleted.

2 changes: 1 addition & 1 deletion static/index.html
Expand Up @@ -25,7 +25,7 @@ <h1>Otto Tabs</h1>

</div>

<script src='./popup.js'></script>
<script type='module' src='./popup.js'></script>
<script src='./localise.js'></script>

</body>
Expand Down
50 changes: 23 additions & 27 deletions static/manifest.json
@@ -1,28 +1,24 @@
{
"name": "Otto Tabs",
"description": "__MSG_manifest_description__",
"default_locale": "en",
"version": "0.3.0",
"manifest_version": 2,
"permissions": ["tabs", "storage"],
"browser_action": {
"default_popup": "index.html"
},
"background": {
"page": "background.html",
"persistent": false
},
"commands": { },
"icons": {
"48": "ic_launcher_round_48.png",
"72": "ic_launcher_round_72.png",
"96": "ic_launcher_round_96.png",
"144": "ic_launcher_round_144.png",
"192": "ic_launcher_round_192.png"
}
}





"name": "Otto Tabs",
"description": "__MSG_manifest_description__",
"default_locale": "en",
"version": "0.3.0",
"manifest_version": 3,
"minimum_chrome_version": "88",
"permissions": ["tabs","storage"],
"action": {
"default_popup": "index.html"
},
"background": {
"service_worker": "background.js",
"type": "module"
},
"commands": {},
"icons": {
"48": "ic_launcher_round_48.png",
"72": "ic_launcher_round_72.png",
"96": "ic_launcher_round_96.png",
"144": "ic_launcher_round_144.png",
"192": "ic_launcher_round_192.png"
}
}

0 comments on commit 2e626bd

Please sign in to comment.