From e52da4707d2501ad0885449502cc844062238e3b Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sun, 7 May 2023 00:57:41 +0800 Subject: [PATCH] Issue #2234 - Part 2: Ensure that the created async function wrapper is valid This excludes the GC-related changes (cell pointer asserts) since we don't have them. This bug should be revisited if we'd ever plan on porting those asserts over. Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1402649 --- js/src/builtin/ModuleObject.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp index 3fc195499f..dd03017fc0 100644 --- a/js/src/builtin/ModuleObject.cpp +++ b/js/src/builtin/ModuleObject.cpp @@ -973,6 +973,9 @@ ModuleObject::instantiateFunctionDeclarations(JSContext* cx, HandleModuleObject } } + if (!obj) + return false; + value = ObjectValue(*obj); if (!SetProperty(cx, env, funDecl.name->asPropertyName(), value)) return false;