Replaced window with global and modified eslintrc
This commit is contained in:
parent
70511e2722
commit
3a0af38900
5 changed files with 14 additions and 13 deletions
|
@ -18,7 +18,8 @@ module.exports = {
|
||||||
"XPCOMUtils": true,
|
"XPCOMUtils": true,
|
||||||
"OS": true,
|
"OS": true,
|
||||||
"ADDON_UNINSTALL": true,
|
"ADDON_UNINSTALL": true,
|
||||||
"ADDON_DISABLE": true
|
"ADDON_DISABLE": true,
|
||||||
|
"proxifiedContainers": true
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"promise",
|
"promise",
|
||||||
|
|
|
@ -122,7 +122,7 @@ const assignManager = {
|
||||||
return {type: "direct"};
|
return {type: "direct"};
|
||||||
|
|
||||||
const tab = await browser.tabs.get(requestInfo.tabId);
|
const tab = await browser.tabs.get(requestInfo.tabId);
|
||||||
const proxy = await window.proxifiedContainers.retrieveFromBackground(tab.cookieStoreId);
|
const proxy = await proxifiedContainers.retrieveFromBackground(tab.cookieStoreId);
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,13 +43,13 @@ const backgroundLogic = {
|
||||||
options.params
|
options.params
|
||||||
);
|
);
|
||||||
|
|
||||||
window.proxifiedContainers.set(this.cookieStoreId(options.userContextId), options.proxy);
|
proxifiedContainers.set(this.cookieStoreId(options.userContextId), options.proxy);
|
||||||
} else {
|
} else {
|
||||||
donePromise = browser.contextualIdentities.create(options.params);
|
donePromise = browser.contextualIdentities.create(options.params);
|
||||||
|
|
||||||
// We cannot yet access the new cookieStoreId via this.cookieStoreId(...), so we take this from the resolved promise
|
// We cannot yet access the new cookieStoreId via this.cookieStoreId(...), so we take this from the resolved promise
|
||||||
donePromise.then((identity) => {
|
donePromise.then((identity) => {
|
||||||
window.proxifiedContainers.set(identity.cookieStoreId, options.proxy);
|
proxifiedContainers.set(identity.cookieStoreId, options.proxy);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Empty because this should never happen theoretically.
|
// Empty because this should never happen theoretically.
|
||||||
});
|
});
|
||||||
|
|
|
@ -967,7 +967,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
||||||
color: formValues.get("container-color") || DEFAULT_COLOR
|
color: formValues.get("container-color") || DEFAULT_COLOR
|
||||||
},
|
},
|
||||||
proxy: window.proxifiedContainers.parseProxy(document.getElementById("edit-container-panel-proxy").value) || DEFAULT_PROXY
|
proxy: proxifiedContainers.parseProxy(document.getElementById("edit-container-panel-proxy").value) || DEFAULT_PROXY
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await Logic.refreshIdentities();
|
await Logic.refreshIdentities();
|
||||||
|
@ -1081,23 +1081,23 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.proxifiedContainers.retrieve(identity.cookieStoreId).then((result) => {
|
proxifiedContainers.retrieve(identity.cookieStoreId).then((result) => {
|
||||||
edit_proxy_dom(result.proxy);
|
edit_proxy_dom(result.proxy);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
if(error.error === "uninitialized" || error.error === "doesnotexist") {
|
if(error.error === "uninitialized" || error.error === "doesnotexist") {
|
||||||
window.proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => {
|
proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => {
|
||||||
edit_proxy_dom(result);
|
edit_proxy_dom(result);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 1");
|
proxifiedContainers.report_proxy_error(error, "popup.js: error 1");
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 2");
|
proxifiedContainers.report_proxy_error(error, "popup.js: error 2");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 3");
|
proxifiedContainers.report_proxy_error(error, "popup.js: error 3");
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
window.proxifiedContainers.report_proxy_error(err, "popup.js: error 4");
|
proxifiedContainers.report_proxy_error(err, "popup.js: error 4");
|
||||||
});
|
});
|
||||||
|
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
|
|
|
@ -21,7 +21,7 @@ proxifiedContainers = {
|
||||||
// Slightly modified version of 'retrieve' which returns a direct proxy whenever an error is met.
|
// Slightly modified version of 'retrieve' which returns a direct proxy whenever an error is met.
|
||||||
retrieveFromBackground: function(cookieStoreId = null) {
|
retrieveFromBackground: function(cookieStoreId = null) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
window.proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
||||||
resolve(success.proxy);
|
resolve(success.proxy);
|
||||||
}, function() {
|
}, function() {
|
||||||
resolve({
|
resolve({
|
||||||
|
@ -77,7 +77,7 @@ proxifiedContainers = {
|
||||||
message: error
|
message: error
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
window.proxifiedContainers.report_proxy_error(error, "proxified-containers.js: error 1");
|
proxifiedContainers.report_proxy_error(error, "proxified-containers.js: error 1");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue