From fb7c6355d0ce1095d0854814bb7d39cfc826a004 Mon Sep 17 00:00:00 2001 From: Matvey Soloviev Date: Fri, 13 Apr 2018 06:49:25 -0400 Subject: [PATCH 1/3] When link to same domain is opened in a new tab, always keep the same container without asking. --- src/js/background/assignManager.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index a03a163..be59095 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -136,6 +136,19 @@ const assignManager = { this.deleteContainer(siteSettings.userContextId); return {}; } + + // If a page has been opened in a nonstandard container, the exemption flag for that + // tab will have been set, so following links in the same tab will not trigger new + // prompts about the container in which to open the page. However, opening links + // in a new tab will not be subject to this protection. + // To prevent this, explicitly allow requests that don't change host to go through. + if(options.originUrl) { + const originUrl = new window.URL(options.originUrl); + const newUrl = new window.URL(options.url); + if(originUrl.hostname === newUrl.hostname) + return {}; + } + const userContextId = this.getUserContextIdFromCookieStore(tab); if (!siteSettings || userContextId === siteSettings.userContextId From 2efb4a672ee677e8b5e9790ca7a45282f6c7b7f5 Mon Sep 17 00:00:00 2001 From: Matvey Soloviev Date: Fri, 13 Apr 2018 06:55:45 -0400 Subject: [PATCH 2/3] Remember that forked tabs are okay with the page's unnatural containment. --- src/js/background/assignManager.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index be59095..6e8e5d9 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -145,8 +145,12 @@ const assignManager = { if(options.originUrl) { const originUrl = new window.URL(options.originUrl); const newUrl = new window.URL(options.url); - if(originUrl.hostname === newUrl.hostname) + if(originUrl.hostname === newUrl.hostname) { + // in fact, set this URL-tab combo exempted so future manual browsing + // within it does also not trigger new prompts + this.storageArea.setExempted(options.url, options.tabId); return {}; + } } const userContextId = this.getUserContextIdFromCookieStore(tab); From 5914cefb8f5b49eca0b76f7e4a506d8410ad7832 Mon Sep 17 00:00:00 2001 From: Matvey Soloviev Date: Fri, 13 Apr 2018 07:40:21 -0400 Subject: [PATCH 3/3] Fix indentation for PR. --- src/js/background/assignManager.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index 6e8e5d9..b4ca932 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -143,14 +143,14 @@ const assignManager = { // in a new tab will not be subject to this protection. // To prevent this, explicitly allow requests that don't change host to go through. if(options.originUrl) { - const originUrl = new window.URL(options.originUrl); - const newUrl = new window.URL(options.url); - if(originUrl.hostname === newUrl.hostname) { - // in fact, set this URL-tab combo exempted so future manual browsing - // within it does also not trigger new prompts - this.storageArea.setExempted(options.url, options.tabId); - return {}; - } + const originUrl = new window.URL(options.originUrl); + const newUrl = new window.URL(options.url); + if(originUrl.hostname === newUrl.hostname) { + // in fact, set this URL-tab combo exempted so future manual browsing + // within it does also not trigger new prompts + this.storageArea.setExempted(options.url, options.tabId); + return {}; + } } const userContextId = this.getUserContextIdFromCookieStore(tab);