diff --git a/.jpmignore b/.jpmignore index 0fc6d0e..100666b 100644 --- a/.jpmignore +++ b/.jpmignore @@ -5,12 +5,13 @@ node_modules/ .env .eslintrc.js +.eslintignore .gitignore .htmllintrc .jpmignore .stylelintrc .travis.yml -testpilot-containers.xpi +*.xpi .vimrc .DS_Store .gdb_history diff --git a/README.md b/README.md index f0194d6..7c8b6a8 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,20 @@ The only way to run the experiment is using an [unbranded version build](https:/ Check out the [Browser Toolbox](https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox) for more information about debugging add-on code. +### Building .xpi + +To build a local .xpi, use the plain [`jpm +xpi`](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#jpm_xpi) command. + +### Signing an .xpi + +To sign an .xpi, use [`jpm +sign`](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#jpm_sign) +command. + +Note: You will need to be [an author on the AMO +add-on](https://addons.mozilla.org/en-US/developers/addon/containers-experiment/ownership). + ### Testing TBD diff --git a/data/usercontext.css b/data/usercontext.css index a16c07e..8e24f9a 100644 --- a/data/usercontext.css +++ b/data/usercontext.css @@ -52,25 +52,21 @@ value, or chrome url path as an alternate selector mitiages this bug.*/ [data-identity-icon="fingerprint"], [data-identity-icon="chrome://browser/skin/usercontext/personal.svg"] { - /*--identity-icon: url("chrome://browser/content/usercontext.svg#fingerprint"); */ --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#fingerprint"); } [data-identity-icon="briefcase"], [data-identity-icon="chrome://browser/skin/usercontext/work.svg"] { - /* --identity-icon: url("chrome://browser/content/usercontext.svg#briefcase"); */ --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#briefcase"); } [data-identity-icon="dollar"], [data-identity-icon="chrome://browser/skin/usercontext/banking.svg"] { - /* --identity-icon: url("chrome://browser/content/usercontext.svg#dollar"); */ --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#dollar"); } [data-identity-icon="cart"], [data-identity-icon="chrome://browser/skin/usercontext/cart.svg"] { - /* --identity-icon: url("chrome://browser/content/usercontext.svg#cart"); */ --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#cart"); } @@ -90,8 +86,25 @@ value, or chrome url path as an alternate selector mitiages this bug.*/ --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#food"); } +[data-identity-icon="fruit"] { + --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#fruit"); +} + +[data-identity-icon="pet"] { + --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#pet"); +} + +[data-identity-icon="tree"] { + --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#tree"); +} + +[data-identity-icon="chill"] { + --identity-icon: url("resource://testpilot-containers/data/usercontext.svg#chill"); +} + #userContext-indicator { height: 16px; + list-style-image: none !important; width: 16px; } diff --git a/data/usercontext.svg b/data/usercontext.svg index 0b53f91..f58067a 100644 --- a/data/usercontext.svg +++ b/data/usercontext.svg @@ -23,10 +23,7 @@ - + + + + + diff --git a/index.js b/index.js index f01122f..228edd7 100644 --- a/index.js +++ b/index.js @@ -27,6 +27,10 @@ const IDENTITY_ICONS = [ { name: "gift", image: "gift" }, { name: "vacation", image: "vacation" }, { name: "food", image: "food" }, + { name: "fruit", image: "fruit" }, + { name: "pet", image: "pet" }, + { name: "tree", image: "tree" }, + { name: "chill", image: "chill" }, { name: "circle", image: "circle" }, // this doesn't exist in m-b ]; @@ -108,7 +112,7 @@ const ContainerService = { // need to implement a migration in the future. if (installation) { let preInstalledIdentities = []; // eslint-disable-line prefer-const - ContextualIdentityService.getIdentities().forEach(identity => { + ContextualIdentityProxy.getIdentities().forEach(identity => { preInstalledIdentities.push(identity.userContextId); }); @@ -127,12 +131,12 @@ const ContainerService = { // Maybe rename the Banking container. if (prefService.get("privacy.userContext.enabled") !== true) { - const identity = ContextualIdentityService.getIdentityFromId(3); + const identity = ContextualIdentityProxy.getIdentityFromId(3); if (identity && identity.l10nID === "userContextBanking.label") { - ContextualIdentityService.update(identity.userContextId, - "Finance", - identity.icon, - identity.color); + ContextualIdentityProxy.update(identity.userContextId, + "Finance", + identity.icon, + identity.color); } } } @@ -234,7 +238,7 @@ const ContainerService = { }).sendEvent; // Begin-Of-Hack - function workaroundForCookieManager(method, userContextId) { + ContextualIdentityService.workaroundForCookieManager = function(method, userContextId) { let identity = method.call(ContextualIdentityService, userContextId); if (!identity && userContextId) { identity = { @@ -243,22 +247,22 @@ const ContainerService = { color: "", name: "Pending to be deleted", public: true, - } + }; } return identity; - } + }; - let oldGetIdentityFromId = ContextualIdentityService.getIdentityFromId; + this._oldGetIdentityFromId = ContextualIdentityService.getIdentityFromId; ContextualIdentityService.getIdentityFromId = function(userContextId) { - return workaroundForCookieManager(oldGetIdentityFromId, userContextId); - } + return this.workaroundForCookieManager(ContainerService._oldGetIdentityFromId, userContextId); + }; if ("getPublicIdentityFromId" in ContextualIdentityService) { - let oldGetPublicIdentityFromId = ContextualIdentityService.getIdentityFromId; - ContextualIdentityService.getIdentityFromId = function(userContextId) { - return workaroundForCookieManager(oldGetPublicIdentityFromId, userContextId); - } + this._oldGetPublicIdentityFromId = ContextualIdentityService.getPublicIdentityFromId; + ContextualIdentityService.getPublicIdentityFromId = function(userContextId) { + return this.workaroundForCookieManager(ContainerService._oldGetPublicIdentityFromId, userContextId); + }; } // End-Of-Hack }, @@ -983,14 +987,24 @@ const ContainerService = { this._forgetIdentity(); const preInstalledIdentities = data.preInstalledIdentities; - ContextualIdentityService.getIdentities().forEach(identity => { + ContextualIdentityProxy.getIdentities().forEach(identity => { if (!preInstalledIdentities.includes(identity.userContextId)) { - ContextualIdentityService.remove(identity.userContextId); + ContextualIdentityProxy.remove(identity.userContextId); } }); // Let's delete the configuration. delete ss.storage.savedConfiguration; + + // Begin-Of-Hack + if (this._oldGetIdentityFromId) { + ContextualIdentityService.getIdentityFromId = this._oldGetIdentityFromId; + } + + if (this._oldGetPublicIdentityFromId) { + ContextualIdentityService.getPublicIdentityFromId = this._oldGetPublicIdentityFromId; + } + // End-Of-Hack }, _forgetIdentity(userContextId = 0) { diff --git a/package.json b/package.json index f31fd2a..be534ae 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "testpilot-containers", "title": "Containers Experiment", "description": "Containers works by isolating cookie jars using separate origin-attributes defined visually by colored ‘Container Tabs’. This add-on is a modified version of the containers feature for Firefox Test Pilot.", - "version": "0.9.0", + "version": "0.9.2", "author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston", "bugs": { "url": "https://github.com/mozilla/testpilot-containers/issues" @@ -44,5 +44,6 @@ "lint:html": "htmllint webextension/*.html", "lint:js": "eslint .", "test": "npm run lint" - } + }, + "updateURL": "https://testpilot.firefox.com/files/@testpilot-containers/updates.json" } diff --git a/webextension/css/popup.css b/webextension/css/popup.css index cdb0a99..3b0498b 100644 --- a/webextension/css/popup.css +++ b/webextension/css/popup.css @@ -37,18 +37,18 @@ table { /* Color and icon helpers */ [data-identity-color="blue"] { - --identity-tab-color: #0996f8; - --identity-icon-color: #00a7e0; + --identity-tab-color: #37adff; + --identity-icon-color: #37adff; } [data-identity-color="turquoise"] { - --identity-tab-color: #01bdad; - --identity-icon-color: #01bdad; + --identity-tab-color: #00c79a; + --identity-icon-color: #00c79a; } [data-identity-color="green"] { - --identity-tab-color: #57bd35; - --identity-icon-color: #7dc14c; + --identity-tab-color: #51cd00; + --identity-icon-color: #51cd00; } [data-identity-color="yellow"] { @@ -57,23 +57,23 @@ table { } [data-identity-color="orange"] { - --identity-tab-color: #ff9216; - --identity-icon-color: #ff9216; + --identity-tab-color: #ff9f00; + --identity-icon-color: #ff9f00; } [data-identity-color="red"] { - --identity-tab-color: #d92215; - --identity-icon-color: #d92215; + --identity-tab-color: #ff613d; + --identity-icon-color: #ff613d; } [data-identity-color="pink"] { - --identity-tab-color: #ea385e; - --identity-icon-color: #ee5195; + --identity-tab-color: #ff4bda; + --identity-icon-color: #ff4bda; } [data-identity-color="purple"] { - --identity-tab-color: #7a2f7a; - --identity-icon-color: #7a2f7a; + --identity-tab-color: #af51f5; + --identity-icon-color: #af51f5; } [data-identity-icon="fingerprint"] { @@ -108,6 +108,22 @@ table { --identity-icon: url("/img/usercontext.svg#vacation"); } +[data-identity-icon="fruit"] { + --identity-icon: url("/img/usercontext.svg#fruit"); +} + +[data-identity-icon="pet"] { + --identity-icon: url("/img/usercontext.svg#pet"); +} + +[data-identity-icon="tree"] { + --identity-icon: url("/img/usercontext.svg#tree"); +} + +[data-identity-icon="chill"] { + --identity-icon: url("/img/usercontext.svg#chill"); +} + /* Buttons */ .button.primary { background-color: #0996f8; @@ -520,6 +536,11 @@ span ~ .panel-header-text { opacity: 0 !important; } +.edit-container-panel [type="radio"] { + display: inline; + opacity: 0; +} + .edit-container-panel [type="radio"]:checked + label { outline: 2px solid grey; -moz-outline-radius: 50px; diff --git a/webextension/img/usercontext.svg b/webextension/img/usercontext.svg index 0b53f91..f58067a 100644 --- a/webextension/img/usercontext.svg +++ b/webextension/img/usercontext.svg @@ -23,10 +23,7 @@ - + + + + + diff --git a/webextension/js/popup.js b/webextension/js/popup.js index 5264f71..b8f982c 100644 --- a/webextension/js/popup.js +++ b/webextension/js/popup.js @@ -494,7 +494,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, { return `