Merge branch 'main' into upgrade-web-ext

This commit is contained in:
Logan Rosen
2025-11-10 23:07:44 -05:00
19 changed files with 1768 additions and 13452 deletions
-2
View File
@@ -1,2 +0,0 @@
lib/testpilot/*.js
coverage
-69
View File
@@ -1,69 +0,0 @@
module.exports = {
"parserOptions": {
"ecmaVersion": 2021
},
"env": {
"browser": true,
"es6": true,
"node": true,
"webextensions": true
},
"globals": {
"Utils": true,
"CustomizableUI": true,
"CustomizableWidgets": true,
"SessionStore": true,
"Services": true,
"Components": true,
"XPCOMUtils": true,
"OS": true,
"ADDON_UNINSTALL": true,
"ADDON_DISABLE": true,
"CONTAINER_ORDER_STORAGE_KEY": true,
"proxifiedContainers": true,
"MozillaVPN": true,
"MozillaVPN_Background": true
},
"plugins": [
"promise",
"no-unsanitized"
],
"extends": [
"eslint:recommended"
],
"root": true,
"rules": {
"promise/always-return": "off",
"promise/avoid-new": "off",
"promise/catch-or-return": "error",
"promise/no-callback-in-promise": "warn",
"promise/no-native": "off",
"promise/no-nesting": "warn",
"promise/no-promise-in-callback": "warn",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"no-unsanitized/method": [
"error"
],
"no-unsanitized/property": [
"error",
{
"escape": {
"taggedTemplates": ["Utils.escaped"]
}
}
],
"eqeqeq": "error",
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"no-throw-literal": "error",
"no-warning-comments": "warn",
"no-var": "error",
"prefer-const": "error",
"quotes": ["error", "double"],
"radix": "error",
"semi": ["error", "always"]
}
};
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
+102
View File
@@ -0,0 +1,102 @@
const {
defineConfig,
globalIgnores,
} = require("eslint/config");
const globals = require("globals");
const promise = require("eslint-plugin-promise");
const noUnsanitized = require("eslint-plugin-no-unsanitized");
const js = require("@eslint/js");
module.exports = defineConfig([{
languageOptions: {
"ecmaVersion": 2021,
parserOptions: {},
globals: {
...globals.browser,
...globals.node,
...globals.webextensions,
"Utils": true,
"CustomizableUI": true,
"CustomizableWidgets": true,
"SessionStore": true,
"Services": true,
"Components": true,
"XPCOMUtils": true,
"OS": true,
"ADDON_UNINSTALL": true,
"ADDON_DISABLE": true,
"CONTAINER_ORDER_STORAGE_KEY": true,
"proxifiedContainers": true,
"MozillaVPN": true,
"MozillaVPN_Background": true,
},
},
plugins: {
js,
promise,
"no-unsanitized": noUnsanitized,
},
extends: ["js/recommended"],
"rules": {
"promise/always-return": "off",
"promise/avoid-new": "off",
"promise/catch-or-return": "error",
"promise/no-callback-in-promise": "warn",
"promise/no-native": "off",
"promise/no-nesting": "warn",
"promise/no-promise-in-callback": "warn",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"no-unsanitized/method": ["error"],
"no-unsanitized/property": ["error", {
"escape": {
"taggedTemplates": ["Utils.escaped"],
},
}],
"eqeqeq": "error",
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"no-throw-literal": "error",
"no-warning-comments": "warn",
"no-var": "error",
"prefer-const": "error",
"quotes": ["error", "double"],
"radix": "error",
"semi": ["error", "always"],
},
},
{
files: ["test/**/*.js"],
languageOptions: {
globals: {
...globals.mocha,
},
},
"rules": {
"no-restricted-globals": ["error", "browser"],
},
},
{
files: ["src/js/**/*.js"],
languageOptions: {
globals: {
"assignManager": true,
"badge": true,
"backgroundLogic": true,
"identityState": true,
"messageHandler": true,
"sync": true,
},
},
},
globalIgnores(["lib/testpilot/*.js", "**/coverage"])]);
+1603 -13314
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -2,19 +2,20 @@
"name": "testpilot-containers",
"title": "Multi-Account Containers",
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
"version": "8.3.0",
"version": "8.3.5",
"author": "Andrea Marchesini, Luke Crouch, Lesley Norton, Kendall Werts, Maxx Crawford, Jonathan Kingston",
"bugs": {
"url": "https://github.com/mozilla/multi-account-containers/issues"
},
"dependencies": {},
"devDependencies": {
"@eslint/js": "^9.36.0",
"addons-linter": "^5.28.0",
"ajv": "^6.6.3",
"chai": "^4.2.0",
"eslint": "^7.32.0",
"eslint-plugin-no-unsanitized": "^4.0.0",
"eslint-plugin-promise": "^5.2.0",
"eslint": "^9.36.0",
"eslint-plugin-no-unsanitized": "^4.1.4",
"eslint-plugin-promise": "^7.2.1",
"globals": "^16.4.0",
"htmllint-cli": "0.0.7",
"json": ">=10.0.0",
"mocha": "^10.1.0",
-14
View File
@@ -1,14 +0,0 @@
module.exports = {
"extends": [
"../../.eslintrc.js"
],
"globals": {
"assignManager": true,
"badge": true,
"backgroundLogic": true,
"identityState": true,
"messageHandler": true,
"sync": true,
"Utils": true
}
};
+1 -2
View File
@@ -77,7 +77,6 @@ window.assignManager = {
this.setExempted(pageUrlorUrlKey, tabId);
});
}
// eslint-disable-next-line require-atomic-updates
data.identityMacAddonUUID =
await identityState.lookupMACaddonUUID(data.userContextId);
await this.area.set({
@@ -233,7 +232,7 @@ window.assignManager = {
try {
container = await browser.contextualIdentities
.get(backgroundLogic.cookieStoreId(siteSettings.userContextId));
} catch (e) {
} catch {
container = false;
}
+16 -1
View File
@@ -38,6 +38,7 @@ const backgroundLogic = {
browser.runtime.onInstalled.addListener((details) => {
this.updateTranslationInManifest();
this._undoDefault820SortTabsKeyboardShortcut(details);
this._removeSurveyAchievement();
});
browser.runtime.onStartup.addListener(this.updateTranslationInManifest);
},
@@ -68,6 +69,20 @@ const backgroundLogic = {
}
},
/**
* We left an achievement entry in storage during a user research study in
* version 8.3.1. This method removes that entry to prevent broken logic in
* the achievement views.
*/
async _removeSurveyAchievement() {
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
const achievements = achievementsStorage.achievements;
const filtered = achievements.filter(a => a.name !== "survey");
if (filtered.length !== achievements.length) {
await browser.storage.local.set({achievements: filtered});
}
},
updateTranslationInManifest() {
for (let index = 0; index < 10; index++) {
const ajustedIndex = index + 1; // We want to start from 1 instead of 0 in the UI.
@@ -239,7 +254,7 @@ const backgroundLogic = {
containerState.isIsolated = "locked";
}
return await identityState.storageArea.set(cookieStoreId, containerState);
} catch (error) {
} catch {
// console.error(`No container: ${cookieStoreId}`);
}
},
-1
View File
@@ -141,7 +141,6 @@ const messageHandler = {
if (!extensionInfo.permissions.includes("contextualIdentities")) {
throw new Error("Missing contextualIdentities permission");
}
// eslint-disable-next-line require-atomic-updates
externalExtensionAllowed[sender.id] = true;
}
let response;
+1 -1
View File
@@ -27,7 +27,7 @@ const MozillaVPN_Background = {
// invalid proxy connection.
this.port.onDisconnect.addListener(() => this.increaseIsolationKey());
} catch(e) {
} catch {
this._installed = false;
this._connected = false;
}
+2 -3
View File
@@ -338,7 +338,7 @@ async function reconcileIdentities(){
if (deletedCookieStoreId){
try{
await browser.contextualIdentities.remove(deletedCookieStoreId);
} catch (error) {
} catch {
// if the identity we are deleting is not there, that's fine.
console.error("Error deleting contextualIdentity", deletedCookieStoreId);
continue;
@@ -514,7 +514,7 @@ async function reconcileSiteAssignments() {
await setAssignmentWithUUID(assignedSite, urlKey);
continue;
}
} catch (error) {
} catch {
// this is probably old or incorrect site info in Sync
// skip and move on.
}
@@ -565,7 +565,6 @@ async function setAssignmentWithUUID(assignedSite, urlKey) {
const uuid = assignedSite.identityMacAddonUUID;
const cookieStoreId = await identityState.lookupCookieStoreId(uuid);
if (cookieStoreId) {
// eslint-disable-next-line require-atomic-updates
assignedSite.userContextId = cookieStoreId
.replace(/^firefox-container-/, "");
await assignManager.storageArea.set(
+2 -2
View File
@@ -88,7 +88,7 @@ const MozillaVPN = {
el.classList.remove("display-none");
});
this.setStatusIndicatorIcons(mozillaVpnInstalled);
} catch (e) {
} catch {
mozVpnLogotypes.forEach(el => {
el.style.display = "none";
});
@@ -139,7 +139,7 @@ const MozillaVPN = {
try {
const proxy = await proxifiedContainers.retrieve(identity.cookieStoreId);
proxies[identity.cookieStoreId] = proxy;
} catch (e) {
} catch {
proxies[identity.cookieStoreId] = {};
}
}
+27 -20
View File
@@ -137,19 +137,26 @@ const Logic = {
},
async showAchievementOrContainersListPanel() {
// Do we need to show an achievement panel?
let showAchievements = false;
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
for (const achievement of achievementsStorage.achievements) {
if (!achievement.done) {
showAchievements = true;
const achievements = achievementsStorage.achievements;
let saveAchievements = false;
for (const achievement of achievements.filter(a => !a.done)) {
if (achievement.name === "manyContainersOpened") {
this.showPanel(P_CONTAINERS_ACHIEVEMENT);
return;
}
// We have found an unknown achievement. Let's mark it as done.
achievement.done = true;
saveAchievements = true;
}
if (showAchievements) {
this.showPanel(P_CONTAINERS_ACHIEVEMENT);
} else {
this.showPanel(P_CONTAINERS_LIST);
if (saveAchievements) {
browser.storage.local.set({ achievements });
}
this.showPanel(P_CONTAINERS_LIST);
},
// In case the user wants to click multiple actions,
@@ -198,7 +205,7 @@ const Logic = {
// Handle old style rejection with null and also Promise.reject new style
try {
return await browser.contextualIdentities.get(cookieStoreId) || defaultContainer;
} catch (e) {
} catch {
return defaultContainer;
}
},
@@ -425,7 +432,7 @@ const Logic = {
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {
} catch {
window.close();
}
}
@@ -762,7 +769,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
method: "sortTabs"
});
window.close();
} catch (e) {
} catch {
window.close();
}
});
@@ -851,7 +858,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {
} catch {
window.close();
}
});
@@ -862,7 +869,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {
} catch {
window.close();
}
});
@@ -912,7 +919,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
incompatible = await browser.runtime.sendMessage({
method: "checkIncompatibleAddons"
});
} catch (e) {
} catch {
throw new Error("Could not check for incompatible add-ons.");
}
@@ -947,7 +954,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {
} catch {
window.close();
}
});
@@ -1009,7 +1016,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
cookieStoreId: Logic.currentCookieStoreId()
});
window.close();
} catch (e) {
} catch {
window.close();
}
});
@@ -1086,7 +1093,7 @@ Logic.registerPanel(OPEN_NEW_CONTAINER_PICKER, {
cookieStoreId: identity.cookieStoreId
});
window.close();
} catch (e) {
} catch {
window.close();
}
};
@@ -1848,7 +1855,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
});
await Logic.refreshIdentities();
Logic.showPreviousPanel();
} catch (e) {
} catch {
Logic.showPreviousPanel();
}
},
@@ -2339,7 +2346,7 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
await Logic.removeIdentity(Utils.userContextId(Logic.currentIdentity().cookieStoreId));
await Logic.refreshIdentities();
Logic.showPreviousPanel();
} catch (e) {
} catch {
Logic.showPreviousPanel();
}
});
+5 -2
View File
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Firefox Multi-Account Containers",
"version": "8.3.0",
"version": "8.3.5",
"incognito": "not_allowed",
"description": "__MSG_extensionDescription__",
"icons": {
@@ -33,7 +33,10 @@
"browser_specific_settings": {
"gecko": {
"id": "@testpilot-containers",
"strict_min_version": "91.1.0"
"strict_min_version": "91.1.0",
"data_collection_permissions": {
"required": ["none"]
}
}
},
"commands": {
-12
View File
@@ -1,12 +0,0 @@
module.exports = {
env: {
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-restricted-globals": ["error", "browser"]
}
};
-1
View File
@@ -1,5 +1,4 @@
if (!process.listenerCount("unhandledRejection")) {
// eslint-disable-next-line no-console
process.on("unhandledRejection", r => console.log(r));
}