Skip to content

Commit 39fb83a

Browse files
joyeecheungruyadorno
authored andcommitted
src: do not rely on the internal field being default to undefined
It's an undocumented V8 behavior that is subject to change. Instead just check if the internal field is set to a promise. There is also no need to check IsEmpty() since the object is guaranteed to be constructed by the FileHandle constructor with enough internal fields. PR-URL: #49413 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/4707972/comment/be9285cc_a49aad88/ Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 3987094 commit 39fb83a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node_file.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ MaybeLocal<Promise> FileHandle::ClosePromise() {
457457

458458
Local<Value> close_resolver =
459459
object()->GetInternalField(FileHandle::kClosingPromiseSlot).As<Value>();
460-
if (!close_resolver.IsEmpty() && !close_resolver->IsUndefined()) {
461-
CHECK(close_resolver->IsPromise());
460+
if (close_resolver->IsPromise()) {
462461
return close_resolver.As<Promise>();
463462
}
464463

0 commit comments

Comments
 (0)