moebius#339: Make it possible to add cookies, local and session storage entries

Issue #31
https://github.com/MoonchildProductions/moebius/pull/339
This commit is contained in:
janekptacijarabaci 2018-03-02 17:52:34 +01:00 committed by Roy Tam
commit 6d865bfda3
13 changed files with 309 additions and 43 deletions

View file

@ -897,3 +897,39 @@ function setPermission(url, permission) {
.addFromPrincipal(principal, permission,
nsIPermissionManager.ALLOW_ACTION);
}
/**
* Add an item.
* @param {Array} store
* An array containing the path to the store to which we wish to add an
* item.
*/
function* performAdd(store) {
let storeName = store.join(" > ");
let toolbar = gPanelWindow.document.getElementById("storage-toolbar");
let type = store[0];
yield selectTreeItem(store);
let menuAdd = toolbar.querySelector(
"#add-button");
if (menuAdd.hidden) {
is(menuAdd.hidden, false,
`performAdd called for ${storeName} but it is not supported`);
return;
}
let eventEdit = gUI.table.once("row-edit");
let eventWait = gUI.once("store-objects-updated");
menuAdd.click();
let rowId = yield eventEdit;
yield eventWait;
let key = type === "cookies" ? "uniqueKey" : "name";
let value = getCellValue(rowId, key);
is(rowId, value, `Row '${rowId}' was successfully added.`);
}