Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31ac365e6d | |||
| df8471a4dd | |||
| 18539f2540 | |||
| 7c1105a2b7 | |||
| 31298146f3 | |||
| 4e6eee220c | |||
| a7be3c9935 | |||
| f512473986 | |||
| 8166a37722 | |||
| adadb98482 | |||
| 25e760cd64 | |||
| 0ff8e17005 | |||
| c433c6b39e | |||
| 1c09c29104 | |||
| c1e9cc3c56 | |||
| 27296d24c5 | |||
| 030e635417 | |||
| 07711aaecc | |||
| 16ed8992e2 | |||
| 88e6dc7a05 | |||
| 28e8d46743 | |||
| 77ba1b723f | |||
| b0cc6e7c2f | |||
| e84e482130 | |||
| b5ae20b874 | |||
| 3ec81e3d1f | |||
| fb5436c287 | |||
| 01a628822b | |||
| 66e2c8e297 | |||
| 80661d68f2 | |||
| ef8aa3be75 | |||
| 6bc056e019 | |||
| 75deab139b | |||
| ae79f0a303 | |||
| 9b83068234 | |||
| fec2be9429 | |||
| 9f1b06ddd3 | |||
| ad2198e8b5 | |||
| 1791fdf0ef | |||
| 4ab705081e | |||
| 15b9dce1a9 | |||
| da3fc2ede2 | |||
| 385c585888 | |||
| 734b97beb0 | |||
| 3aa311a3c1 | |||
| df7d7f9c38 | |||
| 65be77665a | |||
| 44548659db | |||
| 10c4395efd | |||
| 27b2a4b5f2 | |||
| 6f54e7ff7f | |||
| cb6726b667 | |||
| 0964311fa1 | |||
| 2831d019f5 | |||
| 1cc58cad9b | |||
| bc9660f76e | |||
| f526caca50 | |||
| b6a98fb83e | |||
| af2b4b79a9 | |||
| a762b5eca2 | |||
| 3cc40344af | |||
| 278cdb7f69 | |||
| 0be03ebeb7 | |||
| c69f37a2de | |||
| b20ac8169a | |||
| 9e98d35b45 | |||
| 17f2781e07 | |||
| 0acf9cc0e6 | |||
| 70573d0559 | |||
| da239237f7 |
@@ -8,3 +8,5 @@ README.html
|
||||
.vimrc
|
||||
.env
|
||||
addon.env
|
||||
|
||||
webextension/web-ext-artifacts/*
|
||||
|
||||
@@ -3,6 +3,7 @@ docs/
|
||||
test/
|
||||
.npm/
|
||||
node_modules/
|
||||
bin/
|
||||
|
||||
.env
|
||||
.eslintrc.js
|
||||
@@ -14,6 +15,7 @@ node_modules/
|
||||
.stylelintrc
|
||||
.travis.yml
|
||||
*.xpi
|
||||
*.md
|
||||
.vimrc
|
||||
.DS_Store
|
||||
.gdb_history
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Containers Add-on
|
||||
# Multi-Account Containers
|
||||
|
||||
[](https://testpilot.firefox.com/experiments/containers)
|
||||
|
||||
[Embedded Web Extension](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Embedded_WebExtensions) to build [Containers](https://blog.mozilla.org/tanvi/2016/06/16/contextual-identities-on-the-web/) as a Firefox [Test Pilot](https://testpilot.firefox.com/) Experiment and [Shield Study](https://wiki.mozilla.org/Firefox/Shield/Shield_Studies) to learn:
|
||||
The Firefox Multi-Account Containers extension lets you carve out a separate box for each of your online lives – no more opening a different browser just to check your work email! [Learn More Here](https://blog.mozilla.org/firefox/introducing-firefox-multi-account-containers/)
|
||||
|
||||
* Will a general Firefox audience understand the Containers feature?
|
||||
* Is the UI as currently implemented in Nightly clear or discoverable?
|
||||
[Available on addons.mozilla.org](https://addons.mozilla.org/en-GB/firefox/addon/multi-account-containers/)
|
||||
|
||||
**Note:** Firefox 57 + 58 users should Install from our [latest GitHub Release](https://github.com/mozilla/testpilot-containers/releases/latest)
|
||||
|
||||
For more info, see:
|
||||
|
||||
@@ -20,6 +20,19 @@ For more info, see:
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
### Web Extension Development
|
||||
|
||||
Since Firefox 57, this extension can now be run without any of the legacy components that were previously needed.
|
||||
|
||||
1. Install web-ext with npm
|
||||
2. cd webextension; web-ext run -f Nightly
|
||||
|
||||
This will work in other builds of Firefox however certain features won't work and you will need to manually flip preferences to enable containers. All other sections of this guide talk about using the legacy setup with jpm.
|
||||
|
||||
|
||||
## Legacy Development
|
||||
|
||||
### Development Environment
|
||||
|
||||
Add-on development is better with [a particular environment](https://developer.mozilla.org/en-US/Add-ons/Setting_up_extension_development_environment). One simple way to get that environment set up is to install the [DevPrefs add-on](https://addons.mozilla.org/en-US/firefox/addon/devprefs/). You can make a custom Firefox profile that includes the DevPrefs add-on, and use that profile when you run the code in this repository.
|
||||
@@ -44,7 +57,6 @@ Release & Beta channels do not allow un-signed add-ons, even with the DevPrefs.
|
||||
|
||||
Whilst this is still using legacy code to test you will need the following in your profile:
|
||||
|
||||
|
||||
Change the following prefs in about:config:
|
||||
|
||||
- extensions.legacy.enabled = true
|
||||
@@ -66,23 +78,44 @@ To build a local testpilot-containers.xpi, use the plain [`jpm
|
||||
xpi`](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#jpm_xpi) command,
|
||||
or run `npm run build`.
|
||||
|
||||
### 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
|
||||
|
||||
### Distributing
|
||||
TBD
|
||||
#### Make the new version
|
||||
|
||||
1. Bump the version number in `package.json`, `install.rdf`, and
|
||||
`manifest.json`
|
||||
2. Commit the version number bump
|
||||
3. Create a git tag for the version: `git tag <version>`
|
||||
4. Push the tag up to GitHub: `git push --tags`
|
||||
|
||||
#### Publish to AMO
|
||||
While the add-on is an Embedded Web Extension, we have to use the [Mozilla
|
||||
Internal Signing
|
||||
Service](https://mana.mozilla.org/wiki/display/FIREFOX/Internal+Extension+Signing)
|
||||
to sign it as a Mozilla extension exempt from AMO's Web Extension restrictions.
|
||||
|
||||
So, to distribute the add-on to AMO:
|
||||
|
||||
1. Use `jpm xpi` to build the `.xpi` file
|
||||
2. [Submit the `.xpi` to the Internal Signing Service and download the signed `.xpi`](https://mana.mozilla.org/wiki/display/SVCOPS/Sign+a+Mozilla+Internal+Extension)
|
||||
3. [Upload the signed `.xpi` file to
|
||||
AMO](https://addons.mozilla.org/en-US/developers/addon/multi-account-containers/versions/submit/)
|
||||
|
||||
#### Publish to GitHub
|
||||
Finally, we also publish the release to GitHub for those followers.
|
||||
|
||||
1. [Make the new release on
|
||||
GitHub](https://github.com/mozilla/multi-account-containers/releases/new)
|
||||
* Use the version number for "Tag version" and "Release title"
|
||||
* Release notes: copy the output of `git log --no-merges --pretty=format:"%h %s" <previous-version>..<new-version>`
|
||||
* Attach binaries: select the signed `.xpi` file
|
||||
|
||||
### Links
|
||||
|
||||
Facebook & Twitter icons CC-Attrib http://fairheadcreative.com.
|
||||
|
||||
- [Licence](./LICENSE.txt)
|
||||
- [Contributing](./CONTRIBUTING.md)
|
||||
- [Code Of Conduct](./CODE_OF_CONDUCT.md)
|
||||
|
||||
Vendored
+92
-25
@@ -4,29 +4,34 @@ const PREFS = [
|
||||
{
|
||||
name: "privacy.userContext.enabled",
|
||||
value: true,
|
||||
type: "bool"
|
||||
type: "bool",
|
||||
default: false
|
||||
},
|
||||
{
|
||||
name: "privacy.userContext.longPressBehavior",
|
||||
value: 2,
|
||||
type: "int"
|
||||
type: "int",
|
||||
default: 0
|
||||
},
|
||||
{
|
||||
name: "privacy.userContext.ui.enabled",
|
||||
value: true, // Post web ext we will be setting this true
|
||||
type: "bool"
|
||||
type: "bool",
|
||||
default: true
|
||||
},
|
||||
{
|
||||
name: "privacy.usercontext.about_newtab_segregation.enabled",
|
||||
value: true,
|
||||
type: "bool"
|
||||
type: "bool",
|
||||
default: false
|
||||
},
|
||||
];
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
const { TextDecoder, TextEncoder } = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
|
||||
Cu.importGlobalProperties(["TextEncoder", "TextDecoder"]);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
"resource://gre/modules/osfile.jsm");
|
||||
@@ -34,6 +39,28 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
const JETPACK_DIR_BASENAME = "jetpack";
|
||||
const EXTENSION_ID = "@testpilot-containers";
|
||||
|
||||
function loadStyles(resourceURI) {
|
||||
const styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
|
||||
.getService(Ci.nsIStyleSheetService);
|
||||
const styleURI = styleSheet(resourceURI);
|
||||
const sheetType = styleSheetService.AGENT_SHEET;
|
||||
styleSheetService.loadAndRegisterSheet(styleURI, sheetType);
|
||||
}
|
||||
|
||||
function styleSheet(resourceURI) {
|
||||
return Services.io.newURI("data/usercontext.css", null, resourceURI);
|
||||
}
|
||||
|
||||
function unloadStyles(resourceURI) {
|
||||
const styleURI = styleSheet(resourceURI);
|
||||
const styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
|
||||
.getService(Ci.nsIStyleSheetService);
|
||||
const sheetType = styleSheetService.AGENT_SHEET;
|
||||
if (styleSheetService.sheetRegistered(styleURI, sheetType)) {
|
||||
styleSheetService.unregisterSheet(styleURI, sheetType);
|
||||
}
|
||||
}
|
||||
|
||||
function filename() {
|
||||
const storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
storeFile.append(JETPACK_DIR_BASENAME);
|
||||
@@ -43,14 +70,27 @@ function filename() {
|
||||
return storeFile.path;
|
||||
}
|
||||
|
||||
async function makeFilepath() {
|
||||
const storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
storeFile.append(JETPACK_DIR_BASENAME);
|
||||
await OS.File.makeDir(storeFile.path, { ignoreExisting: true });
|
||||
storeFile.append(EXTENSION_ID);
|
||||
await OS.File.makeDir(storeFile.path, { ignoreExisting: true });
|
||||
storeFile.append("simple-storage");
|
||||
await OS.File.makeDir(storeFile.path, { ignoreExisting: true });
|
||||
}
|
||||
|
||||
async function getConfig() {
|
||||
let savedConfig = {savedConfiguration: {}};
|
||||
try {
|
||||
const bytes = await OS.File.read(filename());
|
||||
const raw = new TextDecoder().decode(bytes) || "";
|
||||
let savedConfig = {savedConfiguration: {}};
|
||||
if (raw) {
|
||||
savedConfig = JSON.parse(raw);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// ignore file read errors, sometimes they happen and I'm not sure if we can fix
|
||||
}
|
||||
return savedConfig;
|
||||
}
|
||||
|
||||
@@ -61,14 +101,15 @@ async function initConfig() {
|
||||
savedConfig.savedConfiguration.prefs = {};
|
||||
PREFS.forEach((pref) => {
|
||||
if ("int" === pref.type) {
|
||||
savedConfig.savedConfiguration.prefs[pref.name] = Services.prefs.getIntPref(pref.name, pref.name);
|
||||
savedConfig.savedConfiguration.prefs[pref.name] = Services.prefs.getIntPref(pref.name);
|
||||
} else {
|
||||
savedConfig.savedConfiguration.prefs[pref.name] = Services.prefs.getBoolPref(pref.name, pref.value);
|
||||
savedConfig.savedConfiguration.prefs[pref.name] = Services.prefs.getBoolPref(pref.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
const serialized = JSON.stringify(savedConfig);
|
||||
const bytes = new TextEncoder().encode(serialized) || "";
|
||||
await makeFilepath();
|
||||
await OS.File.writeAtomic(filename(), bytes, { });
|
||||
}
|
||||
|
||||
@@ -89,32 +130,58 @@ async function install() {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async function uninstall(aData, aReason) {
|
||||
if (aReason === ADDON_UNINSTALL
|
||||
|| aReason === ADDON_DISABLE) {
|
||||
const config = await getConfig();
|
||||
const storedPrefs = config.savedConfiguration.prefs;
|
||||
PREFS.forEach((pref) => {
|
||||
if (pref.name in storedPrefs) {
|
||||
if ("int" === pref.type) {
|
||||
Services.prefs.setIntPref(pref.name, storedPrefs[pref.name]);
|
||||
} else {
|
||||
Services.prefs.setBoolPref(pref.name, storedPrefs[pref.name]);
|
||||
async function uninstall({resourceURI}, aReason) {
|
||||
if (checkLegacyFirefox()) {
|
||||
if (aReason === ADDON_UNINSTALL) {
|
||||
unloadStyles(resourceURI);
|
||||
await removeChanges();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function removeChanges() {
|
||||
const config = await getConfig();
|
||||
const storedPrefs = config.savedConfiguration.prefs || {};
|
||||
PREFS.forEach((pref) => {
|
||||
let value = pref.default;
|
||||
if (pref.name in storedPrefs) {
|
||||
value = storedPrefs[pref.name];
|
||||
}
|
||||
if ("int" === pref.type) {
|
||||
Services.prefs.setIntPref(pref.name, value);
|
||||
} else {
|
||||
Services.prefs.setBoolPref(pref.name, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkLegacyFirefox() {
|
||||
const version = Services.appinfo.version;
|
||||
const versionMatch = version.match(/^([0-9]+)\./)[1];
|
||||
if (Number(versionMatch) <= 56) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function startup({webExtension}) {
|
||||
function startup({webExtension, resourceURI}) {
|
||||
if (checkLegacyFirefox()) {
|
||||
loadStyles(resourceURI);
|
||||
// Reset prefs that may have changed, or are legacy
|
||||
setPrefs();
|
||||
install();
|
||||
}
|
||||
// Start the embedded webextension.
|
||||
webExtension.startup();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function shutdown() {
|
||||
function shutdown({resourceURI}, aReason) {
|
||||
if (checkLegacyFirefox()) {
|
||||
unloadStyles(resourceURI);
|
||||
if (aReason === ADDON_DISABLE) {
|
||||
removeChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +1,3 @@
|
||||
/* HACK: Custom Container vars do not propigate correctly
|
||||
until the container tab is blurred and refocused,
|
||||
adding the data-identity-color with the default hex
|
||||
value, or chrome url path as an alternate selector mitiages this bug.*/
|
||||
[data-identity-color="blue"],
|
||||
[data-identity-color="#00a7e0"] {
|
||||
--identity-tab-color: #37adff;
|
||||
--identity-icon-color: #37adff;
|
||||
}
|
||||
|
||||
[data-identity-color="turquoise"],
|
||||
[data-identity-color="#01bdad"] {
|
||||
--identity-tab-color: #00c79a;
|
||||
--identity-icon-color: #00c79a;
|
||||
}
|
||||
|
||||
[data-identity-color="green"],
|
||||
[data-identity-color="#7dc14c"] {
|
||||
--identity-tab-color: #51cd00;
|
||||
--identity-icon-color: #51cd00;
|
||||
}
|
||||
|
||||
[data-identity-color="yellow"],
|
||||
[data-identity-color="#ffcb00"] {
|
||||
--identity-tab-color: #ffcb00;
|
||||
--identity-icon-color: #ffcb00;
|
||||
}
|
||||
|
||||
[data-identity-color="orange"],
|
||||
[data-identity-color="#f89c24"] {
|
||||
--identity-tab-color: #ff9f00;
|
||||
--identity-icon-color: #ff9f00;
|
||||
}
|
||||
|
||||
[data-identity-color="red"],
|
||||
[data-identity-color="#d92215"] {
|
||||
--identity-tab-color: #ff613d;
|
||||
--identity-icon-color: #ff613d;
|
||||
}
|
||||
|
||||
[data-identity-color="pink"],
|
||||
[data-identity-color="#ee5195"] {
|
||||
--identity-tab-color: #ff4bda;
|
||||
--identity-icon-color: #ff4bda;
|
||||
}
|
||||
|
||||
[data-identity-color="purple"],
|
||||
[data-identity-color="#7a2f7a"] {
|
||||
--identity-tab-color: #af51f5;
|
||||
--identity-icon-color: #af51f5;
|
||||
}
|
||||
|
||||
[data-identity-icon="fingerprint"],
|
||||
[data-identity-icon="chrome://browser/skin/usercontext/personal.svg"] {
|
||||
--identity-icon: url("/data/usercontext.svg#fingerprint");
|
||||
}
|
||||
|
||||
[data-identity-icon="briefcase"],
|
||||
[data-identity-icon="chrome://browser/skin/usercontext/work.svg"] {
|
||||
--identity-icon: url("/data/usercontext.svg#briefcase");
|
||||
}
|
||||
|
||||
[data-identity-icon="dollar"],
|
||||
[data-identity-icon="chrome://browser/skin/usercontext/banking.svg"] {
|
||||
--identity-icon: url("/data/usercontext.svg#dollar");
|
||||
}
|
||||
|
||||
[data-identity-icon="cart"],
|
||||
[data-identity-icon="chrome://browser/skin/usercontext/cart.svg"],
|
||||
[data-identity-icon="chrome://browser/skin/usercontext/shopping.svg"] {
|
||||
--identity-icon: url("/data/usercontext.svg#cart");
|
||||
}
|
||||
|
||||
[data-identity-icon="circle"] {
|
||||
--identity-icon: url("/data/usercontext.svg#circle");
|
||||
}
|
||||
|
||||
[data-identity-icon="gift"] {
|
||||
--identity-icon: url("/data/usercontext.svg#gift");
|
||||
}
|
||||
|
||||
[data-identity-icon="vacation"] {
|
||||
--identity-icon: url("/data/usercontext.svg#vacation");
|
||||
}
|
||||
|
||||
[data-identity-icon="food"] {
|
||||
--identity-icon: url("/data/usercontext.svg#food");
|
||||
}
|
||||
|
||||
[data-identity-icon="fruit"] {
|
||||
--identity-icon: url("/data/usercontext.svg#fruit");
|
||||
}
|
||||
|
||||
[data-identity-icon="pet"] {
|
||||
--identity-icon: url("/data/usercontext.svg#pet");
|
||||
}
|
||||
|
||||
[data-identity-icon="tree"] {
|
||||
--identity-icon: url("/data/usercontext.svg#tree");
|
||||
}
|
||||
|
||||
[data-identity-icon="chill"] {
|
||||
--identity-icon: url("/data/usercontext.svg#chill");
|
||||
}
|
||||
|
||||
#userContext-indicator {
|
||||
height: 16px;
|
||||
list-style-image: none !important;
|
||||
@@ -129,19 +24,6 @@ value, or chrome url path as an alternate selector mitiages this bug.*/
|
||||
display: none;
|
||||
}
|
||||
|
||||
.userContext-icon,
|
||||
.menuitem-iconic[data-usercontextid] > .menu-iconic-left > .menu-iconic-icon,
|
||||
.subviewbutton[usercontextid] > .toolbarbutton-icon,
|
||||
#userContext-indicator {
|
||||
background-image: var(--identity-icon) !important;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
fill: var(--identity-icon-color) !important;
|
||||
filter: url(/img/filters.svg#fill);
|
||||
filter: url(/data/filters.svg#fill);
|
||||
}
|
||||
|
||||
/* containers experiment */
|
||||
|
||||
/* reset nightly containers */
|
||||
|
||||
-285
@@ -1,285 +0,0 @@
|
||||
# METRICS
|
||||
|
||||
## Data Analysis
|
||||
The collected data will primarily be used to answer the following questions.
|
||||
Images are used for visualization and are not composed of actual data.
|
||||
|
||||
### Do users install and run this?
|
||||
|
||||
What is the overall engagement of the Containers experiment?
|
||||
**This is the standard Daily Active User (DAU) and Monthly Active User (MAU) analysis.**
|
||||
|
||||
This captures data from the users who have the add-on installed, regardless of
|
||||
whether they are actively interacting with it.
|
||||
|
||||

|
||||
|
||||
### Immediate Questions
|
||||
|
||||
* Do people use the containers feature & how do people create new container tabs?
|
||||
* Click to create new container tab
|
||||
* \+ `entry-point` value: "tab-bar" or "pop-up"
|
||||
* Do people who use the containers feature continue to use it?
|
||||
* Retention: opening a second container tab (second tab in the same container, or a tab in a second container?)
|
||||
* What containers do people use?
|
||||
* userContextId
|
||||
* \+ Number of tabs in the container (when should we measure this? on every tab open?)
|
||||
* Do people edit their containers?
|
||||
* Click on "Edit Containers"
|
||||
* Click to edit a single container
|
||||
* Click "OK"
|
||||
* Click to delete a single container
|
||||
* Click "OK"
|
||||
* Click to add a container
|
||||
* Click "OK"
|
||||
* Do people sort the tabs?
|
||||
* Click sort
|
||||
* \+ Number of tabs when clicked
|
||||
* Average number of container tabs when sort was clicked
|
||||
* Do users show and hide container tabs?
|
||||
* Click hide
|
||||
* \+ Number of tabs when clicked
|
||||
* \+ Number of hidden containers when clicked
|
||||
* Click show
|
||||
* \+ Number of tabs when clicked
|
||||
* \+ Number of shown containers when clicked
|
||||
* Do users move container tabs to new windows?
|
||||
* Click move
|
||||
* \+ Number of tabs when clicked
|
||||
* Average number of container tabs when new window was clicked
|
||||
* How many containers do users have hidden at the same time? (when should we measure this? each time a container is hidden?)
|
||||
* Do users pin container tabs? (do we have existing Telemetry for pinning?)
|
||||
* Do users visit more pages in container tabs than non-container tabs?
|
||||
|
||||
### Follow-up Questions
|
||||
|
||||
What are some follow-up questions we anticipate we will ask based on any of the
|
||||
above answers/data?
|
||||
|
||||
* What is the average lifespan of a container tab? Is that longer or shorter than a regular tab? (if we don't have data on the latter, the former probably isn't worth gathering data on since we will have nothing to compare it to).
|
||||
|
||||
## Data Collection
|
||||
|
||||
### Server Side
|
||||
There is currently no server side component to Containers.
|
||||
|
||||
### Client Side
|
||||
Containers will use Test Pilot Telemetry with no batching of data. Details
|
||||
of when pings are sent are below, along with examples of the `payload` portion
|
||||
of a `testpilottest` telemetry ping for each scenario.
|
||||
|
||||
* The user shows the new tab menu
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "show-plus-button-menu",
|
||||
"eventSource": ["plus-button"]
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks on a container name to open a tab in that container
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"clickedContainerTabCount": <number-of-tabs-in-the-container>,
|
||||
"event": "open-tab",
|
||||
"eventSource": ["tab-bar"|"pop-up"|"file-menu"|"alltabs-menu"|"plus-button"]
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Edit Containers" in the pop-up
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "edit-containers"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks OK after clicking on a container edit icon in the pop-up
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "edit-container"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks OK after clicking on a container delete icon in the pop-up
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "delete-container"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks OK after clicking to add a container in the pop-up
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "add-container"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks the sort button/icon in the pop-up
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "sort-tabs",
|
||||
"shownContainersCount": <number-of-containers-with-tabs-shown>,
|
||||
"totalContainerTabsCount": <number-of-all-container-tabs>,
|
||||
"totalNonContainerTabsCount": <number-of-all-non-container-tabs>
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Hide these container tabs" in the popup
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"clickedContainerTabCount": <number-of-tabs-in-the-container>,
|
||||
"event": "hide-tabs",
|
||||
"hiddenContainersCount": <number-of-containers-with-tabs-hidden>,
|
||||
"shownContainersCount": <number-of-containers-with-tabs-shown>,
|
||||
"totalContainersCount": <number-of-containers-with-tabs-hidden-or-shown>
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Show these container tabs" in the popup
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"clickedContainerTabCount": <number-of-tabs-in-the-container>,
|
||||
"event": "show-tabs",
|
||||
"hiddenContainersCount": <number-of-containers-with-tabs-hidden>,
|
||||
"shownContainersCount": <number-of-containers-with-tabs-shown>,
|
||||
"totalContainersCount": <number-of-containers-with-tabs-hidden-or-shown>
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Move tabs to a new window" in the popup
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"clickedContainerTabCount": <number-of-tabs-in-the-container>,
|
||||
"event": "move-tabs-to-window"
|
||||
}
|
||||
```
|
||||
|
||||
* When a user encounters the disabled "move" feature because of incompatible add-ons
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "incompatible-addons-detected"
|
||||
}
|
||||
```
|
||||
|
||||
* The user closes a tab
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "page-requests-completed-per-tab",
|
||||
"pageRequestCount": <pageRequestCount>
|
||||
}
|
||||
```
|
||||
|
||||
* The user goes idle
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "page-requests-completed-per-activity",
|
||||
"pageRequestCount": <pageRequestCount>
|
||||
}
|
||||
```
|
||||
|
||||
* The user chooses "Always Open in this Container" context menu option. (Note: We send two separate event names: one for assigning a site to a container, one for removing a site from a container.)
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "[added|removed]-container-assignment"
|
||||
}
|
||||
```
|
||||
|
||||
* Firefox prompts the user to reload a site into a container after the user picked "Always Open in this Container".
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "prompt-reload-page-in-container"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Open in *assigned* container" to reload a site into a container after the user picked "Always Open in this Container".
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "click-to-reload-page-in-container"
|
||||
}
|
||||
```
|
||||
|
||||
* The user clicks "Open in *Current* container" to reload a site into a container after the user picked "Always Open in this Container".
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"event": "click-to-reload-page-in-same-container"
|
||||
}
|
||||
```
|
||||
|
||||
* Firefox automatically reloads a site into a container after the user picked "Always Open in this Container".
|
||||
|
||||
```js
|
||||
{
|
||||
"uuid": <uuid>,
|
||||
"userContextId": <userContextId>,
|
||||
"event": "auto-reload-page-in-container"
|
||||
}
|
||||
```
|
||||
|
||||
### A Redshift schema for the payload:
|
||||
|
||||
```lua
|
||||
local schema = {
|
||||
-- column name field type length attributes field name
|
||||
{"uuid", "VARCHAR", 255, nil, "Fields[payload.uuid]"},
|
||||
{"userContextId", "INTEGER", 255, nil, "Fields[payload.userContextId]"},
|
||||
{"clickedContainerTabCount", "INTEGER", 255, nil, "Fields[payload.clickedContainerTabCount]"},
|
||||
{"eventSource", "VARCHAR", 255, nil, "Fields[payload.eventSource]"},
|
||||
{"event", "VARCHAR", 255, nil, "Fields[payload.event]"},
|
||||
{"pageRequestCount", "INTEGER", 255, nil, "Fields[payload.pageRequestCount]"}
|
||||
{"hiddenContainersCount", "INTEGER", 255, nil, "Fields[payload.hiddenContainersCount]"},
|
||||
{"shownContainersCount", "INTEGER", 255, nil, "Fields[payload.shownContainersCount]"},
|
||||
{"totalContainersCount", "INTEGER", 255, nil, "Fields[payload.totalContainersCount]"},
|
||||
{"totalContainerTabsCount", "INTEGER", 255, nil, "Fields[payload.totalContainerTabsCount]"},
|
||||
{"totalNonContainerTabsCount", "INTEGER", 255, nil, "Fields[payload.totalNonContainerTabsCount]"}
|
||||
}
|
||||
```
|
||||
|
||||
### Valid data should be enforced on the server side:
|
||||
|
||||
* `eventSource` should be one of `tab-bar`, `pop-up`, `file-menu`, "alltabs-nmenu" or "plus-button".
|
||||
|
||||
All Mozilla data is kept by default for 180 days and in accordance with our
|
||||
privacy policies.
|
||||
+4
-3
@@ -7,15 +7,16 @@
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:multiprocessCompatible>true</em:multiprocessCompatible>
|
||||
<em:hasEmbeddedWebExtension>true</em:hasEmbeddedWebExtension>
|
||||
<em:name>Testpilot containers</em:name>
|
||||
<em:name>Multi-Account Containers</em:name>
|
||||
<em: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.</em:description>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!--Firefox-->
|
||||
<em:minVersion>51.0a1</em:minVersion>
|
||||
<em:minVersion>53.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
<em:version>3.1.0</em:version>
|
||||
<em:version>4.1.0</em:version>
|
||||
<em:unpack>false</em:unpack>
|
||||
</Description>
|
||||
</RDF>
|
||||
|
||||
+4
-5
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"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": "3.1.0",
|
||||
"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": "4.1.0",
|
||||
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/testpilot-containers/issues"
|
||||
@@ -39,6 +39,5 @@
|
||||
"lint:js": "eslint .",
|
||||
"package": "npm run build && mv testpilot-containers.xpi addon.xpi",
|
||||
"test": "npm run lint"
|
||||
},
|
||||
"updateURL": "https://testpilot.firefox.com/files/@testpilot-containers/updates.json"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Containers confirm navigation</title>
|
||||
<title>Multi-Account Containers Confirm Navigation</title>
|
||||
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="chrome://browser/skin/aboutNetError.css" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="/css/confirm-page.css" />
|
||||
</head>
|
||||
|
||||
@@ -242,7 +242,8 @@ table {
|
||||
min-block-size: 400px;
|
||||
}
|
||||
|
||||
.panel.onboarding {
|
||||
.panel.onboarding,
|
||||
.achievement-panel {
|
||||
align-items: center;
|
||||
block-size: 360px;
|
||||
margin-block-end: 16px;
|
||||
@@ -887,3 +888,53 @@ span ~ .panel-header-text {
|
||||
font-size: 14px !important;
|
||||
padding-block-end: 6px;
|
||||
}
|
||||
|
||||
/* Achievement panel elements */
|
||||
.share-ctas {
|
||||
padding-block-end: 0.5em;
|
||||
padding-block-start: 0.5em;
|
||||
padding-inline-end: 0.5em;
|
||||
padding-inline-start: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cta-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.cta {
|
||||
color: #fff;
|
||||
font-size: 0.7em;
|
||||
font-weight: bold;
|
||||
margin-block-end: 0.4em;
|
||||
margin-block-start: 0.4em;
|
||||
margin-inline-end: 0.4em;
|
||||
margin-inline-start: 0.4em;
|
||||
padding-block-end: 0.5em;
|
||||
padding-block-start: 0.5em;
|
||||
padding-inline-end: 0.5em;
|
||||
padding-inline-start: 0.5em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.cta-icon {
|
||||
height: 18px;
|
||||
padding-right: 0.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.fb-share-cta {
|
||||
background: #375496;
|
||||
}
|
||||
|
||||
.fb-share-cta .cta-icon {
|
||||
margin-block-start: -5px;
|
||||
}
|
||||
|
||||
.tweet-cta {
|
||||
background: #37bae7;
|
||||
}
|
||||
|
||||
.amo-rate-cta {
|
||||
background: #0f1126;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg width="32px" height="33px" viewBox="0 0 32 33" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch --> <desc>Created with Sketch.</desc> <defs> <linearGradient x1="74.0423237%" y1="18.5882821%" x2="0%" y2="100%" id="linearGradient-1"> <stop stop-color="#00FEFF" offset="0%"/> <stop stop-color="#3D85FF" offset="100%"/> </linearGradient> </defs> <g id="Specs" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Header-Copy" transform="translate(-182.000000, -152.000000)" fill="url(#linearGradient-1)"> <path d="M205.58574,176.859518 L205.58574,169.287998 C205.58574,169.287998 205.800116,167.315137 207.086372,167.315137 C208.372629,167.315137 208.265441,169.394639 210.677171,169.394639 C211.909834,169.394639 214,168.754792 214,165.022352 C214,161.289912 211.909834,160.810027 210.677171,160.810027 C208.265441,160.810027 208.372629,162.782888 207.086372,162.782888 C205.800116,162.782888 205.58574,160.756707 205.58574,160.756707 L205.58574,157.664114 C205.58574,156.491061 204.621048,155.531291 203.44198,155.531291 L197.814608,155.531291 C197.814608,155.531291 195.992412,155.211368 195.992412,153.931674 C195.992412,152.65198 198.028985,152.545339 198.028985,150.145914 C198.028985,148.91954 197.332262,147 193.580682,147 C189.829101,147 189.293161,148.91954 189.293161,150.145914 C189.293161,152.545339 191.115357,152.65198 191.115357,153.931674 C191.115357,155.211368 189.293161,155.531291 189.293161,155.531291 L184.148135,155.531291 C182.969067,155.531291 182.004375,156.491061 182.004375,157.664114 L182.004375,161.823118 C182.004375,161.823118 181.789999,165.022352 184.362512,165.022352 C186.023926,165.022352 186.07752,162.836209 188.274874,162.836209 C189.346755,162.836209 190.418635,163.8493 190.418635,166.035443 C190.418635,168.274907 189.346755,169.394639 188.274874,169.394639 C186.131114,169.394639 186.023926,167.208496 184.362512,167.208496 C181.789999,167.208496 182.004375,170.301089 182.004375,170.301089 L182.004375,176.859518 C182.004375,178.032571 182.969067,178.992341 184.148135,178.992341 L191.115357,178.992341 C191.115357,178.992341 194.49178,179.205623 194.49178,176.646236 C194.49178,174.993299 192.348019,174.726696 192.348019,172.540552 C192.348019,171.474141 193.527088,170.141127 195.778036,170.141127 C198.028985,170.141127 199.315241,171.474141 199.315241,172.540552 C199.315241,174.673375 197.225074,174.993299 197.225074,176.646236 C197.225074,179.258944 200.601497,178.992341 200.601497,178.992341 L203.44198,178.992341 C204.621048,178.992341 205.58574,178.032571 205.58574,176.859518 Z" id="Shape-Copy-23" transform="translate(198.000000, 163.000000) rotate(-42.000000) translate(-198.000000, -163.000000) "/> </g> </g> </svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
Executable
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="-14 -14 48 48" enable-background="new -14 -14 48 48" xml:space="preserve">
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="90.0527" y1="-99.7603" x2="90.0527" y2="-106.3809" gradientTransform="matrix(7.2338 0 0 -7.2338 -641.4998 -735.5619)">
|
||||
<stop offset="0" style="stop-color:#4B71B8"/>
|
||||
<stop offset="1" style="stop-color:#293F7E"/>
|
||||
</linearGradient>
|
||||
<path fill="url(#SVGID_1_)" d="M33.931,27.993c0,3.304-2.689,5.983-6.002,5.983H-8.082c-3.315,0-6.001-2.683-6.001-5.983V-7.928
|
||||
c0-3.308,2.687-5.988,6.001-5.988h36.011c3.312,0,6.002,2.681,6.002,5.988V27.993z"/>
|
||||
<path fill="#FFFFFF" d="M25.613-4.557c0,0-3.707,0-6.166,0c-3.662,0-7.732,1.535-7.732,6.835c0.019,1.845,0,3.613,0,5.603H7.481
|
||||
v6.728h4.366v19.37h8.021V14.48h5.295l0.479-6.618h-5.913c0,0,0.016-2.946,0-3.8c0-2.093,2.184-1.974,2.312-1.974
|
||||
c1.042,0,3.059,0.003,3.578,0v-6.646H25.613z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
Executable
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="23.9995" y1="0" x2="23.9995" y2="48.0005">
|
||||
<stop offset="0" style="stop-color:#4BD0EF"/>
|
||||
<stop offset="1" style="stop-color:#29AAE1"/>
|
||||
</linearGradient>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" d="M48,42c0,3.313-2.687,6-6,6H6c-3.313,0-6-2.687-6-6V6
|
||||
c0-3.313,2.687-6,6-6h36c3.313,0,6,2.687,6,6V42z"/>
|
||||
<path fill="#29AAE1" d="M40.231,13.413c-1.12,0.497-2.323,0.833-3.588,0.984c1.291-0.774,2.28-1.998,2.747-3.457
|
||||
c-1.206,0.716-2.543,1.236-3.968,1.516c-1.139-1.214-2.763-1.972-4.56-1.972c-3.449,0-6.246,2.796-6.246,6.247
|
||||
c0,0.49,0.055,0.966,0.161,1.424c-5.192-0.261-9.795-2.749-12.876-6.528c-0.538,0.923-0.846,1.996-0.846,3.141
|
||||
c0,2.167,1.103,4.08,2.779,5.199c-1.024-0.032-1.987-0.313-2.83-0.781c0,0.026,0,0.053,0,0.079c0,3.026,2.153,5.551,5.011,6.125
|
||||
c-0.525,0.143-1.076,0.219-1.646,0.219c-0.403,0-0.794-0.038-1.176-0.11c0.795,2.48,3.102,4.287,5.835,4.338
|
||||
c-2.138,1.675-4.832,2.675-7.758,2.675c-0.504,0-1.002-0.03-1.491-0.089c2.765,1.773,6.048,2.808,9.576,2.808
|
||||
c11.49,0,17.774-9.519,17.774-17.774c0-0.271-0.006-0.54-0.019-0.809C38.334,15.766,39.394,14.666,40.231,13.413z"/>
|
||||
<path fill="#FFFFFF" d="M40.231,14.739c-1.12,0.497-2.323,0.833-3.588,0.984c1.291-0.773,2.28-1.998,2.747-3.456
|
||||
c-1.206,0.716-2.543,1.236-3.968,1.516c-1.139-1.214-2.763-1.972-4.56-1.972c-3.449,0-6.246,2.796-6.246,6.247
|
||||
c0,0.489,0.055,0.966,0.161,1.424c-5.192-0.261-9.795-2.748-12.876-6.527c-0.538,0.923-0.846,1.996-0.846,3.141
|
||||
c0,2.167,1.103,4.079,2.779,5.199c-1.024-0.032-1.987-0.313-2.83-0.781c0,0.026,0,0.052,0,0.079c0,3.027,2.153,5.551,5.011,6.125
|
||||
c-0.525,0.144-1.076,0.219-1.646,0.219c-0.403,0-0.794-0.038-1.176-0.11c0.795,2.481,3.102,4.287,5.835,4.338
|
||||
c-2.138,1.676-4.832,2.675-7.758,2.675c-0.504,0-1.002-0.03-1.491-0.089c2.765,1.773,6.048,2.808,9.576,2.808
|
||||
c11.49,0,17.774-9.519,17.774-17.774c0-0.271-0.006-0.54-0.019-0.808C38.334,17.092,39.394,15.992,40.231,14.739z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -7,7 +7,6 @@ module.exports = {
|
||||
"badge": true,
|
||||
"backgroundLogic": true,
|
||||
"identityState": true,
|
||||
"messageHandler": true,
|
||||
"tabPageCounter": true
|
||||
"messageHandler": true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
const assignManager = {
|
||||
MENU_ASSIGN_ID: "open-in-this-container",
|
||||
MENU_REMOVE_ID: "remove-open-in-this-container",
|
||||
MENU_SEPARATOR_ID: "separator",
|
||||
MENU_HIDE_ID: "hide-container",
|
||||
MENU_MOVE_ID: "move-to-new-window-container",
|
||||
|
||||
storageArea: {
|
||||
area: browser.storage.local,
|
||||
exemptedTabs: {},
|
||||
@@ -109,21 +113,29 @@ const assignManager = {
|
||||
return true;
|
||||
},
|
||||
|
||||
init() {
|
||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||
this._onClickedHandler(info, tab);
|
||||
});
|
||||
|
||||
// Before a request is handled by the browser we decide if we should route through a different container
|
||||
browser.webRequest.onBeforeRequest.addListener((options) => {
|
||||
async onBeforeRequest(options) {
|
||||
if (options.frameId !== 0 || options.tabId === -1) {
|
||||
return {};
|
||||
}
|
||||
this.removeContextMenu();
|
||||
return Promise.all([
|
||||
const [tab, siteSettings] = await Promise.all([
|
||||
browser.tabs.get(options.tabId),
|
||||
this.storageArea.get(options.url)
|
||||
]).then(([tab, siteSettings]) => {
|
||||
]);
|
||||
let container;
|
||||
try {
|
||||
container = await browser.contextualIdentities.get(backgroundLogic.cookieStoreId(siteSettings.userContextId));
|
||||
} catch (e) {
|
||||
container = false;
|
||||
}
|
||||
|
||||
// The container we have in the assignment map isn't present any more so lets remove it
|
||||
// then continue the existing load
|
||||
if (!container) {
|
||||
this.deleteContainer(siteSettings.userContextId);
|
||||
return {};
|
||||
}
|
||||
const userContextId = this.getUserContextIdFromCookieStore(tab);
|
||||
if (!siteSettings
|
||||
|| userContextId === siteSettings.userContextId
|
||||
@@ -154,24 +166,47 @@ const assignManager = {
|
||||
return {
|
||||
cancel: true,
|
||||
};
|
||||
}).catch((e) => {
|
||||
throw e;
|
||||
},
|
||||
|
||||
init() {
|
||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||
this._onClickedHandler(info, tab);
|
||||
});
|
||||
|
||||
// Before a request is handled by the browser we decide if we should route through a different container
|
||||
browser.webRequest.onBeforeRequest.addListener((options) => {
|
||||
return this.onBeforeRequest(options);
|
||||
},{urls: ["<all_urls>"], types: ["main_frame"]}, ["blocking"]);
|
||||
},
|
||||
|
||||
async _onClickedHandler(info, tab) {
|
||||
const userContextId = this.getUserContextIdFromCookieStore(tab);
|
||||
// Mapping ${URL(info.pageUrl).hostname} to ${userContextId}
|
||||
if (userContextId) {
|
||||
// let actionName;
|
||||
let remove;
|
||||
if (userContextId) {
|
||||
switch (info.menuItemId) {
|
||||
case this.MENU_ASSIGN_ID:
|
||||
case this.MENU_REMOVE_ID:
|
||||
if (info.menuItemId === this.MENU_ASSIGN_ID) {
|
||||
remove = false;
|
||||
} else {
|
||||
remove = true;
|
||||
}
|
||||
await this._setOrRemoveAssignment(tab.id, info.pageUrl, userContextId, remove);
|
||||
break;
|
||||
case this.MENU_MOVE_ID:
|
||||
backgroundLogic.moveTabsToWindow({
|
||||
cookieStoreId: tab.cookieStoreId,
|
||||
windowId: tab.windowId,
|
||||
});
|
||||
break;
|
||||
case this.MENU_HIDE_ID:
|
||||
backgroundLogic.hideTabs({
|
||||
cookieStoreId: tab.cookieStoreId,
|
||||
windowId: tab.windowId,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -260,6 +295,9 @@ const assignManager = {
|
||||
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1352102
|
||||
browser.contextMenus.remove(this.MENU_ASSIGN_ID);
|
||||
browser.contextMenus.remove(this.MENU_REMOVE_ID);
|
||||
browser.contextMenus.remove(this.MENU_SEPARATOR_ID);
|
||||
browser.contextMenus.remove(this.MENU_HIDE_ID);
|
||||
browser.contextMenus.remove(this.MENU_MOVE_ID);
|
||||
},
|
||||
|
||||
async calculateContextMenu(tab) {
|
||||
@@ -270,21 +308,46 @@ const assignManager = {
|
||||
if (siteSettings === false) {
|
||||
return false;
|
||||
}
|
||||
// ✓ This is to mitigate https://bugzilla.mozilla.org/show_bug.cgi?id=1351418
|
||||
let prefix = " "; // Alignment of non breaking space, unknown why this requires so many spaces to align with the tick
|
||||
let checked = false;
|
||||
let menuId = this.MENU_ASSIGN_ID;
|
||||
const tabUserContextId = this.getUserContextIdFromCookieStore(tab);
|
||||
if (siteSettings &&
|
||||
Number(siteSettings.userContextId) === Number(tabUserContextId)) {
|
||||
prefix = "✓";
|
||||
checked = true;
|
||||
menuId = this.MENU_REMOVE_ID;
|
||||
}
|
||||
browser.contextMenus.create({
|
||||
id: menuId,
|
||||
title: `${prefix} Always Open in This Container`,
|
||||
checked: true,
|
||||
title: "Always Open in This Container",
|
||||
checked,
|
||||
type: "checkbox",
|
||||
contexts: ["all"],
|
||||
});
|
||||
|
||||
browser.contextMenus.create({
|
||||
id: this.MENU_SEPARATOR_ID,
|
||||
type: "separator",
|
||||
contexts: ["all"],
|
||||
});
|
||||
|
||||
browser.contextMenus.create({
|
||||
id: this.MENU_HIDE_ID,
|
||||
title: "Hide This Container",
|
||||
contexts: ["all"],
|
||||
});
|
||||
|
||||
browser.contextMenus.create({
|
||||
id: this.MENU_MOVE_ID,
|
||||
title: "Move Tabs to a New Window",
|
||||
contexts: ["all"],
|
||||
});
|
||||
},
|
||||
|
||||
encodeURLProperty(url) {
|
||||
return encodeURIComponent(url).replace(/[!'()*]/g, (c) => {
|
||||
const charCode = c.charCodeAt(0).toString(16);
|
||||
return `%${charCode}`;
|
||||
});
|
||||
},
|
||||
|
||||
reloadPageInContainer(url, currentUserContextId, userContextId, index, neverAsk = false) {
|
||||
@@ -295,7 +358,7 @@ const assignManager = {
|
||||
if (neverAsk) {
|
||||
browser.tabs.create({url, cookieStoreId, index});
|
||||
} else {
|
||||
let confirmUrl = `${loadPage}?url=${encodeURIComponent(url)}&cookieStoreId=${cookieStoreId}`;
|
||||
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
|
||||
let currentCookieStoreId;
|
||||
if (currentUserContextId) {
|
||||
currentCookieStoreId = backgroundLogic.cookieStoreId(currentUserContextId);
|
||||
|
||||
@@ -25,13 +25,12 @@ const backgroundLogic = {
|
||||
return false;
|
||||
},
|
||||
|
||||
async deleteContainer(userContextId) {
|
||||
async deleteContainer(userContextId, removed = false) {
|
||||
await this._closeTabs(userContextId);
|
||||
if (!removed) {
|
||||
await browser.contextualIdentities.remove(this.cookieStoreId(userContextId));
|
||||
}
|
||||
assignManager.deleteContainer(userContextId);
|
||||
await browser.runtime.sendMessage({
|
||||
method: "forgetIdentityAndRefresh"
|
||||
});
|
||||
return {done: true, userContextId};
|
||||
},
|
||||
|
||||
@@ -51,7 +50,7 @@ const backgroundLogic = {
|
||||
});
|
||||
},
|
||||
|
||||
async openTab(options) {
|
||||
async openNewTab(options) {
|
||||
let url = options.url || undefined;
|
||||
const userContextId = ("userContextId" in options) ? options.userContextId : 0;
|
||||
const active = ("nofocus" in options) ? options.nofocus : true;
|
||||
@@ -64,10 +63,10 @@ const backgroundLogic = {
|
||||
url = undefined;
|
||||
}
|
||||
|
||||
// Unhide all hidden tabs
|
||||
this.showTabs({
|
||||
cookieStoreId
|
||||
});
|
||||
if (!this.isPermissibleURL(url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return browser.tabs.create({
|
||||
url,
|
||||
active,
|
||||
@@ -76,61 +75,90 @@ const backgroundLogic = {
|
||||
});
|
||||
},
|
||||
|
||||
async getTabs(options) {
|
||||
if (!("cookieStoreId" in options)) {
|
||||
return new Error("getTabs must be called with cookieStoreId argument.");
|
||||
isPermissibleURL(url) {
|
||||
const protocol = new URL(url).protocol;
|
||||
// We can't open these we just have to throw them away
|
||||
if (protocol === "about:"
|
||||
|| protocol === "chrome:"
|
||||
|| protocol === "moz-extension:") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(options.cookieStoreId);
|
||||
await identityState.remapTabsIfMissing(options.cookieStoreId);
|
||||
const isKnownContainer = await identityState._isKnownContainer(userContextId);
|
||||
if (!isKnownContainer) {
|
||||
return [];
|
||||
checkArgs(requiredArguments, options, methodName) {
|
||||
requiredArguments.forEach((argument) => {
|
||||
if (!(argument in options)) {
|
||||
return new Error(`${methodName} must be called with ${argument} argument.`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async getTabs(options) {
|
||||
const requiredArguments = ["cookieStoreId", "windowId"];
|
||||
this.checkArgs(requiredArguments, options, "getTabs");
|
||||
const { cookieStoreId, windowId } = options;
|
||||
|
||||
const list = [];
|
||||
const tabs = await this._containerTabs(options.cookieStoreId);
|
||||
const tabs = await browser.tabs.query({
|
||||
cookieStoreId,
|
||||
windowId
|
||||
});
|
||||
tabs.forEach((tab) => {
|
||||
list.push(identityState._createTabObject(tab));
|
||||
});
|
||||
|
||||
const containerState = await identityState.storageArea.get(options.cookieStoreId);
|
||||
const containerState = await identityState.storageArea.get(cookieStoreId);
|
||||
return list.concat(containerState.hiddenTabs);
|
||||
},
|
||||
|
||||
async moveTabsToWindow(options) {
|
||||
if (!("cookieStoreId" in options)) {
|
||||
return new Error("moveTabsToWindow must be called with cookieStoreId argument.");
|
||||
}
|
||||
const requiredArguments = ["cookieStoreId", "windowId"];
|
||||
this.checkArgs(requiredArguments, options, "moveTabsToWindow");
|
||||
const { cookieStoreId, windowId } = options;
|
||||
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(options.cookieStoreId);
|
||||
await identityState.remapTabsIfMissing(options.cookieStoreId);
|
||||
if (!identityState._isKnownContainer(userContextId)) {
|
||||
return null;
|
||||
}
|
||||
const list = await browser.tabs.query({
|
||||
cookieStoreId,
|
||||
windowId
|
||||
});
|
||||
|
||||
const list = await identityState._matchTabsByContainer(options.cookieStoreId);
|
||||
|
||||
const containerState = await identityState.storageArea.get(options.cookieStoreId);
|
||||
const containerState = await identityState.storageArea.get(cookieStoreId);
|
||||
// Nothing to do
|
||||
if (list.length === 0 &&
|
||||
containerState.hiddenTabs.length === 0) {
|
||||
return;
|
||||
}
|
||||
const window = await browser.windows.create({
|
||||
let newWindowObj;
|
||||
let hiddenDefaultTabToClose;
|
||||
if (list.length) {
|
||||
newWindowObj = await browser.windows.create({
|
||||
tabId: list.shift().id
|
||||
});
|
||||
browser.tabs.move(list, {
|
||||
windowId: window.id,
|
||||
browser.tabs.move(list.map((tab) => tab.id), {
|
||||
windowId: newWindowObj.id,
|
||||
index: -1
|
||||
});
|
||||
} else {
|
||||
//As we get a blank tab here we will need to await the tabs creation
|
||||
newWindowObj = await browser.windows.create({
|
||||
});
|
||||
hiddenDefaultTabToClose = true;
|
||||
}
|
||||
|
||||
const showHiddenPromises = [];
|
||||
|
||||
// Let's show the hidden tabs.
|
||||
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
||||
browser.tabs.create(object.url || DEFAULT_TAB, {
|
||||
windowId: window.id,
|
||||
cookieStoreId: options.cookieStoreId
|
||||
});
|
||||
showHiddenPromises.push(browser.tabs.create({
|
||||
url: object.url || DEFAULT_TAB,
|
||||
windowId: newWindowObj.id,
|
||||
cookieStoreId
|
||||
}));
|
||||
}
|
||||
|
||||
if (hiddenDefaultTabToClose) {
|
||||
// Lets wait for hidden tabs to show before closing the others
|
||||
await showHiddenPromises;
|
||||
}
|
||||
|
||||
containerState.hiddenTabs = [];
|
||||
@@ -138,31 +166,46 @@ const backgroundLogic = {
|
||||
// Let's close all the normal tab in the new window. In theory it
|
||||
// should be only the first tab, but maybe there are addons doing
|
||||
// crazy stuff.
|
||||
const tabs = browser.tabs.query({windowId: window.id});
|
||||
const tabs = await browser.tabs.query({windowId: newWindowObj.id});
|
||||
for (let tab of tabs) { // eslint-disable-line prefer-const
|
||||
if (tabs.cookieStoreId !== options.cookieStoreId) {
|
||||
if (tab.cookieStoreId !== cookieStoreId) {
|
||||
browser.tabs.remove(tab.id);
|
||||
}
|
||||
}
|
||||
return await identityState.storageArea.set(options.cookieStoreId, containerState);
|
||||
return await identityState.storageArea.set(cookieStoreId, containerState);
|
||||
},
|
||||
|
||||
async _closeTabs(userContextId) {
|
||||
async _closeTabs(userContextId, windowId = false) {
|
||||
const cookieStoreId = this.cookieStoreId(userContextId);
|
||||
const tabs = await this._containerTabs(cookieStoreId);
|
||||
let tabs;
|
||||
/* if we have no windowId we are going to close all this container (used for deleting) */
|
||||
if (windowId !== false) {
|
||||
tabs = await browser.tabs.query({
|
||||
cookieStoreId,
|
||||
windowId
|
||||
});
|
||||
} else {
|
||||
tabs = await browser.tabs.query({
|
||||
cookieStoreId
|
||||
});
|
||||
}
|
||||
const tabIds = tabs.map((tab) => tab.id);
|
||||
return browser.tabs.remove(tabIds);
|
||||
},
|
||||
|
||||
async queryIdentitiesState() {
|
||||
async queryIdentitiesState(windowId) {
|
||||
const identities = await browser.contextualIdentities.query({});
|
||||
const identitiesOutput = {};
|
||||
const identitiesPromise = identities.map(async function (identity) {
|
||||
await identityState.remapTabsIfMissing(identity.cookieStoreId);
|
||||
const containerState = await identityState.storageArea.get(identity.cookieStoreId);
|
||||
identitiesOutput[identity.cookieStoreId] = {
|
||||
const { cookieStoreId } = identity;
|
||||
const containerState = await identityState.storageArea.get(cookieStoreId);
|
||||
const openTabs = await browser.tabs.query({
|
||||
cookieStoreId,
|
||||
windowId
|
||||
});
|
||||
identitiesOutput[cookieStoreId] = {
|
||||
hasHiddenTabs: !!containerState.hiddenTabs.length,
|
||||
hasOpenTabs: !!containerState.openTabs
|
||||
hasOpenTabs: !!openTabs.length
|
||||
};
|
||||
return;
|
||||
});
|
||||
@@ -172,15 +215,15 @@ const backgroundLogic = {
|
||||
|
||||
async sortTabs() {
|
||||
const windows = await browser.windows.getAll();
|
||||
for (let window of windows) { // eslint-disable-line prefer-const
|
||||
for (let windowObj of windows) { // eslint-disable-line prefer-const
|
||||
// First the pinned tabs, then the normal ones.
|
||||
await this._sortTabsInternal(window, true);
|
||||
await this._sortTabsInternal(window, false);
|
||||
await this._sortTabsInternal(windowObj, true);
|
||||
await this._sortTabsInternal(windowObj, false);
|
||||
}
|
||||
},
|
||||
|
||||
async _sortTabsInternal(window, pinnedTabs) {
|
||||
const tabs = await browser.tabs.query({windowId: window.id});
|
||||
async _sortTabsInternal(windowObj, pinnedTabs) {
|
||||
const tabs = await browser.tabs.query({windowId: windowObj.id});
|
||||
let pos = 0;
|
||||
|
||||
// Let's collect UCIs/tabs for this window.
|
||||
@@ -212,28 +255,22 @@ const backgroundLogic = {
|
||||
for (const tab of tabs) {
|
||||
++pos;
|
||||
browser.tabs.move(tab.id, {
|
||||
windowId: window.id,
|
||||
windowId: windowObj.id,
|
||||
index: pos
|
||||
});
|
||||
//xulWindow.gBrowser.moveTabTo(tab, pos++);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async hideTabs(options) {
|
||||
if (!("cookieStoreId" in options)) {
|
||||
return new Error("hideTabs must be called with cookieStoreId option.");
|
||||
}
|
||||
const requiredArguments = ["cookieStoreId", "windowId"];
|
||||
this.checkArgs(requiredArguments, options, "hideTabs");
|
||||
const { cookieStoreId, windowId } = options;
|
||||
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(options.cookieStoreId);
|
||||
await identityState.remapTabsIfMissing(options.cookieStoreId);
|
||||
const isKnownContainer = await identityState._isKnownContainer(userContextId);
|
||||
if (!isKnownContainer) {
|
||||
return null;
|
||||
}
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(cookieStoreId);
|
||||
|
||||
const containerState = await identityState.storeHidden(options.cookieStoreId);
|
||||
await this._closeTabs(userContextId);
|
||||
const containerState = await identityState.storeHidden(cookieStoreId, windowId);
|
||||
await this._closeTabs(userContextId, windowId);
|
||||
return containerState;
|
||||
},
|
||||
|
||||
@@ -243,17 +280,12 @@ const backgroundLogic = {
|
||||
}
|
||||
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(options.cookieStoreId);
|
||||
await identityState.remapTabsIfMissing(options.cookieStoreId);
|
||||
if (!identityState._isKnownContainer(userContextId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const promises = [];
|
||||
|
||||
const containerState = await identityState.storageArea.get(options.cookieStoreId);
|
||||
|
||||
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
||||
promises.push(this.openTab({
|
||||
promises.push(this.openNewTab({
|
||||
userContextId: userContextId,
|
||||
url: object.url,
|
||||
nofocus: options.nofocus || false,
|
||||
@@ -269,12 +301,6 @@ const backgroundLogic = {
|
||||
|
||||
cookieStoreId(userContextId) {
|
||||
return `firefox-container-${userContextId}`;
|
||||
},
|
||||
|
||||
_containerTabs(cookieStoreId) {
|
||||
return browser.tabs.query({
|
||||
cookieStoreId
|
||||
}).catch((e) => {throw e;});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
const MAJOR_VERSIONS = ["2.3.0", "2.4.0"];
|
||||
const badge = {
|
||||
init() {
|
||||
this.displayBrowserActionBadge();
|
||||
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" });
|
||||
},
|
||||
|
||||
async displayBrowserActionBadge() {
|
||||
const extensionInfo = await backgroundLogic.getExtensionInfo();
|
||||
const storage = await browser.storage.local.get({browserActionBadgesClicked: []});
|
||||
|
||||
@@ -13,7 +13,10 @@ const identityState = {
|
||||
if (storageResponse && storeKey in storageResponse) {
|
||||
return storageResponse[storeKey];
|
||||
}
|
||||
return null;
|
||||
const defaultContainerState = identityState._createIdentityState();
|
||||
await this.set(cookieStoreId, defaultContainerState);
|
||||
|
||||
return defaultContainerState;
|
||||
},
|
||||
|
||||
set(cookieStoreId, data) {
|
||||
@@ -29,21 +32,18 @@ const identityState = {
|
||||
}
|
||||
},
|
||||
|
||||
async _isKnownContainer(userContextId) {
|
||||
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
|
||||
const state = await this.storageArea.get(cookieStoreId);
|
||||
return !!state;
|
||||
},
|
||||
|
||||
_createTabObject(tab) {
|
||||
return Object.assign({}, tab);
|
||||
},
|
||||
|
||||
async storeHidden(cookieStoreId) {
|
||||
async storeHidden(cookieStoreId, windowId) {
|
||||
const containerState = await this.storageArea.get(cookieStoreId);
|
||||
const tabsByContainer = await this._matchTabsByContainer(cookieStoreId);
|
||||
const tabsByContainer = await browser.tabs.query({cookieStoreId, windowId});
|
||||
tabsByContainer.forEach((tab) => {
|
||||
const tabObject = this._createTabObject(tab);
|
||||
if (!backgroundLogic.isPermissibleURL(tab.url)) {
|
||||
return;
|
||||
}
|
||||
// This tab is going to be closed. Let's mark this tabObject as
|
||||
// non-active.
|
||||
tabObject.active = false;
|
||||
@@ -54,89 +54,9 @@ const identityState = {
|
||||
return this.storageArea.set(cookieStoreId, containerState);
|
||||
},
|
||||
|
||||
async containersCounts() {
|
||||
let containersCounts = { // eslint-disable-line prefer-const
|
||||
"shown": 0,
|
||||
"hidden": 0,
|
||||
"total": 0
|
||||
};
|
||||
const containers = await browser.contextualIdentities.query({});
|
||||
for (const id in containers) {
|
||||
const container = containers[id];
|
||||
await this.remapTabsIfMissing(container.cookieStoreId);
|
||||
const containerState = await this.storageArea.get(container.cookieStoreId);
|
||||
if (containerState.openTabs > 0) {
|
||||
++containersCounts.shown;
|
||||
++containersCounts.total;
|
||||
continue;
|
||||
} else if (containerState.hiddenTabs.length > 0) {
|
||||
++containersCounts.hidden;
|
||||
++containersCounts.total;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return containersCounts;
|
||||
},
|
||||
|
||||
async containerTabCount(cookieStoreId) {
|
||||
// Returns the total of open and hidden tabs with this userContextId
|
||||
let containerTabsCount = 0;
|
||||
await identityState.remapTabsIfMissing(cookieStoreId);
|
||||
const containerState = await this.storageArea.get(cookieStoreId);
|
||||
containerTabsCount += containerState.openTabs;
|
||||
containerTabsCount += containerState.hiddenTabs.length;
|
||||
return containerTabsCount;
|
||||
},
|
||||
|
||||
async totalContainerTabsCount() {
|
||||
// Returns the number of total open tabs across ALL containers
|
||||
let totalContainerTabsCount = 0;
|
||||
const containers = await browser.contextualIdentities.query({});
|
||||
for (const id in containers) {
|
||||
const container = containers[id];
|
||||
const cookieStoreId = container.cookieStoreId;
|
||||
await identityState.remapTabsIfMissing(cookieStoreId);
|
||||
totalContainerTabsCount += await this.storageArea.get(cookieStoreId).openTabs;
|
||||
}
|
||||
return totalContainerTabsCount;
|
||||
},
|
||||
|
||||
async totalNonContainerTabsCount() {
|
||||
// Returns the number of open tabs NOT IN a container
|
||||
let totalNonContainerTabsCount = 0;
|
||||
const tabs = await browser.tabs.query({});
|
||||
for (const tab of tabs) {
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(tab.cookieStoreId);
|
||||
if (userContextId === 0) {
|
||||
++totalNonContainerTabsCount;
|
||||
}
|
||||
}
|
||||
return totalNonContainerTabsCount;
|
||||
},
|
||||
|
||||
async remapTabsIfMissing(cookieStoreId) {
|
||||
// We already know this cookieStoreId.
|
||||
const containerState = await this.storageArea.get(cookieStoreId) || this._createIdentityState();
|
||||
|
||||
await this.storageArea.set(cookieStoreId, containerState);
|
||||
await this.remapTabsFromUserContextId(cookieStoreId);
|
||||
},
|
||||
|
||||
_matchTabsByContainer(cookieStoreId) {
|
||||
return browser.tabs.query({cookieStoreId});
|
||||
},
|
||||
|
||||
async remapTabsFromUserContextId(cookieStoreId) {
|
||||
const tabsByContainer = await this._matchTabsByContainer(cookieStoreId);
|
||||
const containerState = await this.storageArea.get(cookieStoreId);
|
||||
containerState.openTabs = tabsByContainer.length;
|
||||
await this.storageArea.set(cookieStoreId, containerState);
|
||||
},
|
||||
|
||||
_createIdentityState() {
|
||||
return {
|
||||
hiddenTabs: [],
|
||||
openTabs: 0
|
||||
hiddenTabs: []
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
"js/background/badge.js",
|
||||
"js/background/identityState.js",
|
||||
"js/background/messageHandler.js",
|
||||
"js/background/tabPageCounter.js",
|
||||
"js/backdround/init.js"
|
||||
]
|
||||
-->
|
||||
<script type="text/javascript" src="backgroundLogic.js"></script>
|
||||
@@ -20,7 +18,5 @@
|
||||
<script type="text/javascript" src="badge.js"></script>
|
||||
<script type="text/javascript" src="identityState.js"></script>
|
||||
<script type="text/javascript" src="messageHandler.js"></script>
|
||||
<script type="text/javascript" src="tabPageCounter.js"></script>
|
||||
<script type="text/javascript" src="init.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
browser.runtime.sendMessage({
|
||||
method: "getPreference",
|
||||
pref: "browser.privatebrowsing.autostart"
|
||||
}).then(pbAutoStart => {
|
||||
|
||||
// We don't want to disable the addon if we are in auto private-browsing.
|
||||
if (!pbAutoStart) {
|
||||
browser.tabs.onCreated.addListener(tab => {
|
||||
if (tab.incognito) {
|
||||
disableAddon(tab.id);
|
||||
}
|
||||
});
|
||||
|
||||
browser.tabs.query({}).then(tabs => {
|
||||
for (let tab of tabs) { // eslint-disable-line prefer-const
|
||||
if (tab.incognito) {
|
||||
disableAddon(tab.id);
|
||||
}
|
||||
}
|
||||
}).catch(() => {});
|
||||
}
|
||||
}).catch(() => {});
|
||||
|
||||
function disableAddon(tabId) {
|
||||
browser.browserAction.disable(tabId);
|
||||
browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
|
||||
}
|
||||
@@ -3,6 +3,7 @@ const messageHandler = {
|
||||
// We use this to catch redirected tabs that have just opened
|
||||
// If this were in platform we would change how the tab opens based on "new tab" link navigations such as ctrl+click
|
||||
LAST_CREATED_TAB_TIMER: 2000,
|
||||
unhideQueue: [],
|
||||
|
||||
init() {
|
||||
// Handles messages from webextension code
|
||||
@@ -16,10 +17,6 @@ const messageHandler = {
|
||||
case "createOrUpdateContainer":
|
||||
response = backgroundLogic.createOrUpdateContainer(m.message);
|
||||
break;
|
||||
case "openTab":
|
||||
// Same as open-tab for index.js
|
||||
response = backgroundLogic.openTab(m.message);
|
||||
break;
|
||||
case "neverAsk":
|
||||
assignManager._neverAsk(m);
|
||||
break;
|
||||
@@ -42,26 +39,31 @@ const messageHandler = {
|
||||
backgroundLogic.sortTabs();
|
||||
break;
|
||||
case "showTabs":
|
||||
backgroundLogic.showTabs({cookieStoreId: m.cookieStoreId});
|
||||
this.unhideContainer(m.cookieStoreId);
|
||||
break;
|
||||
case "hideTabs":
|
||||
backgroundLogic.hideTabs({cookieStoreId: m.cookieStoreId});
|
||||
backgroundLogic.hideTabs({
|
||||
cookieStoreId: m.cookieStoreId,
|
||||
windowId: m.windowId
|
||||
});
|
||||
break;
|
||||
case "checkIncompatibleAddons":
|
||||
// TODO
|
||||
break;
|
||||
case "moveTabsToWindow":
|
||||
response = backgroundLogic.moveTabsToWindow({
|
||||
cookieStoreId: m.cookieStoreId
|
||||
cookieStoreId: m.cookieStoreId,
|
||||
windowId: m.windowId
|
||||
});
|
||||
break;
|
||||
case "getTabs":
|
||||
response = backgroundLogic.getTabs({
|
||||
cookieStoreId: m.cookieStoreId
|
||||
cookieStoreId: m.cookieStoreId,
|
||||
windowId: m.windowId
|
||||
});
|
||||
break;
|
||||
case "queryIdentitiesState":
|
||||
response = backgroundLogic.queryIdentitiesState();
|
||||
response = backgroundLogic.queryIdentitiesState(m.message.windowId);
|
||||
break;
|
||||
case "exemptContainerAssignment":
|
||||
response = assignManager._exemptTab(m);
|
||||
@@ -70,38 +72,16 @@ const messageHandler = {
|
||||
return response;
|
||||
});
|
||||
|
||||
// Handles messages from sdk code
|
||||
const port = browser.runtime.connect();
|
||||
port.onMessage.addListener(m => {
|
||||
switch (m.type) {
|
||||
case "open-tab":
|
||||
backgroundLogic.openTab(m.message);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled message type: ${m.message}`);
|
||||
}
|
||||
if (browser.contextualIdentities.onRemoved) {
|
||||
browser.contextualIdentities.onRemoved.addListener(({contextualIdentity}) => {
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(contextualIdentity.cookieStoreId);
|
||||
backgroundLogic.deleteContainer(userContextId, true);
|
||||
});
|
||||
|
||||
browser.tabs.onCreated.addListener((tab) => {
|
||||
// This works at capturing the tabs as they are created
|
||||
// However we need onFocusChanged and onActivated to capture the initial tab
|
||||
if (tab.id === -1) {
|
||||
return {};
|
||||
}
|
||||
tabPageCounter.initTabCounter(tab);
|
||||
});
|
||||
|
||||
browser.tabs.onRemoved.addListener((tabId) => {
|
||||
if (tabId === -1) {
|
||||
return {};
|
||||
}
|
||||
tabPageCounter.sendTabCountAndDelete(tabId);
|
||||
});
|
||||
|
||||
browser.tabs.onActivated.addListener((info) => {
|
||||
assignManager.removeContextMenu();
|
||||
browser.tabs.get(info.tabId).then((tab) => {
|
||||
tabPageCounter.initTabCounter(tab);
|
||||
assignManager.calculateContextMenu(tab);
|
||||
}).catch((e) => {
|
||||
throw e;
|
||||
@@ -109,34 +89,7 @@ const messageHandler = {
|
||||
});
|
||||
|
||||
browser.windows.onFocusChanged.addListener((windowId) => {
|
||||
assignManager.removeContextMenu();
|
||||
// browserAction loses background color in new windows ...
|
||||
// https://bugzil.la/1314674
|
||||
// https://github.com/mozilla/testpilot-containers/issues/608
|
||||
// ... so re-call displayBrowserActionBadge on window changes
|
||||
badge.displayBrowserActionBadge();
|
||||
browser.tabs.query({active: true, windowId}).then((tabs) => {
|
||||
if (tabs && tabs[0]) {
|
||||
tabPageCounter.initTabCounter(tabs[0]);
|
||||
assignManager.calculateContextMenu(tabs[0]);
|
||||
}
|
||||
}).catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
});
|
||||
|
||||
browser.idle.onStateChanged.addListener((newState) => {
|
||||
browser.tabs.query({}).then(tabs => {
|
||||
for (let tab of tabs) { // eslint-disable-line prefer-const
|
||||
if (newState === "idle") {
|
||||
tabPageCounter.sendTabCountAndDelete(tab.id, "user-went-idle");
|
||||
} else if (newState === "active" && tab.active) {
|
||||
tabPageCounter.initTabCounter(tab);
|
||||
}
|
||||
}
|
||||
}).catch(e => {
|
||||
throw e;
|
||||
});
|
||||
this.onFocusChangedCallback(windowId);
|
||||
});
|
||||
|
||||
browser.webRequest.onCompleted.addListener((details) => {
|
||||
@@ -146,21 +99,78 @@ const messageHandler = {
|
||||
assignManager.removeContextMenu();
|
||||
|
||||
browser.tabs.get(details.tabId).then((tab) => {
|
||||
tabPageCounter.incrementTabCount(tab);
|
||||
assignManager.calculateContextMenu(tab);
|
||||
}).catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
}, {urls: ["<all_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
|
||||
browser.tabs.onCreated.addListener((details) => {
|
||||
this.lastCreatedTab = details;
|
||||
this.lastCreatedTab = tab;
|
||||
if (tab.cookieStoreId) {
|
||||
// Don't count firefox-default, firefox-private, nor our own confirm page loads
|
||||
if (tab.cookieStoreId !== "firefox-default" &&
|
||||
tab.cookieStoreId !== "firefox-private" &&
|
||||
!tab.url.startsWith("moz-extension")) {
|
||||
// increment the counter of container tabs opened
|
||||
this.incrementCountOfContainerTabsOpened();
|
||||
}
|
||||
|
||||
this.unhideContainer(tab.cookieStoreId);
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.lastCreatedTab = null;
|
||||
}, this.LAST_CREATED_TAB_TIMER);
|
||||
});
|
||||
},
|
||||
|
||||
async incrementCountOfContainerTabsOpened() {
|
||||
const key = "containerTabsOpened";
|
||||
const count = await browser.storage.local.get({[key]: 0});
|
||||
const countOfContainerTabsOpened = ++count[key];
|
||||
browser.storage.local.set({[key]: countOfContainerTabsOpened});
|
||||
|
||||
// When the user opens their _ tab, give them the achievement
|
||||
if (countOfContainerTabsOpened === 100) {
|
||||
const storage = await browser.storage.local.get({achievements: []});
|
||||
storage.achievements.push({"name": "manyContainersOpened", "done": false});
|
||||
// use set and spread to create a unique array
|
||||
const achievements = [...new Set(storage.achievements)];
|
||||
browser.storage.local.set({achievements});
|
||||
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
|
||||
browser.browserAction.setBadgeText({text: "NEW"});
|
||||
}
|
||||
},
|
||||
|
||||
async unhideContainer(cookieStoreId) {
|
||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||
this.unhideQueue.push(cookieStoreId);
|
||||
// Unhide all hidden tabs
|
||||
await backgroundLogic.showTabs({
|
||||
cookieStoreId
|
||||
});
|
||||
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
||||
}
|
||||
},
|
||||
|
||||
async onFocusChangedCallback(windowId) {
|
||||
assignManager.removeContextMenu();
|
||||
// browserAction loses background color in new windows ...
|
||||
// https://bugzil.la/1314674
|
||||
// https://github.com/mozilla/testpilot-containers/issues/608
|
||||
// ... so re-call displayBrowserActionBadge on window changes
|
||||
badge.displayBrowserActionBadge();
|
||||
browser.tabs.query({active: true, windowId}).then((tabs) => {
|
||||
if (tabs && tabs[0]) {
|
||||
assignManager.calculateContextMenu(tabs[0]);
|
||||
}
|
||||
}).catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const tabPageCounter = {
|
||||
counters: {},
|
||||
|
||||
initTabCounter(tab) {
|
||||
if (tab.id in this.counters) {
|
||||
if (!("activity" in this.counters[tab.id])) {
|
||||
this.counters[tab.id].activity = {
|
||||
"cookieStoreId": tab.cookieStoreId,
|
||||
"pageRequests": 0
|
||||
};
|
||||
}
|
||||
if (!("tab" in this.counters[tab.id])) {
|
||||
this.counters[tab.id].tab = {
|
||||
"cookieStoreId": tab.cookieStoreId,
|
||||
"pageRequests": 0
|
||||
};
|
||||
}
|
||||
} else {
|
||||
this.counters[tab.id] = {};
|
||||
this.counters[tab.id].tab = {
|
||||
"cookieStoreId": tab.cookieStoreId,
|
||||
"pageRequests": 0
|
||||
};
|
||||
this.counters[tab.id].activity = {
|
||||
"cookieStoreId": tab.cookieStoreId,
|
||||
"pageRequests": 0
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
sendTabCountAndDelete(tabId, why = "user-closed-tab") {
|
||||
if (!(this.counters[tabId])) {
|
||||
return;
|
||||
}
|
||||
if (why === "user-closed-tab" && this.counters[tabId].tab) {
|
||||
// When we send the ping because the user closed the tab,
|
||||
// delete both the 'tab' and 'activity' counters
|
||||
delete this.counters[tabId];
|
||||
} else if (why === "user-went-idle" && this.counters[tabId].activity) {
|
||||
// When we send the ping because the user went idle,
|
||||
// only reset the 'activity' counter
|
||||
this.counters[tabId].activity = {
|
||||
"cookieStoreId": this.counters[tabId].tab.cookieStoreId,
|
||||
"pageRequests": 0
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
incrementTabCount(tab) {
|
||||
this.initTabCounter(tab);
|
||||
this.counters[tab.id].tab.pageRequests++;
|
||||
this.counters[tab.id].activity.pageRequests++;
|
||||
}
|
||||
};
|
||||
@@ -20,11 +20,15 @@ async function doAnimation(element, property, value) {
|
||||
async function addMessage(message) {
|
||||
const divElement = document.createElement("div");
|
||||
divElement.classList.add("container-notification");
|
||||
// For the eager eyed, this is an experiment. It is however likely that a website will know it is "contained" anyway
|
||||
// Ideally we would use https://bugzilla.mozilla.org/show_bug.cgi?id=1340930 when this is available
|
||||
divElement.innerText = message.text;
|
||||
|
||||
const imageElement = document.createElement("img");
|
||||
imageElement.src = browser.extension.getURL("/img/container-site-d-24.png");
|
||||
const imagePath = browser.extension.getURL("/img/container-site-d-24.png");
|
||||
const response = await fetch(imagePath);
|
||||
const blob = await response.blob();
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
imageElement.src = objectUrl;
|
||||
divElement.prepend(imageElement);
|
||||
|
||||
document.body.appendChild(divElement);
|
||||
|
||||
+73
-24
@@ -22,6 +22,7 @@ const P_CONTAINERS_EDIT = "containersEdit";
|
||||
const P_CONTAINER_INFO = "containerInfo";
|
||||
const P_CONTAINER_EDIT = "containerEdit";
|
||||
const P_CONTAINER_DELETE = "containerDelete";
|
||||
const P_CONTAINERS_ACHIEVEMENT = "containersAchievement";
|
||||
|
||||
/**
|
||||
* Escapes any occurances of &, ", <, > or / with XML entities.
|
||||
@@ -90,27 +91,16 @@ const Logic = {
|
||||
|
||||
// Routing to the correct panel.
|
||||
// If localStorage is disabled, we don't show the onboarding.
|
||||
const data = await browser.storage.local.get([ONBOARDING_STORAGE_KEY]);
|
||||
let onboarded = data[ONBOARDING_STORAGE_KEY];
|
||||
const onboardingData = await browser.storage.local.get([ONBOARDING_STORAGE_KEY]);
|
||||
let onboarded = onboardingData[ONBOARDING_STORAGE_KEY];
|
||||
if (!onboarded) {
|
||||
// Legacy local storage used before panel 5
|
||||
if (localStorage.getItem("onboarded4")) {
|
||||
onboarded = 4;
|
||||
} else if (localStorage.getItem("onboarded3")) {
|
||||
onboarded = 3;
|
||||
} else if (localStorage.getItem("onboarded2")) {
|
||||
onboarded = 2;
|
||||
} else if (localStorage.getItem("onboarded1")) {
|
||||
onboarded = 1;
|
||||
} else {
|
||||
onboarded = 0;
|
||||
}
|
||||
this.setOnboardingStage(onboarded);
|
||||
}
|
||||
|
||||
switch (onboarded) {
|
||||
case 5:
|
||||
this.showPanel(P_CONTAINERS_LIST);
|
||||
this.showAchievementOrContainersListPanel();
|
||||
break;
|
||||
case 4:
|
||||
this.showPanel(P_ONBOARDING_5);
|
||||
@@ -132,6 +122,37 @@ 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;
|
||||
}
|
||||
}
|
||||
if (showAchievements) {
|
||||
this.showPanel(P_CONTAINERS_ACHIEVEMENT);
|
||||
} else {
|
||||
this.showPanel(P_CONTAINERS_LIST);
|
||||
}
|
||||
},
|
||||
|
||||
// In case the user wants to click multiple actions,
|
||||
// they have to click the "Done" button to stop the panel
|
||||
// from showing
|
||||
async setAchievementDone(achievementName) {
|
||||
const achievementsStorage = await browser.storage.local.get({achievements: []});
|
||||
const achievements = achievementsStorage.achievements;
|
||||
achievements.forEach((achievement, index, achievementsArray) => {
|
||||
if (achievement.name === achievementName) {
|
||||
achievement.done = true;
|
||||
achievementsArray[index] = achievement;
|
||||
}
|
||||
});
|
||||
browser.storage.local.set({achievements});
|
||||
},
|
||||
|
||||
setOnboardingStage(stage) {
|
||||
return browser.storage.local.set({
|
||||
[ONBOARDING_STORAGE_KEY]: stage
|
||||
@@ -144,7 +165,11 @@ const Logic = {
|
||||
browser.browserAction.setBadgeBackgroundColor({color: ""});
|
||||
browser.browserAction.setBadgeText({text: ""});
|
||||
storage.browserActionBadgesClicked.push(extensionInfo.version);
|
||||
browser.storage.local.set({browserActionBadgesClicked: storage.browserActionBadgesClicked});
|
||||
// use set and spread to create a unique array
|
||||
const browserActionBadgesClicked = [...new Set(storage.browserActionBadgesClicked)];
|
||||
browser.storage.local.set({
|
||||
browserActionBadgesClicked
|
||||
});
|
||||
},
|
||||
|
||||
async identity(cookieStoreId) {
|
||||
@@ -168,6 +193,7 @@ const Logic = {
|
||||
});
|
||||
element.addEventListener("keydown", (e) => {
|
||||
if (e.keyCode === 13) {
|
||||
e.preventDefault();
|
||||
handler(e);
|
||||
}
|
||||
});
|
||||
@@ -190,7 +216,10 @@ const Logic = {
|
||||
const [identities, state] = await Promise.all([
|
||||
browser.contextualIdentities.query({}),
|
||||
browser.runtime.sendMessage({
|
||||
method: "queryIdentitiesState"
|
||||
method: "queryIdentitiesState",
|
||||
message: {
|
||||
windowId: browser.windows.WINDOW_ID_CURRENT
|
||||
}
|
||||
})
|
||||
]);
|
||||
this._identities = identities.map((identity) => {
|
||||
@@ -451,7 +480,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
panelSelector: "#container-panel",
|
||||
|
||||
// This method is called when the object is registered.
|
||||
initialize() {
|
||||
async initialize() {
|
||||
Logic.addEnterHandler(document.querySelector("#container-add-link"), () => {
|
||||
Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() });
|
||||
});
|
||||
@@ -599,12 +628,8 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
|| e.target.parentNode.matches(".open-newtab")
|
||||
|| e.type === "keydown") {
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
method: "openTab",
|
||||
message: {
|
||||
userContextId: Logic.userContextId(identity.cookieStoreId),
|
||||
source: "pop-up"
|
||||
}
|
||||
browser.tabs.create({
|
||||
cookieStoreId: identity.cookieStoreId
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
@@ -654,6 +679,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
try {
|
||||
browser.runtime.sendMessage({
|
||||
method: identity.hasHiddenTabs ? "showTabs" : "hideTabs",
|
||||
windowId: browser.windows.WINDOW_ID_CURRENT,
|
||||
cookieStoreId: Logic.currentCookieStoreId()
|
||||
});
|
||||
window.close();
|
||||
@@ -685,6 +711,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
Logic.addEnterHandler(moveTabsEl, async function () {
|
||||
await browser.runtime.sendMessage({
|
||||
method: "moveTabsToWindow",
|
||||
windowId: browser.windows.WINDOW_ID_CURRENT,
|
||||
cookieStoreId: Logic.currentIdentity().cookieStoreId,
|
||||
});
|
||||
window.close();
|
||||
@@ -726,6 +753,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||
// Let's retrieve the list of tabs.
|
||||
const tabs = await browser.runtime.sendMessage({
|
||||
method: "getTabs",
|
||||
windowId: browser.windows.WINDOW_ID_CURRENT,
|
||||
cookieStoreId: Logic.currentIdentity().cookieStoreId
|
||||
});
|
||||
return this.buildInfoTable(tabs);
|
||||
@@ -800,7 +828,7 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
|
||||
</td>`;
|
||||
tr.querySelector(".container-name").textContent = identity.name;
|
||||
tr.querySelector(".edit-container").setAttribute("title", `Edit ${identity.name} container`);
|
||||
tr.querySelector(".remove-container").setAttribute("title", `Delete ${identity.name} container`);
|
||||
tr.querySelector(".remove-container").setAttribute("title", `Remove ${identity.name} container`);
|
||||
|
||||
|
||||
Logic.addEnterHandler(tr, e => {
|
||||
@@ -1019,4 +1047,25 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
|
||||
},
|
||||
});
|
||||
|
||||
// P_CONTAINERS_ACHIEVEMENT: Page for achievement.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Logic.registerPanel(P_CONTAINERS_ACHIEVEMENT, {
|
||||
panelSelector: ".achievement-panel",
|
||||
|
||||
// This method is called when the object is registered.
|
||||
initialize() {
|
||||
// Set done and move to the containers list panel.
|
||||
Logic.addEnterHandler(document.querySelector("#achievement-done-button"), async function () {
|
||||
await Logic.setAchievementDone("manyContainersOpened");
|
||||
Logic.showPanel(P_CONTAINERS_LIST);
|
||||
});
|
||||
},
|
||||
|
||||
// This method is called when the panel is shown.
|
||||
prepare() {
|
||||
return Promise.resolve(null);
|
||||
},
|
||||
});
|
||||
|
||||
Logic.init();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Containers Experiment",
|
||||
"version": "3.1.0",
|
||||
"name": "Firefox Multi-Account Containers",
|
||||
"version": "4.1.0",
|
||||
|
||||
"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.",
|
||||
"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"
|
||||
@@ -11,8 +11,7 @@
|
||||
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"strict_min_version": "51.0",
|
||||
"update_url": "https://testpilot.firefox.com/files/@testpilot-containers/updates.json"
|
||||
"strict_min_version": "53.0"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -45,7 +44,7 @@
|
||||
"browser_action": {
|
||||
"browser_style": true,
|
||||
"default_icon": "img/container-site.svg",
|
||||
"default_title": "Containers",
|
||||
"default_title": "Multi-Account Containers",
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
|
||||
|
||||
+29
-1
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Containers browserAction Popup</title>
|
||||
<title>Multi-Account Containers</title>
|
||||
<link rel="stylesheet" href="/css/popup.css">
|
||||
|
||||
</head>
|
||||
@@ -67,6 +67,34 @@
|
||||
<a href="#" id="onboarding-longpress-button" class="onboarding-button">Done</a>
|
||||
</div>
|
||||
|
||||
<div class="panel achievement-panel hide" id="achievement-panel">
|
||||
<img class="onboarding-img" alt="You achieved a Containers milestone!" src="/img/onboarding-3.png" />
|
||||
<h3 class="onboarding-title">100 tabs!</h3>
|
||||
<p>You've opened 100 Container tabs.</p>
|
||||
<p>If you enjoy Containers, help us spread the word!</p>
|
||||
<p class="share-ctas">
|
||||
<a class="cta-link" href="https://mzl.la/2gJtIZ4" id="achievement-rate-button" target="_blank">
|
||||
<span class="cta amo-rate-cta">
|
||||
<img src="/img/amo-icon.svg" class="cta-icon" alt="addons.mozilla.org Icon">
|
||||
Rate
|
||||
</span>
|
||||
</a>
|
||||
<a class="cta-link" href="https://bit.ly/fb-share-mac-addon" target="_blank">
|
||||
<span class="cta fb-share-cta">
|
||||
<img src="/img/webicon-facebook.svg" class="cta-icon" alt="Facebook Icon">
|
||||
Share
|
||||
</span>
|
||||
</a>
|
||||
<a class="cta-link" href="http://bit.ly/tweet-100-tabs-mac-addon" target="_blank">
|
||||
<span class="cta tweet-cta">
|
||||
<img src="/img/webicon-twitter.svg" class="cta-icon" alt="Twitter Icon">
|
||||
Tweet
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
<a href="#" id="achievement-done-button" class="onboarding-button">Done</a>
|
||||
</div>
|
||||
|
||||
<div class="panel container-panel hide" id="container-panel">
|
||||
<div id="current-tab">
|
||||
<h3>Current Tab</h3>
|
||||
|
||||
Reference in New Issue
Block a user