summaryrefslogtreecommitdiff
path: root/run-test262.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2024-01-06 14:43:47 +0100
committerFabrice Bellard <fabrice@bellard.org>2024-01-06 14:43:47 +0100
commit3c2cfabfc74e8af1f21db93884ed1ad9b6388a8c (patch)
tree07d4d512b5ecaeb5cd8b4cf655d8288cd1a344a5 /run-test262.c
parentdf3781d08265c1a295aef9136c249b408d3a7c95 (diff)
downloadquickjs-3c2cfabfc74e8af1f21db93884ed1ad9b6388a8c.tar.gz
quickjs-3c2cfabfc74e8af1f21db93884ed1ad9b6388a8c.zip
fixed run_test262_harness_test() with modules
Diffstat (limited to 'run-test262.c')
-rw-r--r--run-test262.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/run-test262.c b/run-test262.c
index e0cf771..a7d3d5c 100644
--- a/run-test262.c
+++ b/run-test262.c
@@ -1854,17 +1854,32 @@ int run_test262_harness_test(const char *filename, BOOL is_module)
js_std_dump_error(ctx);
ret_code = 1;
} else {
- JS_FreeValue(ctx, res_val);
+ JSValue promise = JS_UNDEFINED;
+ if (is_module) {
+ promise = res_val;
+ } else {
+ JS_FreeValue(ctx, res_val);
+ }
for(;;) {
JSContext *ctx1;
ret = JS_ExecutePendingJob(JS_GetRuntime(ctx), &ctx1);
if (ret < 0) {
- js_std_dump_error(ctx1);
- ret_code = 1;
+ js_std_dump_error(ctx1);
+ ret_code = 1;
} else if (ret == 0) {
- break;
+ break;
}
}
+ /* dump the error if the module returned an error. */
+ if (is_module) {
+ JSPromiseStateEnum state = JS_PromiseState(ctx, promise);
+ if (state == JS_PROMISE_REJECTED) {
+ JS_Throw(ctx, JS_PromiseResult(ctx, promise));
+ js_std_dump_error(ctx);
+ ret_code = 1;
+ }
+ }
+ JS_FreeValue(ctx, promise);
}
free(buf);
#ifdef CONFIG_AGENT