From af16a979211abb17836e3115579120ccb7eb1c48 Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Sat, 18 Oct 2025 10:50:51 +0200 Subject: [PATCH] changed module rejection order according to spec change --- quickjs.c | 16 ++++++++-------- test262_errors.txt | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/quickjs.c b/quickjs.c index aff2477..4a88e80 100644 --- a/quickjs.c +++ b/quickjs.c @@ -30249,14 +30249,6 @@ static JSValue js_async_module_execution_rejected(JSContext *ctx, JSValueConst t module->status = JS_MODULE_STATUS_EVALUATED; module->async_evaluation = FALSE; - for(i = 0; i < module->async_parent_modules_count; i++) { - JSModuleDef *m = module->async_parent_modules[i]; - JSValue m_obj = JS_NewModuleValue(ctx, m); - js_async_module_execution_rejected(ctx, JS_UNDEFINED, 1, &error, 0, - &m_obj); - JS_FreeValue(ctx, m_obj); - } - if (!JS_IsUndefined(module->promise)) { JSValue ret_val; assert(module->cycle_root == module); @@ -30264,6 +30256,14 @@ static JSValue js_async_module_execution_rejected(JSContext *ctx, JSValueConst t 1, &error); JS_FreeValue(ctx, ret_val); } + + for(i = 0; i < module->async_parent_modules_count; i++) { + JSModuleDef *m = module->async_parent_modules[i]; + JSValue m_obj = JS_NewModuleValue(ctx, m); + js_async_module_execution_rejected(ctx, JS_UNDEFINED, 1, &error, 0, + &m_obj); + JS_FreeValue(ctx, m_obj); + } return JS_UNDEFINED; } diff --git a/test262_errors.txt b/test262_errors.txt index ec3df0f..7cd4963 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -6,7 +6,6 @@ test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in- test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side test262/test/language/identifier-resolution/assign-to-global-undefined.js:20: strict mode: expected error -test262/test/language/module-code/top-level-await/rejection-order.js:20: TypeError: $DONE() not called test262/test/staging/sm/Function/arguments-parameter-shadowing.js:14: Test262Error: Expected SameValue(«true», «false») to be true test262/test/staging/sm/Function/constructor-binding.js:11: Test262Error: Expected SameValue(«"function"», «"undefined"») to be true test262/test/staging/sm/Function/constructor-binding.js:11: strict mode: Test262Error: Expected SameValue(«"function"», «"undefined"») to be true