diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2023-12-27 17:10:47 +0100 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2023-12-27 17:10:47 +0100 |
commit | 6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7 (patch) | |
tree | 8d69d6513520c68d94795084e01859baae527ba0 /quickjs-libc.c | |
parent | 9b587c461b06af06e78070b86d9b99da7d863065 (diff) | |
download | quickjs-6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7.tar.gz quickjs-6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7.zip |
top-level-await support - follow the spec in the implementation of the module linking and evaluation to avoid errors with cycling module dependencies
Diffstat (limited to 'quickjs-libc.c')
-rw-r--r-- | quickjs-libc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/quickjs-libc.c b/quickjs-libc.c index e180dd0..f916314 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3274,6 +3274,7 @@ static void *worker_func(void *opaque) JSRuntime *rt; JSThreadState *ts; JSContext *ctx; + JSValue promise; rt = JS_NewRuntime(); if (rt == NULL) { @@ -3300,8 +3301,11 @@ static void *worker_func(void *opaque) js_std_add_helpers(ctx, -1, NULL); - if (!JS_RunModule(ctx, args->basename, args->filename)) + promise = JS_LoadModule(ctx, args->basename, args->filename); + if (JS_IsException(promise)) js_std_dump_error(ctx); + /* XXX: check */ + JS_FreeValue(ctx, promise); free(args->filename); free(args->basename); free(args); |