Commit 7acc69bd authored by Marina Sakai's avatar Marina Sakai Committed by Commit Bot

Support accessor properties in the function |V8SetReturnValue|

The function |V8SetReturnValue| supports only data properties, and this CL makes it support accessor properties, too.

Bug: 809011
Change-Id: Idb94d1b5129e3313b3e67a4b2f573dbd22588872
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904561
Commit-Queue: Marina Sakai <marinasakai@google.com>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713740}
parent 25f22440
......@@ -80,13 +80,25 @@ void V8SetReturnValue(const v8::PropertyCallbackInfo<v8::Value>& info,
const v8::PropertyDescriptor& descriptor) {
DCHECK(descriptor.has_configurable());
DCHECK(descriptor.has_enumerable());
DCHECK(descriptor.has_value());
DCHECK(descriptor.has_writable());
if (descriptor.has_value()) {
// Data property
DCHECK(descriptor.has_writable());
info.GetReturnValue().Set(
V8ObjectBuilder(ScriptState::ForCurrentRealm(info))
.Add("configurable", descriptor.configurable())
.Add("enumerable", descriptor.enumerable())
.Add("value", descriptor.value())
.Add("writable", descriptor.writable())
.V8Value());
return;
}
// Accessor property
DCHECK(descriptor.has_get() || descriptor.has_set());
info.GetReturnValue().Set(V8ObjectBuilder(ScriptState::ForCurrentRealm(info))
.Add("configurable", descriptor.configurable())
.Add("enumerable", descriptor.enumerable())
.Add("value", descriptor.value())
.Add("writable", descriptor.writable())
.Add("get", descriptor.get())
.Add("set", descriptor.set())
.V8Value());
}
......
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