Added space after // everywhere where relevant

This commit is contained in:
Samuel Crypto 2018-10-15 17:21:56 -04:00
parent 7f252c75b8
commit 70511e2722
3 changed files with 20 additions and 20 deletions

View file

@ -47,11 +47,11 @@ const backgroundLogic = {
} 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); window.proxifiedContainers.set(identity.cookieStoreId, options.proxy);
}).catch(() => { }).catch(() => {
//Empty because this should never happen theoretically. // Empty because this should never happen theoretically.
}); });
} }
await donePromise; await donePromise;
@ -165,7 +165,7 @@ const backgroundLogic = {
index: -1 index: -1
}); });
} else { } 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({ newWindowObj = await browser.windows.create({
}); });
hiddenDefaultTabToClose = true; hiddenDefaultTabToClose = true;

View file

@ -1069,7 +1069,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
iconInput.checked = iconInput.value === identity.icon; 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 = ""; document.querySelector("#edit-container-panel-proxy").value = "";
const edit_proxy_dom = function(result) { const edit_proxy_dom = function(result) {

View file

@ -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)) if (!("toJSON" in Error.prototype))
Object.defineProperty(Error.prototype, "toJSON", { Object.defineProperty(Error.prototype, "toJSON", {
value: function() { value: function() {
@ -15,10 +15,10 @@ if (!("toJSON" in Error.prototype))
}); });
//This object allows other scripts to access the list mapping containers to their proxies // This object allows other scripts to access the list mapping containers to their proxies
window.proxifiedContainers = { 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) => { window.proxifiedContainers.retrieve(cookieStoreId).then((success) => {
@ -34,20 +34,20 @@ window.proxifiedContainers = {
}, },
report_proxy_error: function(error, identifier = null) { 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
const relevant_id_str = identifier === null ? "" : " call supplied with id: " + identifier.toString() + " "; 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)); 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) { retrieve: function(cookieStoreId = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
browser.storage.local.get("proxifiedContainersKey").then((results) => { browser.storage.local.get("proxifiedContainersKey").then((results) => {
//Steps to test: // Steps to test:
//1. Is result empty? If so we must inform the caller to intialize proxifiedContainersStore with some initial info. // 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 // 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 // 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 // 4. Normal operation - if the cookieStoreId exists in the map, we can simply resolve with the correct proxy value
const results_array = results["proxifiedContainersKey"]; const results_array = results["proxifiedContainersKey"];
@ -97,8 +97,8 @@ window.proxifiedContainers = {
resolve(proxy); resolve(proxy);
} }
//Assumes proxy is a properly formatted object // Assumes proxy is a properly formatted object
window.proxifiedContainers.retrieve().then((proxifiedContainersStore) => { proxifiedContainers.retrieve().then((proxifiedContainersStore) => {
let index = proxifiedContainersStore.findIndex(i => i.cookieStoreId === cookieStoreId); let index = proxifiedContainersStore.findIndex(i => i.cookieStoreId === cookieStoreId);
if (index === -1) { if (index === -1) {