Commit 1142ac1a authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

v8::Object::CreateDataProperty shouldn't execute for regular objects

Bug: chromium:728583
Change-Id: I0d88b7516d053f2024a43bed84843ee47e06cd42
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2823697Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73940}
parent 2da42122
...@@ -4071,34 +4071,56 @@ Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, ...@@ -4071,34 +4071,56 @@ Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
v8::Local<Name> key, v8::Local<Name> key,
v8::Local<Value> value) { v8::Local<Value> value) {
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate()); auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing<bool>(),
i::HandleScope);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Name> key_obj = Utils::OpenHandle(*key); i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
Maybe<bool> result = i::JSReceiver::CreateDataProperty( i::LookupIterator::Key lookup_key(isolate, key_obj);
isolate, self, key_obj, value_obj, Just(i::kDontThrow)); i::LookupIterator it(isolate, self, lookup_key, i::LookupIterator::OWN);
has_pending_exception = result.IsNothing(); if (self->IsJSProxy()) {
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing<bool>(),
return result; i::HandleScope);
Maybe<bool> result =
i::JSReceiver::CreateDataProperty(&it, value_obj, Just(i::kDontThrow));
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
} else {
ENTER_V8_NO_SCRIPT(isolate, context, Object, CreateDataProperty,
Nothing<bool>(), i::HandleScope);
Maybe<bool> result =
i::JSObject::CreateDataProperty(&it, value_obj, Just(i::kDontThrow));
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
}
} }
Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
uint32_t index, uint32_t index,
v8::Local<Value> value) { v8::Local<Value> value) {
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate()); auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing<bool>(),
i::HandleScope);
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
i::LookupIterator it(isolate, self, index, self, i::LookupIterator::OWN); i::LookupIterator it(isolate, self, index, self, i::LookupIterator::OWN);
Maybe<bool> result = if (self->IsJSProxy()) {
i::JSReceiver::CreateDataProperty(&it, value_obj, Just(i::kDontThrow)); ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing<bool>(),
has_pending_exception = result.IsNothing(); i::HandleScope);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); Maybe<bool> result =
return result; i::JSReceiver::CreateDataProperty(&it, value_obj, Just(i::kDontThrow));
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
} else {
ENTER_V8_NO_SCRIPT(isolate, context, Object, CreateDataProperty,
Nothing<bool>(), i::HandleScope);
Maybe<bool> result =
i::JSObject::CreateDataProperty(&it, value_obj, Just(i::kDontThrow));
has_pending_exception = result.IsNothing();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return result;
}
} }
struct v8::PropertyDescriptor::PrivateData { struct v8::PropertyDescriptor::PrivateData {
......
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