Changed function declaration syntax in proxified-containers.js per review
This commit is contained in:
parent
3a0af38900
commit
bcc8747305
1 changed files with 5 additions and 5 deletions
|
@ -19,7 +19,7 @@ if (!("toJSON" in Error.prototype))
|
||||||
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(cookieStoreId = null) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
proxifiedContainers.retrieve(cookieStoreId).then((success) => {
|
||||||
resolve(success.proxy);
|
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
|
// 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(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:
|
||||||
|
@ -81,7 +81,7 @@ proxifiedContainers = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
set: function(cookieStoreId, proxy, initialize = false) {
|
set(cookieStoreId, proxy, initialize = false) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (initialize === true) {
|
if (initialize === true) {
|
||||||
const proxifiedContainersStore = [];
|
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+))?/;
|
const regexp = /(\b(\w+):(\w+)@)?(((?:\d{1,3}\.){3}\d{1,3}\b)|(\b(\w+)(\.(\w+))+))(:(\d+))?/;
|
||||||
if (regexp.test(proxy_str) !== true)
|
if (regexp.test(proxy_str) !== true)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue