Bug 1466487 - Throw if module metadata hook is not set in the shell r=anba
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 06 Jun 2018 10:54:59 +0100
changeset 421583 450557c0669f09c69dbdc2837e9ca5c24125f789
parent 421582 f72ccbb154263d442b58e10a8dc69da9cd004a4d
child 421584 5dcfede51bc7da4da0f26d67e76ab3d38db3b8fc
push id34098
push usernbeleuzu@mozilla.com
push dateWed, 06 Jun 2018 17:00:32 +0000
treeherdermozilla-central@04cc917f68c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1466487
milestone62.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 1466487 - Throw if module metadata hook is not set in the shell r=anba
js/src/builtin/ModuleObject.cpp
js/src/jit-test/tests/modules/bug-1466487.js
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -1650,16 +1650,20 @@ js::GetOrCreateModuleMetaObject(JSContex
     if (JSObject* obj = module->metaObject())
         return obj;
 
     RootedObject metaObject(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr));
     if (!metaObject)
         return nullptr;
 
     JS::ModuleMetadataHook func = cx->runtime()->moduleMetadataHook;
-    MOZ_ASSERT(func);
+    if (!func) {
+        JS_ReportErrorASCII(cx, "Module metadata hook not set");
+        return nullptr;
+    }
+
     if (!func(cx, module, metaObject))
         return nullptr;
 
     module->setMetaObject(metaObject);
 
     return metaObject;
 }
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug-1466487.js
@@ -0,0 +1,7 @@
+if (helperThreadCount() === 0)
+    quit();
+evalInWorker(`
+    let m = parseModule("import.meta;");
+    m.declarationInstantiation();
+    m.evaluation();
+`);