From 994c07c7ba7852523a9920c72ae702d61bd3a040 Mon Sep 17 00:00:00 2001 From: Bart Verhoeven Date: Sun, 9 Jun 2019 22:35:02 +0530 Subject: [PATCH 1/2] Open any url not assigned to a dedicated container into the default one. --- src/ui/URLMaps.js | 11 +++++++++-- src/webRequestListener.js | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ui/URLMaps.js b/src/ui/URLMaps.js index a7c5fa7..dbbf12e 100644 --- a/src/ui/URLMaps.js +++ b/src/ui/URLMaps.js @@ -1,5 +1,6 @@ import State from '../State'; import Storage from '../Storage'; +import {NO_CONTAINER} from '../ContextualIdentity'; import {qs, qsAll} from '../utils'; import {showLoader, hideLoader} from './loader'; import {showToast, hideToast} from './toast'; @@ -37,11 +38,17 @@ class URLMaps { for (const key in this.state.urlMaps) { const urlMap = this.state.urlMaps[key]; - if (this.state.selectedIdentity.cookieStoreId === urlMap.cookieStoreId) { - this.addItem(urlMap.host); + if (urlMap.cookieStoreId !== NO_CONTAINER.cookieStoreId) { + if (this.state.selectedIdentity.cookieStoreId === urlMap.cookieStoreId) { + this.addItem(urlMap.host); + } } } + let isDefaultContainer = this.state.selectedIdentity.cookieStoreId === NO_CONTAINER.cookieStoreId; + addButton.style.display = isDefaultContainer ? "none" : "initial"; + saveButton.style.display = isDefaultContainer ? "none" : "initial"; + hideLoader(); } diff --git a/src/webRequestListener.js b/src/webRequestListener.js index 6dc8cae..d248e1a 100644 --- a/src/webRequestListener.js +++ b/src/webRequestListener.js @@ -39,6 +39,11 @@ export const webRequestListener = (requestDetails) => { const hostIdentity = identities.find((identity) => identity.cookieStoreId === hostMap.cookieStoreId); const tabIdentity = identities.find((identity) => identity.cookieStoreId === currentTab.cookieStoreId); + if (!hostIdentity && currentTab.cookieStoreId !== NO_CONTAINER.cookieStoreId && tabIdentity) { + return createTab(requestDetails.url, currentTab.index + 1, currentTab.id); + } + + if (!hostIdentity) { return {}; } From 9c3be517f999e072d674f0c82364c694116a04ae Mon Sep 17 00:00:00 2001 From: Bart Verhoeven Date: Sun, 9 Jun 2019 22:38:43 +0530 Subject: [PATCH 2/2] Use single quotes to fix eslint errors. --- src/ui/URLMaps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/URLMaps.js b/src/ui/URLMaps.js index dbbf12e..b3b1e5f 100644 --- a/src/ui/URLMaps.js +++ b/src/ui/URLMaps.js @@ -46,8 +46,8 @@ class URLMaps { } let isDefaultContainer = this.state.selectedIdentity.cookieStoreId === NO_CONTAINER.cookieStoreId; - addButton.style.display = isDefaultContainer ? "none" : "initial"; - saveButton.style.display = isDefaultContainer ? "none" : "initial"; + addButton.style.display = isDefaultContainer ? 'none' : 'initial'; + saveButton.style.display = isDefaultContainer ? 'none' : 'initial'; hideLoader(); }