Bug 1943761 - Add class alignment to the mozsearch analysis file. r=asuth
[gecko.git] / dom / quota / test / xpcshell / test_clearStoragesForOriginAttributesPattern.js
blob096cf2be7050c43f86a439fc1e64de04b02597b0
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
6 async function testSteps() {
7 const baseRelativePath = "storage/default";
8 const userContextForRemoval = 2;
10 const origins = [
12 userContextId: 1,
13 baseDirName: "https+++example.com",
17 userContextId: userContextForRemoval,
18 baseDirName: "https+++example.com",
21 // TODO: Uncomment this once bug 1638831 is fixed.
24 userContextId: userContextForRemoval,
25 baseDirName: "https+++example.org",
30 function getOriginDirectory(origin) {
31 return getRelativeFile(
32 `${baseRelativePath}/${origin.baseDirName}^userContextId=` +
33 `${origin.userContextId}`
37 let request = init();
38 await requestFinished(request);
40 for (const origin of origins) {
41 const directory = getOriginDirectory(origin);
42 directory.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8));
45 request = Services.qms.clearStoragesForOriginAttributesPattern(
46 `{ "userContextId": ${userContextForRemoval} }`
48 await requestFinished(request);
50 for (const origin of origins) {
51 const directory = getOriginDirectory(origin);
52 if (origin.userContextId === userContextForRemoval) {
53 ok(!directory.exists(), "Origin directory should have been removed");
54 } else {
55 ok(directory.exists(), "Origin directory shouldn't have been removed");