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
+16 -16
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))
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) {