From 16c9fbb19f432a28ae0dd6ba3026102a03adb170 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 24 Dec 2019 22:21:04 -0500 Subject: [PATCH] figure out why it isn't launching into containers like on desktop --- platform.js | 7 +++- scrub.js | 117 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 97 insertions(+), 27 deletions(-) diff --git a/platform.js b/platform.js index 9108c80..8efd4d7 100644 --- a/platform.js +++ b/platform.js @@ -11,7 +11,7 @@ var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate"); var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface"); var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate"); -var android = false; +var android; // = false; var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { @@ -21,10 +21,15 @@ gettingInfo.then(got => { return true; } else { console.log("Running in Desktop detected"); + android = false; return false; } }); function isDroid() { + console.log("android?", android); + if (android == undefined) { + return false; + } return android; } diff --git a/scrub.js b/scrub.js index 4d6349c..5a6b23b 100644 --- a/scrub.js +++ b/scrub.js @@ -104,15 +104,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log( - "(isolate) Closing old, un-isolated tab", - tabId.id, - "in favor of", - tab.id - ); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -137,10 +142,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -165,10 +180,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -193,10 +218,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -221,10 +256,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -249,10 +294,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true, @@ -282,10 +337,20 @@ var contextSetup = async function(requestDetails) { if (tabId.cookieStoreId != context[0].cookieStoreId) { function Create(currentTab) { function onCreated(tab) { - if (tabId.id != tab.id) { - console.log("(isolate) Closing old, un-isolated tab"); - browser.tabs.remove(tabId.id); + function closeOldTab(tab) { + if (!isDroid()) { + if (tabId.id != tab.id) { + console.log( + "(isolate) Closing old, un-isolated tab", + tabId.id, + "in favor of", + tab.id + ); + browser.tabs.remove(tabId.id); + } + } } + closeOldTab(tab); } var created = browser.tabs.create({ active: true,