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,
|
||||
"OS": true,
|
||||
"ADDON_UNINSTALL": true,
|
||||
"ADDON_DISABLE": true
|
||||
"ADDON_DISABLE": true,
|
||||
"proxifiedContainers": true
|
||||
},
|
||||
"plugins": [
|
||||
"promise",
|
||||
|
|
|
@ -122,7 +122,7 @@ const assignManager = {
|
|||
return {type: "direct"};
|
||||
|
||||
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;
|
||||
},
|
||||
|
|
|
@ -43,13 +43,13 @@ const backgroundLogic = {
|
|||
options.params
|
||||
);
|
||||
|
||||
window.proxifiedContainers.set(this.cookieStoreId(options.userContextId), options.proxy);
|
||||
proxifiedContainers.set(this.cookieStoreId(options.userContextId), options.proxy);
|
||||
} else {
|
||||
donePromise = browser.contextualIdentities.create(options.params);
|
||||
|
||||
// We cannot yet access the new cookieStoreId via this.cookieStoreId(...), so we take this from the resolved promise
|
||||
donePromise.then((identity) => {
|
||||
window.proxifiedContainers.set(identity.cookieStoreId, options.proxy);
|
||||
proxifiedContainers.set(identity.cookieStoreId, options.proxy);
|
||||
}).catch(() => {
|
||||
// Empty because this should never happen theoretically.
|
||||
});
|
||||
|
|
|
@ -967,7 +967,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
||||
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();
|
||||
|
@ -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);
|
||||
}, (error) => {
|
||||
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);
|
||||
}, (error) => {
|
||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 1");
|
||||
proxifiedContainers.report_proxy_error(error, "popup.js: error 1");
|
||||
}).catch((error) => {
|
||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 2");
|
||||
proxifiedContainers.report_proxy_error(error, "popup.js: error 2");
|
||||
});
|
||||
}
|
||||
else {
|
||||
window.proxifiedContainers.report_proxy_error(error, "popup.js: error 3");
|
||||
proxifiedContainers.report_proxy_error(error, "popup.js: error 3");
|
||||
}
|
||||
}).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);
|
||||
|
|
|
@ -21,7 +21,7 @@ proxifiedContainers = {
|
|||
// Slightly modified version of 'retrieve' which returns a direct proxy whenever an error is met.
|
||||
retrieveFromBackground: function(cookieStoreId = null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
||||
proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
||||
resolve(success.proxy);
|
||||
}, function() {
|
||||
resolve({
|
||||
|
@ -77,7 +77,7 @@ proxifiedContainers = {
|
|||
message: 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