2019-11-11 23:31:37 -05:00
|
|
|
var titlepref = chrome.i18n.getMessage("titlePreface");
|
|
|
|
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
|
|
|
|
var webpref = chrome.i18n.getMessage("webPreface");
|
|
|
|
var webprefpriv = chrome.i18n.getMessage("webPrefacePrivate");
|
|
|
|
var routerpref = chrome.i18n.getMessage("routerPreface");
|
|
|
|
var routerprefpriv = chrome.i18n.getMessage("routerPrefacePrivate");
|
|
|
|
var mailpref = chrome.i18n.getMessage("mailPreface");
|
|
|
|
var mailprefpriv = chrome.i18n.getMessage("mailPrefacePrivate");
|
|
|
|
var torrentpref = chrome.i18n.getMessage("torrentPreface");
|
|
|
|
var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate");
|
|
|
|
var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface");
|
|
|
|
var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate");
|
2019-12-24 18:44:58 -05:00
|
|
|
var localpref = chrome.i18n.getMessage("i2ptunnelPreface");
|
2019-11-11 23:31:37 -05:00
|
|
|
|
2019-10-06 13:58:26 -04:00
|
|
|
var contextScrub = async function(requestDetails) {
|
2019-10-06 15:18:10 -04:00
|
|
|
console.log("(scrub)Scrubbing info from contextualized request");
|
|
|
|
try {
|
|
|
|
var headerScrub = function(context) {
|
|
|
|
if (!context) {
|
2019-11-24 22:18:27 -05:00
|
|
|
console.error("Context not found", context);
|
2019-11-11 23:31:37 -05:00
|
|
|
} else if (context.name == titlepref) {
|
2019-11-10 20:28:31 -05:00
|
|
|
var ua = "MYOB/6.66 (AN/ON)";
|
|
|
|
if (i2pHost(requestDetails.url)) {
|
|
|
|
for (var header of requestDetails.requestHeaders) {
|
|
|
|
if (header.name.toLowerCase() === "user-agent") {
|
|
|
|
header.value = ua;
|
|
|
|
console.log("(scrub)User-Agent header modified", header.value);
|
2019-10-06 13:58:26 -04:00
|
|
|
}
|
2019-10-06 15:18:10 -04:00
|
|
|
}
|
2019-10-06 13:58:26 -04:00
|
|
|
}
|
2019-11-10 20:28:31 -05:00
|
|
|
return {
|
|
|
|
requestHeaders: requestDetails.requestHeaders
|
|
|
|
};
|
2019-11-11 23:31:37 -05:00
|
|
|
} else if (context.name == routerpref) {
|
2019-11-10 20:28:31 -05:00
|
|
|
var ua = "MYOB/6.66 (AN/ON)";
|
|
|
|
if (i2pHost(requestDetails.url)) {
|
|
|
|
for (var header of requestDetails.requestHeaders) {
|
|
|
|
if (header.name.toLowerCase() === "user-agent") {
|
|
|
|
header.value = ua;
|
|
|
|
console.log("(scrub)User-Agent header modified", header.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (routerHost(requestDetails.url)) {
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
requestHeaders: requestDetails.requestHeaders
|
|
|
|
};
|
2019-10-06 15:18:10 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var contextGet = async function(tabInfo) {
|
|
|
|
try {
|
|
|
|
console.log("(scrub)Tab info from Function", tabInfo);
|
2019-12-24 20:57:56 -05:00
|
|
|
let context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
|
2019-10-06 15:18:10 -04:00
|
|
|
return context;
|
|
|
|
} catch (error) {
|
2019-11-27 00:31:10 -05:00
|
|
|
return "firefox-default";
|
2019-10-06 15:18:10 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var tabGet = async function(tabId) {
|
|
|
|
try {
|
|
|
|
console.log("(scrub)Tab ID from Request", tabId);
|
|
|
|
let tabInfo = await browser.tabs.get(tabId);
|
|
|
|
return tabInfo;
|
|
|
|
} catch (error) {
|
2019-11-27 00:58:53 -05:00
|
|
|
let tabInfo = await browser.tabs.getCurrent();
|
|
|
|
return tabInfo;
|
2019-10-06 15:18:10 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
if (requestDetails.tabId > 0) {
|
2019-11-10 20:28:31 -05:00
|
|
|
var tab = {};
|
|
|
|
var context = {};
|
|
|
|
var req = {};
|
2019-10-08 19:10:13 -04:00
|
|
|
if (i2pHost(requestDetails.url)) {
|
2019-11-27 00:03:44 -05:00
|
|
|
console.log("(scrub)I2P URL detected, ");
|
2019-11-10 20:28:31 -05:00
|
|
|
tab = tabGet(requestDetails.tabId);
|
2019-11-24 23:29:06 -05:00
|
|
|
context = tab.then(contextGet, onError);
|
2019-11-24 22:32:12 -05:00
|
|
|
req = await context.then(headerScrub, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
console.log("(scrub)Scrubbing I2P Request", req);
|
|
|
|
return req;
|
2019-11-11 16:34:41 -05:00
|
|
|
} else if (routerHost(requestDetails.url)) {
|
2019-11-10 20:28:31 -05:00
|
|
|
tab = tabGet(requestDetails.tabId);
|
2019-11-24 22:32:12 -05:00
|
|
|
context = tab.then(contextGet, onError);
|
|
|
|
req = await context.then(headerScrub, onError);
|
2019-11-10 22:24:10 -05:00
|
|
|
console.log("(scrub)Scrubbing non-I2P Request", req);
|
2019-10-07 18:45:52 -04:00
|
|
|
return req;
|
|
|
|
}
|
2019-11-11 16:34:41 -05:00
|
|
|
return req;
|
2019-10-06 13:58:26 -04:00
|
|
|
}
|
2019-10-06 15:18:10 -04:00
|
|
|
} catch (error) {
|
2019-10-07 20:52:03 -04:00
|
|
|
console.log("(scrub)Not scrubbing non-I2P request.", error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var contextSetup = async function(requestDetails) {
|
|
|
|
console.log("(isolate)Forcing I2P requests into context");
|
|
|
|
try {
|
2019-11-24 23:29:06 -05:00
|
|
|
var i2pTabFind = async function(tabId) {
|
2019-10-07 20:52:03 -04:00
|
|
|
try {
|
2019-11-10 20:28:31 -05:00
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: titlepref
|
2019-10-07 21:26:52 -04:00
|
|
|
});
|
2019-10-07 20:52:03 -04:00
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-10-07 21:26:52 -04:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-12-24 20:57:56 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab", tabId.id);
|
2019-11-27 00:58:53 -05:00
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-10-08 19:10:13 -04:00
|
|
|
}
|
2019-11-10 20:28:31 -05:00
|
|
|
var created = browser.tabs.create({
|
2019-10-08 19:10:13 -04:00
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-10-08 19:10:13 -04:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
|
|
|
}
|
2019-11-24 05:21:56 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-10-08 19:10:13 -04:00
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var routerTabFind = async function(tabId) {
|
|
|
|
try {
|
2019-11-10 20:28:31 -05:00
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: routerpref
|
2019-10-08 19:10:13 -04:00
|
|
|
});
|
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-11-11 16:34:41 -05:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-11-27 00:58:53 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-11-11 16:34:41 -05:00
|
|
|
}
|
|
|
|
var created = browser.tabs.create({
|
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
|
|
|
}
|
2019-11-24 05:21:56 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var i2ptunnelTabFind = async function(tabId) {
|
|
|
|
try {
|
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: tunnelpref
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-11-11 16:34:41 -05:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-11-27 00:58:53 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-11-11 16:34:41 -05:00
|
|
|
}
|
|
|
|
var created = browser.tabs.create({
|
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
|
|
|
}
|
2019-11-24 05:21:56 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var snarkTabFind = async function(tabId) {
|
|
|
|
try {
|
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: torrentpref
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-11-11 16:34:41 -05:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-11-27 00:58:53 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-11-11 16:34:41 -05:00
|
|
|
}
|
|
|
|
var created = browser.tabs.create({
|
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
|
|
|
}
|
2019-11-24 05:21:56 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var mailTabFind = async function(tabId) {
|
|
|
|
try {
|
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: mailpref
|
2019-11-11 16:34:41 -05:00
|
|
|
});
|
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-10-08 19:10:13 -04:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-11-27 00:58:53 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-10-07 21:26:52 -04:00
|
|
|
}
|
2019-11-10 20:28:31 -05:00
|
|
|
var created = browser.tabs.create({
|
2019-10-07 21:26:52 -04:00
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-10-07 21:26:52 -04:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
}
|
2019-11-24 05:21:56 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
2019-12-24 18:31:44 -05:00
|
|
|
var localTabFind = async function(tabId) {
|
|
|
|
try {
|
|
|
|
var context = await browser.contextualIdentities.query({
|
|
|
|
name: localpref
|
|
|
|
});
|
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-12-24 18:31:44 -05:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-12-24 18:31:44 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var created = browser.tabs.create({
|
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
|
|
|
url: requestDetails.url
|
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
|
|
|
}
|
|
|
|
var getting = browser.tabs.getCurrent();
|
|
|
|
getting.then(Create, onError);
|
|
|
|
return tabId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
2019-11-10 22:24:10 -05:00
|
|
|
var anyTabFind = async function(tabId) {
|
|
|
|
try {
|
|
|
|
var context = await browser.contextualIdentities.query({
|
2019-11-11 23:31:37 -05:00
|
|
|
name: webpref
|
2019-11-10 22:24:10 -05:00
|
|
|
});
|
2019-11-11 00:03:24 -05:00
|
|
|
console.log("(ISOLATE)", tabId.cookieStoreId);
|
2019-11-11 16:34:41 -05:00
|
|
|
if (
|
|
|
|
tabId.cookieStoreId == "firefox-default" ||
|
|
|
|
tabId.cookieStoreId == "firefox-private"
|
|
|
|
) {
|
2019-11-11 00:03:24 -05:00
|
|
|
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
2019-12-24 18:41:42 -05:00
|
|
|
function Create(currentTab) {
|
2019-11-11 00:03:24 -05:00
|
|
|
function onCreated(tab) {
|
2019-12-24 18:41:42 -05:00
|
|
|
if (tabId.id != tab.id) {
|
2019-11-27 00:58:53 -05:00
|
|
|
console.log("(isolate) Closing old, un-isolated tab");
|
|
|
|
browser.tabs.remove(tabId.id);
|
|
|
|
}
|
2019-11-11 00:03:24 -05:00
|
|
|
}
|
|
|
|
var created = browser.tabs.create({
|
|
|
|
active: true,
|
|
|
|
cookieStoreId: context[0].cookieStoreId,
|
2019-11-27 00:34:48 -05:00
|
|
|
url: requestDetails.url
|
2019-11-11 00:03:24 -05:00
|
|
|
});
|
|
|
|
created.then(onCreated, onError);
|
2019-11-10 22:24:10 -05:00
|
|
|
}
|
2019-11-24 17:43:43 -05:00
|
|
|
var getting = browser.tabs.getCurrent();
|
2019-11-24 22:32:12 -05:00
|
|
|
getting.then(Create, onError);
|
2019-11-24 17:43:43 -05:00
|
|
|
return tabId;
|
2019-11-10 22:24:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Context Error", error);
|
|
|
|
}
|
|
|
|
};
|
2019-10-07 20:52:03 -04:00
|
|
|
var tabGet = async function(tabId) {
|
|
|
|
try {
|
|
|
|
console.log("(isolate)Tab ID from Request", tabId);
|
|
|
|
let tabInfo = await browser.tabs.get(tabId);
|
|
|
|
return tabInfo;
|
|
|
|
} catch (error) {
|
|
|
|
console.log("(isolate)Tab error", error);
|
|
|
|
}
|
|
|
|
};
|
2019-11-26 22:45:49 -05:00
|
|
|
if (requestDetails == undefined) {
|
|
|
|
return requestDetails;
|
|
|
|
}
|
2019-10-07 20:52:03 -04:00
|
|
|
if (requestDetails.tabId > 0) {
|
2019-11-10 22:36:32 -05:00
|
|
|
if (proxyHost(requestDetails.url)) {
|
2019-11-22 13:24:19 -05:00
|
|
|
setcookie = browser.cookies.set({
|
|
|
|
firstPartyDomain: i2pHostName(requestDetails.url),
|
|
|
|
url: requestDetails.url,
|
|
|
|
secure: true
|
|
|
|
});
|
2019-11-24 17:28:58 -05:00
|
|
|
setcookie.then(onContextGotLog, onError);
|
2019-11-10 22:24:10 -05:00
|
|
|
return requestDetails;
|
|
|
|
}
|
2019-11-26 22:45:49 -05:00
|
|
|
console.log("(isolate)Request Details", requestDetails);
|
2019-11-26 01:07:48 -05:00
|
|
|
if (extensionHost(requestDetails.url)) {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
|
|
|
var mtab = tab.then(anyTabFind, onError);
|
|
|
|
return requestDetails;
|
|
|
|
}
|
2019-10-08 19:10:13 -04:00
|
|
|
if (i2pHost(requestDetails.url)) {
|
2019-11-22 13:24:19 -05:00
|
|
|
var setcookie = browser.cookies.set({
|
|
|
|
firstPartyDomain: i2pHostName(requestDetails.url),
|
|
|
|
url: requestDetails.url,
|
|
|
|
secure: true
|
|
|
|
});
|
2019-11-24 17:28:58 -05:00
|
|
|
setcookie.then(onContextGotLog, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-11-24 23:29:06 -05:00
|
|
|
var mtab = tab.then(i2pTabFind, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
return requestDetails;
|
2019-10-08 19:10:13 -04:00
|
|
|
}
|
2019-12-24 18:31:44 -05:00
|
|
|
let localhost = localHost(requestDetails.url);
|
2019-11-11 16:34:41 -05:00
|
|
|
let routerhost = routerHost(requestDetails.url);
|
2019-12-24 18:31:44 -05:00
|
|
|
if (localhost && !routerhost) {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
|
|
|
var mtab = tab.then(localTabFind, onError);
|
|
|
|
return requestDetails;
|
|
|
|
}
|
2019-11-11 16:34:41 -05:00
|
|
|
if (routerhost) {
|
|
|
|
if (routerhost === "i2ptunnelmgr") {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-11-24 22:32:12 -05:00
|
|
|
var mtab = tab.then(i2ptunnelTabFind, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return requestDetails;
|
|
|
|
} else if (routerhost === "i2psnark") {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-11-24 22:32:12 -05:00
|
|
|
var mtab = tab.then(snarkTabFind, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return requestDetails;
|
|
|
|
} else if (routerhost === "webmail") {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-11-24 22:32:12 -05:00
|
|
|
var mtab = tab.then(mailTabFind, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return requestDetails;
|
|
|
|
} else if (routerhost === "routerconsole") {
|
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-11-24 22:32:12 -05:00
|
|
|
var mtab = tab.then(routerTabFind, onError);
|
2019-11-11 16:34:41 -05:00
|
|
|
return requestDetails;
|
|
|
|
}
|
|
|
|
} else {
|
2019-10-07 20:52:03 -04:00
|
|
|
var tab = tabGet(requestDetails.tabId);
|
2019-12-24 18:41:42 -05:00
|
|
|
var mtab = tab.then(anyTabFind, onError);
|
2019-10-07 20:52:03 -04:00
|
|
|
return requestDetails;
|
|
|
|
}
|
|
|
|
}
|
2019-11-26 22:45:49 -05:00
|
|
|
if (typeof requestDetails == "number") {
|
|
|
|
tab = tabGet(requestDetails);
|
|
|
|
var mtab = tab.then(anyTabFind);
|
|
|
|
} else if (typeof requestDetails != undefined) {
|
|
|
|
if (typeof requestDetails.tabId > 0) {
|
|
|
|
tab = tabGet(requestDetails.tabId);
|
|
|
|
var mtab = tab.then(anyTabFind);
|
|
|
|
}
|
2019-11-26 01:07:48 -05:00
|
|
|
}
|
2019-11-10 22:36:32 -05:00
|
|
|
return requestDetails;
|
2019-10-07 20:52:03 -04:00
|
|
|
} catch (error) {
|
2019-11-10 20:28:31 -05:00
|
|
|
console.log("(isolate)Not an I2P request, blackholing", error);
|
2019-10-06 15:18:10 -04:00
|
|
|
}
|
|
|
|
};
|
2019-10-06 13:58:26 -04:00
|
|
|
|
2019-10-07 20:52:03 -04:00
|
|
|
browser.webRequest.onBeforeRequest.addListener(
|
|
|
|
contextSetup,
|
2019-12-24 16:51:38 -05:00
|
|
|
{ urls: ["<all_urls>"] },
|
2019-10-07 20:52:03 -04:00
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2019-10-06 13:58:26 -04:00
|
|
|
browser.webRequest.onBeforeSendHeaders.addListener(
|
2019-10-06 15:18:10 -04:00
|
|
|
contextScrub,
|
2019-12-24 16:51:38 -05:00
|
|
|
{ urls: ["<all_urls>"] },
|
|
|
|
["blocking", "requestHeaders"]
|
2019-10-06 13:58:26 -04:00
|
|
|
);
|