Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'linux' && os_version == '24.04' && arch == 'x86_64' && display == 'x11' && debug && http3
- 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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Test what happens when deleting indexedDB database is blocked
add_task(async function () {
await openTabAndSetupStorage(
MAIN_URL_SECURED + "storage-idb-delete-blocked.html"
);
info("test state before delete");
await checkState([[["indexedDB", MAIN_ORIGIN_SECURED], ["idb (default)"]]]);
info("do the delete");
await selectTreeItem(["indexedDB", MAIN_ORIGIN_SECURED]);
const front = gUI.getCurrentFront();
let result = await front.removeDatabase(MAIN_ORIGIN_SECURED, "idb (default)");
ok(result.blocked, "removeDatabase attempt is blocked");
info("test state after blocked delete");
await checkState([[["indexedDB", MAIN_ORIGIN_SECURED], ["idb (default)"]]]);
const eventWait = gUI.once("store-objects-edit");
info("telling content to close the db");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
const win = content.wrappedJSObject;
await win.closeDb();
});
info("waiting for store edit events");
await eventWait;
info("test state after real delete");
await checkState([[["indexedDB", MAIN_ORIGIN_SECURED], []]]);
info("try to delete database from nonexistent host");
let errorThrown = false;
try {
result = await front.removeDatabase(
"idb (default)"
);
} catch (ex) {
errorThrown = true;
}
ok(errorThrown, "error was reported when trying to delete");
});