Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d96a97a

Browse filesBrowse files
dandclarkdanielleadams
authored andcommitted
module: make synthetic module evaluation steps return a Promise to support top level await
Top level await expects that all module script evaluation returns a Promise. As such, update ModuleWrap::SyntheticModuleEvaluationStepsCallback to return a resolved Promise now that V8 has enabled top-level await by default. Unfortunately I don't have a spec reference that I can point to here because the Built-in modules proposal isn't yet updated for top level await. The corresponding change for Blink is https://chromium-review.googlesource.com/c/chromium/src/+/2568823. This will allow a workaround for Node in this V8 bugfix to be removed: https://chromium-review.googlesource.com/c/v8/v8/+/2673794. Fixes: #37299 PR-URL: #37300 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 7d8fd3f commit d96a97a
Copy full SHA for d96a97a

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Open diff view settings
Collapse file

‎src/module_wrap.cc‎

Copy file name to clipboardExpand all lines: src/module_wrap.cc
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,14 @@ MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
665665
try_catch.ReThrow();
666666
return MaybeLocal<Value>();
667667
}
668-
return Undefined(isolate);
668+
669+
Local<Promise::Resolver> resolver;
670+
if (!Promise::Resolver::New(context).ToLocal(&resolver)) {
671+
return MaybeLocal<Value>();
672+
}
673+
674+
resolver->Resolve(context, Undefined(isolate)).ToChecked();
675+
return resolver->GetPromise();
669676
}
670677

671678
void ModuleWrap::SetSyntheticExport(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.