Bug 1540913 - Part 9: update fs tests to use dynamic import; r=janv

Differential Revision: https://phabricator.services.mozilla.com/D172276
This commit is contained in:
Yulia 2023-03-14 18:16:34 +00:00
parent 4818902186
commit 2701b2e0d0
5 changed files with 8 additions and 25 deletions

View File

@ -69,6 +69,7 @@ add_setup(async function() {
const optionalPrefsToSet = [
["dom.fs.enabled", true],
["dom.fs.writable_file_stream.enabled", true],
["dom.workers.modules.enabled", true],
];
await setStoragePrefs(optionalPrefsToSet);

View File

@ -12,7 +12,7 @@ module.exports = {
overrides: [
{
files: ["Assert.js", "ModuleLoader.js", "Utils.js", "UtilsChild.js"],
files: ["Assert.js", "ModuleLoader.js", "Utils.js"],
parserOptions: {
sourceType: "script",
},

View File

@ -10,25 +10,11 @@ async function ensureUtilsChild() {
return;
}
try {
const { UtilsChild: importedUtilsChild } = await import(
"/tests/dom/quota/test/modules/worker/UtilsChild.js"
);
const { UtilsChild: importedUtilsChild } = await import(
"/tests/dom/quota/test/modules/worker/UtilsChild.mjs"
);
UtilsChild = importedUtilsChild;
throw Error("Please switch to dynamic module import");
} catch (e) {
if (e.message == "Please switch to dynamic module import") {
throw e;
}
importScripts("/tests/dom/quota/test/modules/worker/UtilsChild.js");
const { UtilsChild: importedUtilsChild } = globalThis.importUtilsChild();
UtilsChild = importedUtilsChild;
}
UtilsChild = importedUtilsChild;
}
const Utils = {

View File

@ -3,7 +3,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const _UtilsChild = {
export const UtilsChild = {
async getCachedOriginUsage() {
postMessage({
moduleName: "UtilsParent",
@ -20,7 +20,3 @@ const _UtilsChild = {
});
},
};
function importUtilsChild() {
return { UtilsChild: _UtilsChild };
}

View File

@ -51,7 +51,7 @@ TEST_HARNESS_FILES.testing.mochitest.tests.dom.quota.test.modules.worker += [
"modules/content/worker/head.js",
"modules/content/worker/ModuleLoader.js",
"modules/content/worker/Utils.js",
"modules/content/worker/UtilsChild.js",
"modules/content/worker/UtilsChild.mjs",
]
TEST_HARNESS_FILES.xpcshell.dom.quota.test.common += [