diff --git a/README.md b/README.md index 7574cf0..92aec9c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,15 @@ For more info, see: 2. `./node_modules/.bin/web-ext run -s src/` ### Testing -TBD +`npm run test` + +or + +`npm run lint` + +for just the linter + +There is a timeout test that sometimes fails on certain machines, so make sure to run the tests on your clone before you make any changes to see if you have this problem. ### Distributing #### Make the new version diff --git a/package.json b/package.json index 172a4f5..b72d3d5 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ }, "dependencies": {}, "devDependencies": { - "ajv": "^6.6.2", "addons-linter": "^1.3.2", + "ajv": "^6.6.2", "chai": "^4.1.2", "eslint": "^3.17.1", "eslint-plugin-no-unsanitized": "^2.0.0", @@ -25,7 +25,7 @@ "stylelint": "^7.9.0", "stylelint-config-standard": "^16.0.0", "stylelint-order": "^0.3.0", - "web-ext": "^2.2.2" + "web-ext": "^2.9.3" }, "homepage": "https://github.com/mozilla/multi-account-containers#readme", "license": "MPL-2.0", diff --git a/src/css/confirm-page.css b/src/css/confirm-page.css index e00eb1c..113ffef 100644 --- a/src/css/confirm-page.css +++ b/src/css/confirm-page.css @@ -60,6 +60,7 @@ html { @media (prefers-color-scheme: dark) { #redirect-url { background: #38383d; /* Grey 70 */ + color: #eee; /* White 20 */ } } /* stylelint-enable */ diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index dc9e991..83acd4b 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -143,7 +143,6 @@ const assignManager = { const userContextId = this.getUserContextIdFromCookieStore(tab); if (!siteSettings || userContextId === siteSettings.userContextId - || tab.incognito || this.storageArea.isExempted(options.url, tab.id)) { return {}; } @@ -289,11 +288,9 @@ const assignManager = { isTabPermittedAssign(tab) { // Ensure we are not an important about url - // Ensure we are not in incognito mode const url = new URL(tab.url); if (url.protocol === "about:" - || url.protocol === "moz-extension:" - || tab.incognito) { + || url.protocol === "moz-extension:") { return false; } return true; diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 52d61a2..ee1bd22 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -55,6 +55,7 @@ const backgroundLogic = { let url = options.url || undefined; const userContextId = ("userContextId" in options) ? options.userContextId : 0; const active = ("nofocus" in options) ? options.nofocus : true; + const discarded = ("noload" in options) ? options.noload : false; const cookieStoreId = backgroundLogic.cookieStoreId(userContextId); // Autofocus url bar will happen in 54: https://bugzilla.mozilla.org/show_bug.cgi?id=1295072 @@ -71,6 +72,7 @@ const backgroundLogic = { return browser.tabs.create({ url, active, + discarded, pinned: options.pinned || false, cookieStoreId }); @@ -313,6 +315,7 @@ const backgroundLogic = { userContextId: userContextId, url: object.url, nofocus: options.nofocus || false, + noload: true, pinned: object.pinned, })); } diff --git a/src/js/background/badge.js b/src/js/background/badge.js index 78cd9f1..7d532ac 100644 --- a/src/js/background/badge.js +++ b/src/js/background/badge.js @@ -2,22 +2,17 @@ const MAJOR_VERSIONS = ["2.3.0", "2.4.0"]; const badge = { async init() { const currentWindow = await browser.windows.getCurrent(); - this.displayBrowserActionBadge(currentWindow.incognito); - }, - - disableAddon(tabId) { - browser.browserAction.disable(tabId); - browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" }); + this.displayBrowserActionBadge(currentWindow); }, async displayBrowserActionBadge() { const extensionInfo = await backgroundLogic.getExtensionInfo(); - const storage = await browser.storage.local.get({browserActionBadgesClicked: []}); + const storage = await browser.storage.local.get({ browserActionBadgesClicked: [] }); if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 && - storage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) { - browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"}); - browser.browserAction.setBadgeText({text: "NEW"}); + storage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) { + browser.browserAction.setBadgeBackgroundColor({ color: "rgba(0,217,0,255)" }); + browser.browserAction.setBadgeText({ text: "NEW" }); } } }; diff --git a/src/js/background/messageHandler.js b/src/js/background/messageHandler.js index 9fbe88e..046d163 100644 --- a/src/js/background/messageHandler.js +++ b/src/js/background/messageHandler.js @@ -141,9 +141,6 @@ const messageHandler = { }, {urls: [""], types: ["main_frame"]}); browser.tabs.onCreated.addListener((tab) => { - if (tab.incognito) { - badge.disableAddon(tab.id); - } // lets remember the last tab created so we can close it if it looks like a redirect this.lastCreatedTab = tab; if (tab.cookieStoreId) { diff --git a/src/js/confirm-page.js b/src/js/confirm-page.js index 9f6eb77..8a14a7b 100644 --- a/src/js/confirm-page.js +++ b/src/js/confirm-page.js @@ -1,6 +1,6 @@ async function load() { const searchParams = new URL(window.location).searchParams; - const redirectUrl = decodeURIComponent(searchParams.get("url")); + const redirectUrl = searchParams.get("url"); const cookieStoreId = searchParams.get("cookieStoreId"); const currentCookieStoreId = searchParams.get("currentCookieStoreId"); const redirectUrlElement = document.getElementById("redirect-url"); diff --git a/src/js/popup.js b/src/js/popup.js index c24d519..37aa8e4 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -657,11 +657,10 @@ Logic.registerPanel(P_CONTAINERS_LIST, { tr.classList.add("container-panel-row"); - context.classList.add("userContext-wrapper", "open-newtab", "clickable"); + context.classList.add("userContext-wrapper", "open-newtab", "clickable", "firstTabindex"); manage.classList.add("show-tabs", "pop-button"); manage.setAttribute("title", `View ${identity.name} container`); context.setAttribute("tabindex", "0"); - context.classList.add("firstTabindex"); context.setAttribute("title", `Create ${identity.name} tab`); context.innerHTML = escaped`
diff --git a/src/manifest.json b/src/manifest.json index bab033b..26d2dd8 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,22 +2,19 @@ "manifest_version": 2, "name": "Firefox Multi-Account Containers", "version": "6.1.1", - + "incognito": "not_allowed", "description": "Multi-Account 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.", "icons": { "48": "img/container-site-d-48.png", "96": "img/container-site-d-96.png" }, - "applications": { "gecko": { "id": "@testpilot-containers", - "strict_min_version": "57.0" + "strict_min_version": "67.0" } }, - "homepage_url": "https://github.com/mozilla/multi-account-containers#readme", - "permissions": [ "", "activeTab", @@ -32,7 +29,6 @@ "webRequestBlocking", "webRequest" ], - "commands": { "_execute_browser_action": { "suggested_key": { @@ -42,33 +38,37 @@ "description": "Open containers panel" } }, - "browser_action": { "browser_style": true, "default_icon": "img/container-site.svg", "default_title": "Multi-Account Containers", "default_popup": "popup.html", - "theme_icons": [{ + "theme_icons": [ + { "light": "img/container-site-light.svg", "dark": "img/container-site.svg", "size": 32 - }] + } + ] }, - "background": { "page": "js/background/index.html" }, - "content_scripts": [ { - "matches": [""], - "js": ["js/content-script.js"], - "css": ["css/content.css"], + "matches": [ + "" + ], + "js": [ + "js/content-script.js" + ], + "css": [ + "css/content.css" + ], "run_at": "document_start" } ], - "web_accessible_resources": [ "/img/container-site-d-24.png" ] -} +} \ No newline at end of file