summaryrefslogtreecommitdiffstats
path: root/dom/quota/test/xpcshell/test_removeLocalStorage.js
blob: bae4ad164974f6bfdf2f4b42de4240c55d98d957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

function* testSteps() {
  const lsArchiveFile = "storage/ls-archive.sqlite";
  const lsArchiveTmpFile = "storage/ls-archive-tmp.sqlite";
  const lsDir = "storage/default/http+++localhost/ls";

  info("Setting pref");

  SpecialPowers.setBoolPref(
    "dom.storage.enable_unsupported_legacy_implementation",
    true
  );

  // Profile 1
  info("Clearing");

  clear(continueToNextStepSync);
  yield undefined;

  info("Installing package");

  installPackage("removeLocalStorage1_profile");

  info("Checking ls archive tmp file");

  let archiveTmpFile = getRelativeFile(lsArchiveTmpFile);

  let exists = archiveTmpFile.exists();
  ok(exists, "ls archive tmp file does exist");

  info("Initializing");

  let request = init(continueToNextStepSync);
  yield undefined;

  ok(request.resultCode == NS_OK, "Initialization succeeded");

  info("Checking ls archive file");

  exists = archiveTmpFile.exists();
  ok(!exists, "ls archive tmp file doesn't exist");

  // Profile 2
  info("Clearing");

  clear(continueToNextStepSync);
  yield undefined;

  info("Installing package");

  installPackage("removeLocalStorage2_profile");

  info("Checking ls archive file");

  let archiveFile = getRelativeFile(lsArchiveFile);

  exists = archiveFile.exists();
  ok(exists, "ls archive file does exist");

  info("Checking ls dir");

  let dir = getRelativeFile(lsDir);

  exists = dir.exists();
  ok(exists, "ls directory does exist");

  info("Initializing");

  request = init(continueToNextStepSync);
  yield undefined;

  ok(request.resultCode == NS_OK, "Initialization succeeded");

  info("Checking ls archive file");

  exists = archiveFile.exists();
  ok(!exists, "ls archive file doesn't exist");

  info("Checking ls dir");

  exists = dir.exists();
  ok(!exists, "ls directory doesn't exist");

  finishTest();
}