Changed function declaration syntax in proxified-containers.js per review

This commit is contained in:
Samuel Crypto 2018-10-28 15:16:09 -04:00
parent 3a0af38900
commit bcc8747305

View file

@ -19,7 +19,7 @@ if (!("toJSON" in Error.prototype))
proxifiedContainers = {
// Slightly modified version of 'retrieve' which returns a direct proxy whenever an error is met.
retrieveFromBackground: function(cookieStoreId = null) {
retrieveFromBackground(cookieStoreId = null) {
return new Promise((resolve, reject) => {
proxifiedContainers.retrieve(cookieStoreId).then((success) => {
resolve(success.proxy);
@ -33,14 +33,14 @@ proxifiedContainers = {
});
},
report_proxy_error: function(error, identifier = null) {
report_proxy_error(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)}`);
},
// 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(cookieStoreId = null) {
return new Promise((resolve, reject) => {
browser.storage.local.get("proxifiedContainersKey").then((results) => {
// Steps to test:
@ -81,7 +81,7 @@ proxifiedContainers = {
});
});
},
set: function(cookieStoreId, proxy, initialize = false) {
set(cookieStoreId, proxy, initialize = false) {
return new Promise((resolve, reject) => {
if (initialize === true) {
const proxifiedContainersStore = [];
@ -126,7 +126,7 @@ proxifiedContainers = {
});
});
},
parseProxy: function(proxy_str) {
parseProxy(proxy_str) {
const regexp = /(\b(\w+):(\w+)@)?(((?:\d{1,3}\.){3}\d{1,3}\b)|(\b(\w+)(\.(\w+))+))(:(\d+))?/;
if (regexp.test(proxy_str) !== true)
return false;