mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 15:04:24 +03:00
top-level-await support - follow the spec in the implementation of the module linking and evaluation to avoid errors with cycling module dependencies
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user