diff --git a/src/js/background/backgroundLogic.js b/src/js/background/backgroundLogic.js index 1b2f6ac..30ec3d5 100644 --- a/src/js/background/backgroundLogic.js +++ b/src/js/background/backgroundLogic.js @@ -47,11 +47,11 @@ const backgroundLogic = { } 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 + // 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); }).catch(() => { - //Empty because this should never happen theoretically. + // Empty because this should never happen theoretically. }); } await donePromise; @@ -165,7 +165,7 @@ const backgroundLogic = { index: -1 }); } else { - //As we get a blank tab here we will need to await the tabs creation + // As we get a blank tab here we will need to await the tabs creation newWindowObj = await browser.windows.create({ }); hiddenDefaultTabToClose = true; diff --git a/src/js/popup.js b/src/js/popup.js index 38e80da..7b72eb1 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1069,7 +1069,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, { iconInput.checked = iconInput.value === identity.icon; }); - //Clear the proxy field before doing the retrieval requests below + // Clear the proxy field before doing the retrieval requests below document.querySelector("#edit-container-panel-proxy").value = ""; const edit_proxy_dom = function(result) { diff --git a/src/js/proxified-containers.js b/src/js/proxified-containers.js index cdea00a..51bcf7d 100644 --- a/src/js/proxified-containers.js +++ b/src/js/proxified-containers.js @@ -1,4 +1,4 @@ -//Below lets us print errors, huge thanks to Jonothan @ https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify +// Below lets us print errors, huge thanks to Jonothan @ https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify if (!("toJSON" in Error.prototype)) Object.defineProperty(Error.prototype, "toJSON", { value: function() { @@ -7,7 +7,7 @@ if (!("toJSON" in Error.prototype)) Object.getOwnPropertyNames(this).forEach(function(key) { alt[key] = this[key]; }, this); - + return alt; }, configurable: true, @@ -15,10 +15,10 @@ if (!("toJSON" in Error.prototype)) }); -//This object allows other scripts to access the list mapping containers to their proxies -window.proxifiedContainers = { +// This object allows other scripts to access the list mapping containers to their proxies +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) { return new Promise((resolve, reject) => { window.proxifiedContainers.retrieve(cookieStoreId).then((success) => { @@ -34,20 +34,20 @@ window.proxifiedContainers = { }, report_proxy_error: function(error, identifier = null) { - //Currently I print to console but this is inefficient - 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)); + // Currently I print to console but this is inefficient + 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 retrieve: function(cookieStoreId = null) { return new Promise((resolve, reject) => { browser.storage.local.get("proxifiedContainersKey").then((results) => { - //Steps to test: - //1. Is result empty? If so we must inform the caller to intialize proxifiedContainersStore with some initial info. - //2. Is cookieStoreId null? This means the caller probably wants everything currently in the proxifiedContainersStore object store - //3. If there doesn't exist an entry for the associated cookieStoreId, inform the caller of this - //4. Normal operation - if the cookieStoreId exists in the map, we can simply resolve with the correct proxy value + // Steps to test: + // 1. Is result empty? If so we must inform the caller to intialize proxifiedContainersStore with some initial info. + // 2. Is cookieStoreId null? This means the caller probably wants everything currently in the proxifiedContainersStore object store + // 3. If there doesn't exist an entry for the associated cookieStoreId, inform the caller of this + // 4. Normal operation - if the cookieStoreId exists in the map, we can simply resolve with the correct proxy value const results_array = results["proxifiedContainersKey"]; @@ -97,8 +97,8 @@ window.proxifiedContainers = { resolve(proxy); } - //Assumes proxy is a properly formatted object - window.proxifiedContainers.retrieve().then((proxifiedContainersStore) => { + // Assumes proxy is a properly formatted object + proxifiedContainers.retrieve().then((proxifiedContainersStore) => { let index = proxifiedContainersStore.findIndex(i => i.cookieStoreId === cookieStoreId); if (index === -1) {