mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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: https://github.com/nodejs/node/pull/49413 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/4707972/comment/be9285cc_a49aad88/ Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
1 parent
3987094569
commit
39fb83ad16
1 file changed
+1
-2
+1
-2
@@ -457,8 +457,7 @@ MaybeLocal<Promise> FileHandle::ClosePromise() {
|
||||
|
||||
Local<Value> close_resolver =
|
||||
object()->GetInternalField(FileHandle::kClosingPromiseSlot).As<Value>();
|
||||
if (!close_resolver.IsEmpty() && !close_resolver->IsUndefined()) {
|
||||
CHECK(close_resolver->IsPromise());
|
||||
if (close_resolver->IsPromise()) {
|
||||
return close_resolver.As<Promise>();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user