Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 4a44e661de59c04c63cc1e5bb498c51ca6bc88f8..6aa6aef014431c9a012465873c748b81e68ecb55 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -6707,7 +6707,7 @@ Maybe<bool> JSReceiver::CreateDataProperty(LookupIterator* it, |
| Isolate* isolate = receiver->GetIsolate(); |
| if (receiver->IsJSObject()) { |
| - return JSObject::CreateDataProperty(it, value); // Shortcut. |
| + return JSObject::CreateDataProperty(it, value, should_throw); // Shortcut. |
| } |
| PropertyDescriptor new_desc; |
| @@ -6720,17 +6720,25 @@ Maybe<bool> JSReceiver::CreateDataProperty(LookupIterator* it, |
| &new_desc, should_throw); |
| } |
| - |
| Maybe<bool> JSObject::CreateDataProperty(LookupIterator* it, |
| - Handle<Object> value) { |
| + Handle<Object> value, |
| + ShouldThrow should_throw) { |
| DCHECK(it->GetReceiver()->IsJSObject()); |
| MAYBE_RETURN(JSReceiver::GetPropertyAttributes(it), Nothing<bool>()); |
| + Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(it->GetReceiver()); |
| + Isolate* isolate = receiver->GetIsolate(); |
| if (it->IsFound()) { |
| - if (!it->IsConfigurable()) return Just(false); |
| + if (!it->IsConfigurable()) { |
| + RETURN_FAILURE( |
| + isolate, should_throw, |
| + NewTypeError(MessageTemplate::kRedefineDisallowed, it->GetName())); |
| + } |
| } else { |
| if (!JSObject::IsExtensible(Handle<JSObject>::cast(it->GetReceiver()))) |
|
adamk
2016/03/17 21:22:06
Nit: please add braces around the body of this if
Dan Ehrenberg
2016/03/17 21:25:28
Done
|
| - return Just(false); |
| + RETURN_FAILURE( |
| + isolate, should_throw, |
| + NewTypeError(MessageTemplate::kDefineDisallowed, it->GetName())); |
| } |
| RETURN_ON_EXCEPTION_VALUE(it->isolate(), |