Commit 0de01928 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by V8 LUCI CQ

[debug] Always return a valid PropertyDescriptor.

In DebugPropertyIterator::iterator() we were assuming that the call to
JSReceiver::GetOwnPropertyDescriptor() would always yield either an
exception or a valid property descriptor. But that's not guaranteed to
be the case (anymore), because JSReceiver::GetOwnPropertyDescriptor()
nowadays can chicken out with `false` for many different reasons.

Coincidentally the callsites to DebugPropertyIterator::iterator() are
already equipped to handle the case where of an empty property
descriptor, which is basically what we get out here. So this CL adjusts
the DebugPropertyIterator to return an empty descriptor in this case.

Fixed: chromium:1291240
Change-Id: I22a9d0cde2b2c6d3966a85478ed0b87fb4c5d232
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3736445Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81458}
parent feccd638
......@@ -146,6 +146,16 @@ v8::Maybe<v8::debug::PropertyDescriptor> DebugPropertyIterator::descriptor() {
if (did_get_descriptor.IsNothing()) {
return Nothing<v8::debug::PropertyDescriptor>();
}
if (!did_get_descriptor.FromJust()) {
return Just(v8::debug::PropertyDescriptor{
false, false, /* enumerable */
false, false, /* configurable */
false, false, /* writable */
v8::Local<v8::Value>(), /* value */
v8::Local<v8::Value>(), /* get */
v8::Local<v8::Value>(), /* set */
});
}
DCHECK(did_get_descriptor.FromJust());
return Just(v8::debug::PropertyDescriptor{
descriptor.enumerable(), descriptor.has_enumerable(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment