Merge branch 'testing-6.0.0' into 1065_-_Feature_Request]_Pass_openerTabId_when_creating_tabs_in_order_to_know_the_parent
This commit is contained in:
commit
3bd33cda99
7 changed files with 76 additions and 16 deletions
|
@ -19,7 +19,7 @@ For more info, see:
|
|||
## Development
|
||||
|
||||
1. `npm install`
|
||||
2. `./node_modules/.bin/web-ext run -s src/
|
||||
2. `./node_modules/.bin/web-ext run -s src/`
|
||||
|
||||
### Testing
|
||||
TBD
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "testpilot-containers",
|
||||
"title": "Multi-Account Containers",
|
||||
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.1",
|
||||
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/testpilot-containers/issues"
|
||||
|
|
|
@ -132,7 +132,7 @@ const assignManager = {
|
|||
|
||||
// The container we have in the assignment map isn't present any more so lets remove it
|
||||
// then continue the existing load
|
||||
if (!container) {
|
||||
if (siteSettings && !container) {
|
||||
this.deleteContainer(siteSettings.userContextId);
|
||||
return {};
|
||||
}
|
||||
|
@ -147,6 +147,22 @@ const assignManager = {
|
|||
|| (messageHandler.lastCreatedTab
|
||||
&& messageHandler.lastCreatedTab.id === tab.id);
|
||||
const openTabId = removeTab ? tab.openerTabId : tab.id;
|
||||
|
||||
// we decided to cancel the request at this point, register it as canceled request as early as possible
|
||||
if (!this.canceledRequests[options.requestId]) {
|
||||
this.canceledRequests[options.requestId] = true;
|
||||
// register a cleanup for handled requestIds
|
||||
// all relevant requests that come in that timeframe with the same requestId will be canceled
|
||||
setTimeout(() => {
|
||||
delete this.canceledRequests[options.requestId];
|
||||
}, 2000);
|
||||
} else {
|
||||
// if we see a request for the same requestId at this point then this is a redirect that we have to cancel to prevent opening two tabs
|
||||
return {
|
||||
cancel: true
|
||||
};
|
||||
}
|
||||
|
||||
this.reloadPageInContainer(
|
||||
options.url,
|
||||
userContextId,
|
||||
|
@ -183,6 +199,7 @@ const assignManager = {
|
|||
});
|
||||
|
||||
// Before a request is handled by the browser we decide if we should route through a different container
|
||||
this.canceledRequests = {};
|
||||
browser.webRequest.onBeforeRequest.addListener((options) => {
|
||||
return this.onBeforeRequest(options);
|
||||
},{urls: ["<all_urls>"], types: ["main_frame"]}, ["blocking"]);
|
||||
|
|
|
@ -131,9 +131,13 @@ const backgroundLogic = {
|
|||
let newWindowObj;
|
||||
let hiddenDefaultTabToClose;
|
||||
if (list.length) {
|
||||
newWindowObj = await browser.windows.create({
|
||||
tabId: list.shift().id
|
||||
});
|
||||
newWindowObj = await browser.windows.create();
|
||||
|
||||
// Pin the default tab in the new window so existing pinned tabs can be moved after it.
|
||||
// From the docs (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/move):
|
||||
// Note that you can't move pinned tabs to a position after any unpinned tabs in a window, or move any unpinned tabs to a position before any pinned tabs.
|
||||
await browser.tabs.update(newWindowObj.tabs[0].id, { pinned: true });
|
||||
|
||||
browser.tabs.move(list.map((tab) => tab.id), {
|
||||
windowId: newWindowObj.id,
|
||||
index: -1
|
||||
|
|
|
@ -72,6 +72,42 @@ const messageHandler = {
|
|||
return response;
|
||||
});
|
||||
|
||||
// Handles external messages from webextensions
|
||||
const externalExtensionAllowed = {};
|
||||
browser.runtime.onMessageExternal.addListener(async (message, sender) => {
|
||||
if (!externalExtensionAllowed[sender.id]) {
|
||||
const extensionInfo = await browser.management.get(sender.id);
|
||||
if (!extensionInfo.permissions.includes("contextualIdentities")) {
|
||||
throw new Error("Missing contextualIdentities permission");
|
||||
}
|
||||
externalExtensionAllowed[sender.id] = true;
|
||||
}
|
||||
let response;
|
||||
switch (message.method) {
|
||||
case "getAssignment":
|
||||
if (typeof message.url === "undefined") {
|
||||
throw new Error("Missing message.url");
|
||||
}
|
||||
response = assignManager.storageArea.get(message.url);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unknown message.method");
|
||||
}
|
||||
return response;
|
||||
});
|
||||
// Delete externalExtensionAllowed if add-on installs/updates; permissions might change
|
||||
browser.management.onInstalled.addListener(extensionInfo => {
|
||||
if (externalExtensionAllowed[extensionInfo.id]) {
|
||||
delete externalExtensionAllowed[extensionInfo.id];
|
||||
}
|
||||
});
|
||||
// Delete externalExtensionAllowed if add-on uninstalls; not needed anymore
|
||||
browser.management.onUninstalled.addListener(extensionInfo => {
|
||||
if (externalExtensionAllowed[extensionInfo.id]) {
|
||||
delete externalExtensionAllowed[extensionInfo.id];
|
||||
}
|
||||
});
|
||||
|
||||
if (browser.contextualIdentities.onRemoved) {
|
||||
browser.contextualIdentities.onRemoved.addListener(({contextualIdentity}) => {
|
||||
const userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(contextualIdentity.cookieStoreId);
|
||||
|
|
|
@ -524,7 +524,8 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||
previous();
|
||||
break;
|
||||
default:
|
||||
if (e.keyCode >= 49 && e.keyCode <= 57) {
|
||||
if ((e.keyCode >= 49 && e.keyCode <= 57) &&
|
||||
Logic._currentPanel === "containersList") {
|
||||
const element = selectables[e.keyCode - 48];
|
||||
if (element) {
|
||||
element.click();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Firefox Multi-Account Containers",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.1",
|
||||
|
||||
"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": {
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "@testpilot-containers",
|
||||
"strict_min_version": "57.0"
|
||||
}
|
||||
},
|
||||
|
@ -25,6 +26,7 @@
|
|||
"contextualIdentities",
|
||||
"history",
|
||||
"idle",
|
||||
"management",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webRequestBlocking",
|
||||
|
|
Loading…
Add table
Reference in a new issue