Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index b672185792c417a75f311c7ea6b35d880f91f6a4..990f9df5b6409aeef9370f73ac3489a72b1633bf 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -1517,10 +1517,10 @@ BUILTIN(ReflectHas) { |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, |
Object::ToName(isolate, key)); |
- Maybe<bool> maybe = |
+ Maybe<bool> result = |
JSReceiver::HasProperty(Handle<JSReceiver>::cast(target), name); |
- if (!maybe.IsJust()) return isolate->heap()->exception(); |
- return *isolate->factory()->ToBoolean(maybe.FromJust()); |
+ return result.IsJust() ? *isolate->factory()->ToBoolean(result.FromJust()) |
+ : isolate->heap()->exception(); |
} |
@@ -1554,6 +1554,26 @@ BUILTIN(ReflectIsExtensible) { |
} |
+// ES6 section 26.1.12 Reflect.preventExtensions |
+BUILTIN(ReflectPreventExtensions) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ Handle<Object> target = args.at<Object>(1); |
+ |
+ if (!target->IsJSReceiver()) { |
+ THROW_NEW_ERROR_RETURN_FAILURE( |
+ isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, |
+ isolate->factory()->NewStringFromAsciiChecked( |
+ "Reflect.preventExtensions"))); |
+ } |
+ |
+ Maybe<bool> result = JSReceiver::PreventExtensions( |
+ Handle<JSReceiver>::cast(target), DONT_THROW); |
+ return result.IsJust() ? *isolate->factory()->ToBoolean(result.FromJust()) |
+ : isolate->heap()->exception(); |
+} |
+ |
+ |
// ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) |
BUILTIN(DateToPrimitive) { |
HandleScope scope(isolate); |