-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve adaptation of the extension for Chrome Web Store #1
Comments
The following changes seem to work. Some changes needed are specifically for Manifest v3, but other are changes needed specifically for Chrome compatibility. For example Chrome uses Though Firefox uses diff --git a/src/background.js b/src/background.js
index 24e09e2..e15b47b 100644
--- a/src/background.js
+++ b/src/background.js
@@ -1,5 +1,5 @@
async function removeDuplicateTabs() {
- const tabs = await browser.tabs.query({});
+ const tabs = await chrome.tabs.query({});
const duplicateIds = [];
const bins = {};
@@ -12,11 +12,11 @@ async function removeDuplicateTabs() {
}
});
- await browser.tabs.remove(duplicateIds);
+ await chrome.tabs.remove(duplicateIds);
}
async function groupTabsByDomain() {
- const tabs = await browser.tabs.query({});
+ const tabs = await chrome.tabs.query({});
const domainGroups = {};
@@ -39,7 +39,7 @@ async function groupTabsByDomain() {
});
}
- await browser.tabs.move(newTabPositionIds, {
+ await chrome.tabs.move(newTabPositionIds, {
index: 0,
});
}
@@ -54,4 +54,4 @@ async function handleToolbarButtonClick() {
}
}
-browser.browserAction.onClicked.addListener(handleToolbarButtonClick);
+chrome.action.onClicked.addListener(handleToolbarButtonClick);
diff --git a/src/manifest.json b/src/manifest.json
index 3423155..9138ba9 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,5 +1,5 @@
{
- "manifest_version": 2,
+ "manifest_version": 3,
"name": "Tabtastic",
"version": "1.0.2",
"description": "Adds a browser button to help you sort tabs by domain and date, and close duplicate tabs.",
@@ -13,10 +13,10 @@
"permissions": [
"tabs"
],
- "browser_action": {
+ "action": {
"default_icon": "icons/icon.svg"
},
"background": {
- "scripts": ["background.js"]
+ "service_worker": "background.js"
}
} |
For |
As of now the extension is using Manifest v2 which is no longer supported by Chrome Web Store.
In Firefox, v3 support is currently limited when it comes to background scripts. v3 requires
service_worker
for background script, however, it's currently not enabled in Firefox's v3 manifest yet (officially tracked here). :(The text was updated successfully, but these errors were encountered: