Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/quota/test/xpcshell/xpcshell.toml
/**
* Any copyright is dedicated to the Public Domain.
*/
/**
* This test is mainly to verify clearing by origin prefix.
*/
async function testSteps() {
const packages = [
"clearStoragesForOriginPrefix_profile",
"defaultStorageDirectory_shared",
];
const testData = [
{
persistence: null,
key: "afterClearByOriginPrefix",
},
{
persistence: "default",
key: "afterClearByOriginPrefix_default",
},
{
persistence: "persistent",
key: "afterClearByOriginPrefix_persistent",
},
{
persistence: "temporary",
key: "afterClearByOriginPrefix_temporary",
},
];
for (const item of testData) {
info("Clearing");
let request = clear();
await requestFinished(request);
info("Verifying storage");
verifyStorage(packages, "beforeInstall");
info("Installing package");
installPackages(packages);
info("Verifying storage");
verifyStorage(packages, "afterInstall");
// TODO: Remove this block once origin clearing is able to ignore unknown
// directories.
getRelativeFile("storage/default/invalid+++example.com").remove(false);
getRelativeFile("storage/permanent/invalid+++example.com").remove(false);
getRelativeFile("storage/temporary/invalid+++example.com").remove(false);
info("Clearing by origin prefix");
request = clearOriginsByPrefix(getPrincipal(item.origin), item.persistence);
await requestFinished(request);
info("Verifying storage");
verifyStorage(packages, item.key, "afterClearByOriginPrefix");
}
}