@@ -716,8 +716,10 @@ JSModuleDef *js_module_loader(JSContext *ctx,
716
716
js_free (ctx , buf );
717
717
if (JS_IsException (func_val ))
718
718
return NULL ;
719
- /* XXX: could propagate the exception */
720
- js_module_set_import_meta (ctx , func_val , true, false);
719
+ if (js_module_set_import_meta (ctx , func_val , true, false) < 0 ) {
720
+ JS_FreeValue (ctx , func_val );
721
+ return NULL ;
722
+ }
721
723
/* the module is already referenced, so we must free it */
722
724
m = JS_VALUE_GET_PTR (func_val );
723
725
JS_FreeValue (ctx , func_val );
@@ -900,7 +902,8 @@ static JSValue js_evalScript(JSContext *ctx, JSValue this_val,
900
902
if (JS_ResolveModule (ctx , obj ) < 0 )
901
903
return JS_EXCEPTION ;
902
904
903
- js_module_set_import_meta (ctx , obj , false, false);
905
+ if (js_module_set_import_meta (ctx , obj , false, false) < 0 )
906
+ return JS_EXCEPTION ;
904
907
905
908
return JS_EvalFunction (ctx , obj );
906
909
}
@@ -4257,15 +4260,17 @@ void js_std_eval_binary(JSContext *ctx, const uint8_t *buf, size_t buf_len,
4257
4260
goto exception ;
4258
4261
if (load_only ) {
4259
4262
if (JS_VALUE_GET_TAG (obj ) == JS_TAG_MODULE ) {
4260
- js_module_set_import_meta (ctx , obj , false, false);
4263
+ if (js_module_set_import_meta (ctx , obj , false, false) < 0 )
4264
+ goto exception ;
4261
4265
}
4262
4266
} else {
4263
4267
if (JS_VALUE_GET_TAG (obj ) == JS_TAG_MODULE ) {
4264
4268
if (JS_ResolveModule (ctx , obj ) < 0 ) {
4265
4269
JS_FreeValue (ctx , obj );
4266
4270
goto exception ;
4267
4271
}
4268
- js_module_set_import_meta (ctx , obj , false, true);
4272
+ if (js_module_set_import_meta (ctx , obj , false, true) < 0 )
4273
+ goto exception ;
4269
4274
val = JS_EvalFunction (ctx , obj );
4270
4275
val = js_std_await (ctx , val );
4271
4276
} else {
0 commit comments