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
90
91
92
93
94
95
96
97
98
99
100
|
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
async function require_module(id) {
if (!require_module.moduleLoader) {
const { ModuleLoader } = ChromeUtils.importESModule(
"resource://testing-common/dom/quota/test/modules/ModuleLoader.sys.mjs"
);
const base = Services.io.newFileURI(do_get_file("")).spec;
const depth = "../../../../";
Cu.importGlobalProperties(["storage"]);
const { Utils } = ChromeUtils.importESModule(
"resource://testing-common/dom/quota/test/modules/Utils.sys.mjs"
);
const proto = {
Assert,
Cr,
DOMException,
navigator: {
storage,
},
TextEncoder,
Utils,
};
require_module.moduleLoader = new ModuleLoader(base, depth, proto);
}
return require_module.moduleLoader.require(id);
}
async function run_test_in_worker(script) {
const { runTestInWorker } = ChromeUtils.importESModule(
"resource://testing-common/dom/quota/test/modules/WorkerDriver.sys.mjs"
);
const base = "resource://testing-common/dom/fs/test/xpcshell/";
const listener = {
onOk(value, message) {
ok(value, message);
},
onIs(a, b, message) {
Assert.equal(a, b, message);
},
onInfo(message) {
info(message);
},
};
await runTestInWorker(script, base, listener);
}
add_setup(async function () {
const {
setStoragePrefs,
clearStoragePrefs,
clearStoragesForOrigin,
resetStorage,
} = ChromeUtils.importESModule(
"resource://testing-common/dom/quota/test/modules/StorageUtils.sys.mjs"
);
const optionalPrefsToSet = [
["dom.fs.enabled", true],
["dom.fs.writable_file_stream.enabled", true],
];
setStoragePrefs(optionalPrefsToSet);
registerCleanupFunction(async function () {
const principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
Ci.nsIPrincipal
);
await clearStoragesForOrigin(principal);
Services.prefs.clearUserPref(
"dom.quotaManager.temporaryStorage.fixedLimit"
);
await resetStorage();
const optionalPrefsToClear = [
"dom.fs.enabled",
"dom.fs.writable_file_stream.enabled",
];
clearStoragePrefs(optionalPrefsToClear);
});
do_get_profile();
});
|