isolate by default, don't ever use firefox-default, replace with our own

This commit is contained in:
idk
2019-11-11 00:03:24 -05:00
parent d770abcce8
commit 2e8a61de2e
3 changed files with 40 additions and 28 deletions

View File

@@ -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({

View File

@@ -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 = {

View File

@@ -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);