Skip to content

Commit 1a230d1

Browse files
committed
Migrate to v3
1 parent 8b70aca commit 1a230d1

5 files changed

Lines changed: 37 additions & 55 deletions

File tree

src/js/background/badge.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const badge = {
1111

1212
if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 &&
1313
storage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) {
14-
browser.browserAction.setBadgeBackgroundColor({ color: "rgb(255, 79, 94)" });
15-
browser.browserAction.setBadgeText({ text: "!" });
16-
browser.browserAction.setBadgeTextColor({ color: "rgb(255, 255, 255)" });
14+
browser.action.setBadgeBackgroundColor({ color: "rgb(255, 79, 94)" });
15+
browser.action.setBadgeText({ text: "!" });
16+
browser.action.setBadgeTextColor({ color: "rgb(255, 255, 255)" });
1717
}
1818
}
1919
};

src/js/background/index.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/js/background/messageHandler.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,24 +246,23 @@ const messageHandler = {
246246
const count = await browser.storage.local.get({[key]: 0});
247247
const countOfContainerTabsOpened = ++count[key];
248248
browser.storage.local.set({[key]: countOfContainerTabsOpened});
249-
250249
// When the user opens their _ tab, give them the achievement
251250
if (countOfContainerTabsOpened === 100) {
252251
const storage = await browser.storage.local.get({achievements: []});
253252
storage.achievements.push({"name": "manyContainersOpened", "done": false});
254253
// use set and spread to create a unique array
255254
const achievements = [...new Set(storage.achievements)];
256255
browser.storage.local.set({achievements});
257-
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
258-
browser.browserAction.setBadgeText({text: "NEW"});
256+
browser.action.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
257+
browser.action.setBadgeText({text: "NEW"});
259258
}
260259

261260
this.maybePrepareSurveyAchievementOnUpdate(countOfContainerTabsOpened);
262261
},
263262

264263
async onFocusChangedCallback(windowId) {
265264
assignManager.removeContextMenu();
266-
// browserAction loses background color in new windows ...
265+
// Action loses background color in new windows ...
267266
// https://bugzil.la/1314674
268267
// https://github.com/mozilla/testpilot-containers/issues/608
269268
// ... so re-call displayBrowserActionBadge on window changes
@@ -300,8 +299,8 @@ const messageHandler = {
300299
// Ensure the achievement exists and is pending.
301300
achievements.push({ name: "surveyFinal", done: false });
302301
browser.storage.local.set({ achievements });
303-
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
304-
browser.browserAction.setBadgeText({text: "NEW"});
302+
browser.action.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
303+
browser.action.setBadgeText({text: "NEW"});
305304
},
306305
};
307306

src/js/popup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ const Logic = {
189189
async clearBrowserActionBadge() {
190190
const extensionInfo = await getExtensionInfo();
191191
const storage = await browser.storage.local.get({ browserActionBadgesClicked: [] });
192-
browser.browserAction.setBadgeBackgroundColor({ color: "#ffffff" });
193-
browser.browserAction.setBadgeText({ text: "" });
192+
browser.action.setBadgeBackgroundColor({ color: "#ffffff" });
193+
browser.action.setBadgeText({ text: "" });
194194
storage.browserActionBadgesClicked.push(extensionInfo.version);
195195
// use set and spread to create a unique array
196196
const browserActionBadgesClicked = [...new Set(storage.browserActionBadgesClicked)];

src/manifest.json

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"manifest_version": 2,
2+
"manifest_version": 3,
33
"name": "Firefox Multi-Account Containers",
44
"version": "8.3.5",
55
"incognito": "not_allowed",
@@ -10,7 +10,6 @@
1010
},
1111
"homepage_url": "https://github.com/mozilla/multi-account-containers#readme",
1212
"permissions": [
13-
"<all_urls>",
1413
"activeTab",
1514
"cookies",
1615
"contextMenus",
@@ -24,6 +23,9 @@
2423
"webRequestBlocking",
2524
"webRequest"
2625
],
26+
"host_permissions": [
27+
"<all_urls>"
28+
],
2729
"optional_permissions": [
2830
"bookmarks",
2931
"browsingData",
@@ -33,14 +35,14 @@
3335
"browser_specific_settings": {
3436
"gecko": {
3537
"id": "@testpilot-containers",
36-
"strict_min_version": "91.1.0",
38+
"strict_min_version": "109.0",
3739
"data_collection_permissions": {
3840
"required": ["none"]
3941
}
4042
}
4143
},
4244
"commands": {
43-
"_execute_browser_action": {
45+
"_execute_action": {
4446
"suggested_key": {
4547
"default": "Ctrl+Period",
4648
"mac": "MacCtrl+Period"
@@ -111,8 +113,7 @@
111113
"description": "__MSG_containerShortcut__"
112114
}
113115
},
114-
"browser_action": {
115-
"browser_style": true,
116+
"action": {
116117
"default_icon": "img/multiaccountcontainer-16.svg",
117118
"default_title": "Firefox Multi-Account Containers",
118119
"default_popup": "popup.html",
@@ -125,16 +126,18 @@
125126
}
126127
]
127128
},
128-
"page_action": {
129-
"browser_style": true,
130-
"default_icon": "img/container-openin-16.svg",
131-
"default_title": "__MSG_alwaysOpenSiteInContainer__",
132-
"default_popup": "pageActionPopup.html",
133-
"pinned": false,
134-
"show_matches": ["*://*/*"]
135-
},
136129
"background": {
137-
"page": "js/background/index.html"
130+
"scripts": [
131+
"js/utils.js",
132+
"js/proxified-containers.js",
133+
"js/background/backgroundLogic.js",
134+
"js/background/mozillaVpnBackground.js",
135+
"js/background/assignManager.js",
136+
"js/background/badge.js",
137+
"js/background/identityState.js",
138+
"js/background/messageHandler.js",
139+
"js/background/sync.js"
140+
]
138141
},
139142
"content_scripts": [
140143
{
@@ -152,10 +155,16 @@
152155
],
153156
"default_locale": "en",
154157
"web_accessible_resources": [
155-
"/img/multiaccountcontainer-16.svg"
158+
{
159+
"resources": [
160+
"img/multiaccountcontainer-16.svg"
161+
],
162+
"matches": [
163+
"<all_urls>"
164+
]
165+
}
156166
],
157167
"options_ui": {
158-
"page": "options.html",
159-
"browser_style": true
168+
"page": "options.html"
160169
}
161170
}

0 commit comments

Comments
 (0)