Bug 1689499 - Add test to show cycle issue with multiple parents;r=jorendorff

Differential Revision: https://phabricator.services.mozilla.com/D103787
This commit is contained in:
yulia 2021-02-24 15:10:17 +00:00
parent c86b10a91e
commit febe527fc3
5 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,5 @@
// |reftest| skip -- support file
import B from "./bug1689499-b.js";
import C from "./bug1689499-c.js";
export default "A";

View File

@ -0,0 +1,6 @@
// |reftest| skip -- support file
import A from "./bug1689499-a.js";
if (true) await 0;
export default "B";

View File

@ -0,0 +1,8 @@
// |reftest| skip -- support file
import A from "./bug1689499-a.js";
if (true) await 0;
export default "C";
throw Error("FAIL");

View File

@ -0,0 +1,3 @@
// |reftest| skip -- support file
import B from "./bug1689499-b.js";
export default "X";

View File

@ -0,0 +1,29 @@
// |reftest| shell-option(--enable-top-level-await) module async
// Load and instantiate "bug1488117-import-namespace.js". "bug1488117-import-namespace.js"
// contains an |import*| request for the current module, which triggers GetModuleNamespace for
// this module. GetModuleNamespace calls GetExportedNames on the current module, which in turn
// resolves and calls GetExportedNames on all |export*| entries.
// And that means HostResolveImportedModule is called for "bug1488117-empty.js" before
// InnerModuleInstantiation for "bug1488117.js" has resolved that module file.
async function test() {
try {
await import("./bug1689499-a.js");
throw new Error("import should have failed");
} catch (exc) {
assertEq(exc.message, "FAIL");
}
try {
await import("./bug1689499-x.js");
throw new Error("import should have failed");
} catch (exc) {
assertEq(exc.message, "FAIL");
}
if (typeof reportCompare === "function")
reportCompare(0, 0);
}
test();