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 505938 62cb0a02ae13
parent 505937 d18e3cc2eaeb
child 505939 3e75f80fd784
push id10301
push userarchaeopteryx@coole-files.de
push dateThu, 06 Dec 2018 16:36:14 +0000
treeherdermozilla-beta@7d2f3c71997c [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);