Merge pull request #1512 from romanrodriguez/patch-1
Fix #930 - Disable extension in incognito mode
This commit is contained in:
commit
7fa2d494c4
5 changed files with 24 additions and 35 deletions
|
@ -9,8 +9,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ajv": "^6.6.2",
|
|
||||||
"addons-linter": "^1.3.2",
|
"addons-linter": "^1.3.2",
|
||||||
|
"ajv": "^6.6.2",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"eslint": "^3.17.1",
|
"eslint": "^3.17.1",
|
||||||
"eslint-plugin-no-unsanitized": "^2.0.0",
|
"eslint-plugin-no-unsanitized": "^2.0.0",
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
"stylelint": "^7.9.0",
|
"stylelint": "^7.9.0",
|
||||||
"stylelint-config-standard": "^16.0.0",
|
"stylelint-config-standard": "^16.0.0",
|
||||||
"stylelint-order": "^0.3.0",
|
"stylelint-order": "^0.3.0",
|
||||||
"web-ext": "^2.2.2"
|
"web-ext": "^2.9.3"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/mozilla/multi-account-containers#readme",
|
"homepage": "https://github.com/mozilla/multi-account-containers#readme",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|
|
@ -143,7 +143,6 @@ const assignManager = {
|
||||||
const userContextId = this.getUserContextIdFromCookieStore(tab);
|
const userContextId = this.getUserContextIdFromCookieStore(tab);
|
||||||
if (!siteSettings
|
if (!siteSettings
|
||||||
|| userContextId === siteSettings.userContextId
|
|| userContextId === siteSettings.userContextId
|
||||||
|| tab.incognito
|
|
||||||
|| this.storageArea.isExempted(options.url, tab.id)) {
|
|| this.storageArea.isExempted(options.url, tab.id)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -289,11 +288,9 @@ const assignManager = {
|
||||||
|
|
||||||
isTabPermittedAssign(tab) {
|
isTabPermittedAssign(tab) {
|
||||||
// Ensure we are not an important about url
|
// Ensure we are not an important about url
|
||||||
// Ensure we are not in incognito mode
|
|
||||||
const url = new URL(tab.url);
|
const url = new URL(tab.url);
|
||||||
if (url.protocol === "about:"
|
if (url.protocol === "about:"
|
||||||
|| url.protocol === "moz-extension:"
|
|| url.protocol === "moz-extension:") {
|
||||||
|| tab.incognito) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,22 +2,17 @@ const MAJOR_VERSIONS = ["2.3.0", "2.4.0"];
|
||||||
const badge = {
|
const badge = {
|
||||||
async init() {
|
async init() {
|
||||||
const currentWindow = await browser.windows.getCurrent();
|
const currentWindow = await browser.windows.getCurrent();
|
||||||
this.displayBrowserActionBadge(currentWindow.incognito);
|
this.displayBrowserActionBadge(currentWindow);
|
||||||
},
|
|
||||||
|
|
||||||
disableAddon(tabId) {
|
|
||||||
browser.browserAction.disable(tabId);
|
|
||||||
browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async displayBrowserActionBadge() {
|
async displayBrowserActionBadge() {
|
||||||
const extensionInfo = await backgroundLogic.getExtensionInfo();
|
const extensionInfo = await backgroundLogic.getExtensionInfo();
|
||||||
const storage = await browser.storage.local.get({browserActionBadgesClicked: []});
|
const storage = await browser.storage.local.get({ browserActionBadgesClicked: [] });
|
||||||
|
|
||||||
if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 &&
|
if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 &&
|
||||||
storage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) {
|
storage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) {
|
||||||
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
|
browser.browserAction.setBadgeBackgroundColor({ color: "rgba(0,217,0,255)" });
|
||||||
browser.browserAction.setBadgeText({text: "NEW"});
|
browser.browserAction.setBadgeText({ text: "NEW" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -141,9 +141,6 @@ const messageHandler = {
|
||||||
}, {urls: ["<all_urls>"], types: ["main_frame"]});
|
}, {urls: ["<all_urls>"], types: ["main_frame"]});
|
||||||
|
|
||||||
browser.tabs.onCreated.addListener((tab) => {
|
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
|
// lets remember the last tab created so we can close it if it looks like a redirect
|
||||||
this.lastCreatedTab = tab;
|
this.lastCreatedTab = tab;
|
||||||
if (tab.cookieStoreId) {
|
if (tab.cookieStoreId) {
|
||||||
|
|
|
@ -2,22 +2,19 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Firefox Multi-Account Containers",
|
"name": "Firefox Multi-Account Containers",
|
||||||
"version": "6.1.1",
|
"version": "6.1.1",
|
||||||
|
"incognito": "not_allowed",
|
||||||
"description": "Multi-Account Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
"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": {
|
"icons": {
|
||||||
"48": "img/container-site-d-48.png",
|
"48": "img/container-site-d-48.png",
|
||||||
"96": "img/container-site-d-96.png"
|
"96": "img/container-site-d-96.png"
|
||||||
},
|
},
|
||||||
|
|
||||||
"applications": {
|
"applications": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "@testpilot-containers",
|
"id": "@testpilot-containers",
|
||||||
"strict_min_version": "57.0"
|
"strict_min_version": "67.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"homepage_url": "https://github.com/mozilla/multi-account-containers#readme",
|
"homepage_url": "https://github.com/mozilla/multi-account-containers#readme",
|
||||||
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"<all_urls>",
|
"<all_urls>",
|
||||||
"activeTab",
|
"activeTab",
|
||||||
|
@ -32,7 +29,6 @@
|
||||||
"webRequestBlocking",
|
"webRequestBlocking",
|
||||||
"webRequest"
|
"webRequest"
|
||||||
],
|
],
|
||||||
|
|
||||||
"commands": {
|
"commands": {
|
||||||
"_execute_browser_action": {
|
"_execute_browser_action": {
|
||||||
"suggested_key": {
|
"suggested_key": {
|
||||||
|
@ -42,32 +38,36 @@
|
||||||
"description": "Open containers panel"
|
"description": "Open containers panel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"browser_style": true,
|
"browser_style": true,
|
||||||
"default_icon": "img/container-site.svg",
|
"default_icon": "img/container-site.svg",
|
||||||
"default_title": "Multi-Account Containers",
|
"default_title": "Multi-Account Containers",
|
||||||
"default_popup": "popup.html",
|
"default_popup": "popup.html",
|
||||||
"theme_icons": [{
|
"theme_icons": [
|
||||||
|
{
|
||||||
"light": "img/container-site-light.svg",
|
"light": "img/container-site-light.svg",
|
||||||
"dark": "img/container-site.svg",
|
"dark": "img/container-site.svg",
|
||||||
"size": 32
|
"size": 32
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"background": {
|
"background": {
|
||||||
"page": "js/background/index.html"
|
"page": "js/background/index.html"
|
||||||
},
|
},
|
||||||
|
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["<all_urls>"],
|
"matches": [
|
||||||
"js": ["js/content-script.js"],
|
"<all_urls>"
|
||||||
"css": ["css/content.css"],
|
],
|
||||||
|
"js": [
|
||||||
|
"js/content-script.js"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"css/content.css"
|
||||||
|
],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"/img/container-site-d-24.png"
|
"/img/container-site-d-24.png"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue