Bug 1488117: Export* modules can be uninstantiated when ModuleGetExportedNames is called. r=jonco
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 05 Dec 2018 03:14:12 -0800
changeset 449478 62cb0a02ae13d64b91bfa539c084767a5d26ddae
parent 449477 d18e3cc2eaebea0f78dedc43655214b4b7d337a6
child 449479 3e75f80fd784e262ca70b9daed7eae13dad9a116
push id35166
push userncsoregi@mozilla.com
push dateThu, 06 Dec 2018 09:26:19 +0000
treeherdermozilla-central@f7895b06b742 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1488117
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1488117: Export* modules can be uninstantiated when ModuleGetExportedNames is called. r=jonco
js/src/builtin/Module.js
js/src/tests/non262/module/bug1488117-empty.js
js/src/tests/non262/module/bug1488117-import-namespace.js
js/src/tests/non262/module/bug1488117.js
--- a/js/src/builtin/Module.js
+++ b/js/src/builtin/Module.js
@@ -48,17 +48,17 @@ function ModuleGetExportedNames(exportSt
         _DefineDataProperty(exportedNames, namesCount++, e.exportName);
     }
 
     // Step 7
     let starExportEntries = module.starExportEntries;
     for (let i = 0; i < starExportEntries.length; i++) {
         let e = starExportEntries[i];
         let requestedModule = CallModuleResolveHook(module, e.moduleRequest,
-                                                    MODULE_STATUS_INSTANTIATING);
+                                                    MODULE_STATUS_UNINSTANTIATED);
         let starNames = callFunction(requestedModule.getExportedNames, requestedModule,
                                      exportStarSet);
         for (let j = 0; j < starNames.length; j++) {
             let n = starNames[j];
             if (n !== "default" && !callFunction(ArrayIncludes, exportedNames, n))
                 _DefineDataProperty(exportedNames, namesCount++, n);
         }
     }
new file mode 100644
--- /dev/null
+++ b/js/src/tests/non262/module/bug1488117-empty.js
@@ -0,0 +1,3 @@
+// |reftest| skip -- support file
+
+// Intentionally left empty.
new file mode 100644
--- /dev/null
+++ b/js/src/tests/non262/module/bug1488117-import-namespace.js
@@ -0,0 +1,3 @@
+// |reftest| skip -- support file
+
+import* as ns from "./bug1488117.js";
new file mode 100644
--- /dev/null
+++ b/js/src/tests/non262/module/bug1488117.js
@@ -0,0 +1,14 @@
+// |reftest| module
+
+// 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.
+
+import "./bug1488117-import-namespace.js";
+export* from "./bug1488117-empty.js";
+
+if (typeof reportCompare === "function")
+    reportCompare(0, 0);