proxifiedContainers.delete routine added and loosely tested
This commit is contained in:
parent
fc2c7ff4be
commit
8ee45a38f0
1 changed files with 26 additions and 0 deletions
|
@ -146,5 +146,31 @@ proxifiedContainers = {
|
|||
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
//Deletes the proxy information object for a specified cookieStoreId [useful for cleaning]
|
||||
delete(cookieStoreId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Assumes proxy is a properly formatted object
|
||||
proxifiedContainers.retrieve().then((proxifiedContainersStore) => {
|
||||
let index = proxifiedContainersStore.findIndex(i => i.cookieStoreId === cookieStoreId);
|
||||
|
||||
if (index === -1) {
|
||||
reject({error: "not-found", message: `Container '${cookieStoreId}' not found.`});
|
||||
} else {
|
||||
delete proxifiedContainersStore[index];
|
||||
}
|
||||
|
||||
browser.storage.local.set({
|
||||
proxifiedContainersKey: proxifiedContainersStore
|
||||
});
|
||||
|
||||
resolve();
|
||||
}, (errorObj) => {
|
||||
reject(errorObj);
|
||||
}).catch((error) => {
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue