From 5fbd32e6eb51fcb2c994c38b95f404dc0ec4dddb Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 25 Feb 2020 15:19:15 -0500 Subject: [PATCH] exit router console tabs when leaving the router console --- Makefile | 3 +++ scrub.js | 56 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 9f77be9..c019fdf 100644 --- a/Makefile +++ b/Makefile @@ -260,6 +260,9 @@ fmt: tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes home.html > .home.html; mv .home.html home.html tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes toopie.html > .toopie.html; mv .toopie.html toopie.html tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes options/options.html > options/.options.html; mv options/.options.html options/options.html + make fmt-js + +fmt-js: find . -path ./node_modules -prune -o -name '*.js' -exec prettier --write {} \; find . -path ./node_modules -prune -o -name '*.json' -exec prettier --write {} \; diff --git a/scrub.js b/scrub.js index ee7dd0d..f0692dd 100644 --- a/scrub.js +++ b/scrub.js @@ -291,40 +291,43 @@ var contextSetup = function(requestDetails) { console.log("(isolate)Context Error", error); } }; - var anyTabFind = async function(tabId) { + var normalTabFind = async function(tabId) { try { - var context = await browser.contextualIdentities.query({ - name: webpref + var anoncontext = await browser.contextualIdentities.query({ + name: titlepref + }); + var localcontext = await browser.contextualIdentities.query({ + name: localpref }); console.log("(ISOLATE)", tabId.cookieStoreId); if ( - tabId.cookieStoreId == "firefox-default" || - tabId.cookieStoreId == "firefox-private" + tabId.cookieStoreId != "firefox-default" || + tabId.cookieStoreId != "firefox-private" || + tabId.cookieStoreId != anoncontext[0].cookieStoreId || + tabId.cookieStoreId != localcontext[0].cookieStoreId ) { - if (tabId.cookieStoreId != context[0].cookieStoreId) { - function Create() { - function onCreated(tab) { - function closeOldTab() { - if (tabId.id != tab.id) { - console.log("(isolate) Closing un-isolated tab", tabId.id); - console.log("in favor of", tab.id); - console.log("with context", tab.cookieStoreId); - browser.tabs.remove(tabId.id); - } + function Create() { + function onCreated(tab) { + function closeOldTab() { + if (tabId.id != tab.id) { + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); + browser.tabs.remove(tabId.id); } - closeOldTab(tab); } - var created = browser.tabs.create({ - active: true, - cookieStoreId: context[0].cookieStoreId, - url: requestDetails.url - }); - created.then(onCreated, onContextError); + closeOldTab(tab); } - var gettab = browser.tabs.get(tabId.id); - gettab.then(Create, onContextError); - return tabId; + var created = browser.tabs.create({ + active: true, + cookieStoreId: "firefox-default", + url: requestDetails.url + }); + created.then(onCreated, onContextError); } + var gettab = browser.tabs.get(tabId.id); + gettab.then(Create, onContextError); + return tabId; } } catch (error) { console.log("(isolate)Context Error", error); @@ -373,6 +376,9 @@ var contextSetup = function(requestDetails) { if (localhost) { var localtab = tab.then(localTabFind, onContextError); return requestDetails; + } else { + //var normalTab = tab.then(normalTabFind, onContextError) + return requestDetails; } } if (routerhost) {