Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: devtools/client/storage/test/browser.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
"use strict";
// Test deleting all storage items
add_task(async function () {
// storage-listings.html explicitly mixes secure and insecure frames.
// We should not enforce https for tests using this page.
await pushPref("dom.security.https_first", false);
await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html");
const contextMenu = gPanelWindow.document.getElementById(
"storage-table-popup"
);
const menuDeleteAllItem = contextMenu.querySelector(
"#storage-table-popup-delete-all"
);
info("test state before delete");
const beforeState = [
[
["key", "ls1", "ls2"],
],
[
["key", "ss1"],
],
[
["iframe-u-ss1", "iframe-u-ss2"],
],
[
[1, 2, 3],
],
[
[
MAIN_DOMAIN + "404_cached_file.js",
MAIN_DOMAIN + "browser_storage_basic.js",
],
],
];
await checkState(beforeState);
info("do the delete");
const deleteHosts = [
[
"iframe-s-ss1",
"name",
],
[
1,
"name",
],
[
MAIN_DOMAIN + "404_cached_file.js",
"url",
],
];
for (const [store, rowName, cellToClick] of deleteHosts) {
const storeName = store.join(" > ");
await selectTreeItem(store);
const eventWait = gUI.once("store-objects-cleared");
const cell = getRowCells(rowName)[cellToClick];
await waitForContextMenu(contextMenu, cell, () => {
info(`Opened context menu in ${storeName}, row '${rowName}'`);
contextMenu.activateItem(menuDeleteAllItem);
});
await eventWait;
}
info("test state after delete");
const afterState = [
// iframes from the same host, one secure, one unsecure, are independent
// from each other. Delete all in one doesn't touch the other one.
[
["key", "ls1", "ls2"],
],
[
["key", "ss1"],
],
[
["iframe-u-ss1", "iframe-u-ss2"],
],
];
await checkState(afterState);
});