Source code

Revision control

Copy as Markdown

Other Tools

/**
* Any copyright is dedicated to the Public Domain.
*/
async function require_module(id) {
if (!require_module.moduleLoader) {
const { ModuleLoader } = ChromeUtils.importESModule(
);
const base = Services.io.newFileURI(do_get_file("")).spec;
const depth = "../../../../";
Cu.importGlobalProperties(["storage"]);
const { Utils } = ChromeUtils.importESModule(
);
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(
);
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(
);
const optionalPrefsToSet = [
["dom.fs.enabled", true],
["dom.fs.writable_file_stream.enabled", true],
["dom.fs.testing", 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",
"dom.fs.testing",
];
clearStoragePrefs(optionalPrefsToClear);
});
do_get_profile();
});