Fixed weird problem after code lint modifications

This commit is contained in:
Samuel Crypto 2018-10-10 15:54:33 -04:00
parent 768ae66a64
commit 0a864f0cf3
2 changed files with 11 additions and 9 deletions

View file

@ -1085,16 +1085,16 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
window.proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => { window.proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => {
edit_proxy_dom(result.proxy); edit_proxy_dom(result.proxy);
}, (error) => { }, (error) => {
window.proxifiedContainers.report_proxy_error(error); window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 1");
}).catch((error) => { }).catch((error) => {
window.proxifiedContainers.report_proxy_error(error); window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 2");
}); });
} }
else { else {
window.proxifiedContainers.report_proxy_error(error); window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 3");
} }
}).catch((error) => { }).catch((err) => {
window.proxifiedContainers.report_proxy_error(error); window.proxifiedContainers.report_proxy_error(err, "popup.js: occurence 4");
}); });
return Promise.resolve(null); return Promise.resolve(null);

View file

@ -16,9 +16,10 @@ window.proxifiedContainers = {
}); });
}, },
report_proxy_error: function(error) { report_proxy_error: function(error, identifier = null) {
//Currently I print to console but this is inefficient //Currently I print to console but this is inefficient
browser.extension.getBackgroundPage().console.log("proxifiedContainers error occured: " + JSON.stringify(error)); const relevant_id_str = identifier === null ? "" : " call supplied with id: " + identifier.toString() + " ";
browser.extension.getBackgroundPage().console.log("proxifiedContainers error occured" + relevant_id_str + ": " + JSON.stringify(error));
}, },
//Resolves to a proxy object which can be used in the return of the listener required for browser.proxy.onRequest.addListener //Resolves to a proxy object which can be used in the return of the listener required for browser.proxy.onRequest.addListener
@ -42,7 +43,8 @@ window.proxifiedContainers = {
resolve(results_array); resolve(results_array);
} else { } else {
const val = results_array.find(o => o.cookieStoreId === cookieStoreId); const val = results_array.find(o => o.cookieStoreId === cookieStoreId);
if (val === null) {
if (typeof val !== "object" ) {
reject({ reject({
error: "doesnotexist", error: "doesnotexist",
message: "" message: ""
@ -58,7 +60,7 @@ window.proxifiedContainers = {
message: error message: error
}); });
}).catch((error) => { }).catch((error) => {
window.proxifiedContainers.report_proxy_error(error); window.proxifiedContainers.report_proxy_error(error, "5");
}); });
}); });
}, },