diff --git a/background.js b/background.js index 19cd056..3fdbcd3 100644 --- a/background.js +++ b/background.js @@ -14,6 +14,15 @@ function onGot(contexts) { }) .then(onCreated, onError); } + if (ids.indexOf("fenced-default") == -1) { + browser.contextualIdentities + .create({ + name: "fenced-default", + color: "toolbar", + icon: "fence" + }) + .then(onCreated, onError); + } if (ids.indexOf("routerconsole") == -1) { browser.contextualIdentities .create({ diff --git a/proxy.js b/proxy.js index f31f003..2ce453c 100644 --- a/proxy.js +++ b/proxy.js @@ -62,7 +62,7 @@ var handleContextProxyRequest = async function(requestDetails) { proxy.host + ":" + proxy.port ); return proxy; - } else if (context.name == "Personal") { + } else if (context.name == "fenced-default") { if (localHost(requestDetails.url)) { if (!routerHost(requestDetails.url)) { proxy = { diff --git a/scrub.js b/scrub.js index 193dfcc..04258e6 100644 --- a/scrub.js +++ b/scrub.js @@ -171,36 +171,39 @@ var contextSetup = async function(requestDetails) { var anyTabFind = async function(tabId) { try { var context = await browser.contextualIdentities.query({ - name: "Personal" + name: "fenced-default" }); - if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log( - "(isolate) forcing", - requestDetails.url, - " context", - tabId.cookieStoreId, - context[0].cookieStoreId - ); - function Create(window) { - function onCreated(tab) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); - browser.tabs.remove(window.tabs[0].id); + console.log("(ISOLATE)", tabId.cookieStoreId); + if (tabId.cookieStoreId == "firefox-default") { + if (tabId.cookieStoreId != context[0].cookieStoreId) { + console.log( + "(isolate) forcing", + requestDetails.url, + " context", + tabId.cookieStoreId, + context[0].cookieStoreId + ); + function Create(window) { + function onCreated(tab) { + console.log("(isolate) Closing old, un-isolated tab"); + browser.tabs.remove(tabId.id); + browser.tabs.remove(window.tabs[0].id); + } + function onError(error) { + console.log(`Error: ${error}`); + } + var created = browser.tabs.create({ + active: true, + cookieStoreId: context[0].cookieStoreId, + url: requestDetails.url, + windowId: window.id + }); + created.then(onCreated, onError); } - function onError(error) { - console.log(`Error: ${error}`); - } - var created = browser.tabs.create({ - active: true, - cookieStoreId: context[0].cookieStoreId, - url: requestDetails.url, - windowId: window.id - }); - created.then(onCreated, onError); + var getting = browser.windows.getCurrent(); + getting.then(Create); + return tabId; } - var getting = browser.windows.getCurrent(); - getting.then(Create); - return tabId; } } catch (error) { console.log("(isolate)Context Error", error);