Skip to content

Commit a45d1ad

Browse files
committed
fix: clear pending exception before rejecting a builtin dynamic import
The dynamic-import builtin failure path rejected the resolver while the exception caught from GetModule was still pending on the isolate; V8 API calls with a pending exception are unsafe. The non-builtin path below already resets before rejecting. Reported by review on #1992.
1 parent e63bf62 commit a45d1ad

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

test-app/runtime/src/main/cpp/ModuleInternalCallbacks.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ v8::MaybeLocal<v8::Promise> ImportModuleDynamicallyCallback(
888888
tc.HasCaught() ? tc.Exception()
889889
: v8::Exception::Error(ArgConverter::ConvertToV8String(
890890
isolate, NsBuiltinModules::NotFoundMessage(spec)));
891+
// Reject must not run with the exception still pending on the isolate.
892+
tc.Reset();
891893
resolver->Reject(context, error).FromMaybe(false);
892894
}
893895
return scope.Escape(resolver->GetPromise());

0 commit comments

Comments
 (0)