Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: src/objects.cc

Issue 1421033002: [es6] Partially implement Reflect.defineProperty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 1e5315b978e67fb8e9314cd993a5184f60ff3269..80bfd29fb9a7b778212e660056aba1cff1c8f5bc 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5995,7 +5995,7 @@ Object* JSReceiver::DefineProperties(Isolate* isolate, Handle<Object> object,
// static
-bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object,
+bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSReceiver> object,
Handle<Object> key, PropertyDescriptor* desc,
ShouldThrow should_throw) {
if (object->IsJSArray()) {
@@ -6004,12 +6004,14 @@ bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object,
}
// TODO(jkummerow): Support Modules (ES6 9.4.6.6)
// TODO(jkummerow): Support Proxies (ES6 9.5.6)
+ if (!object->IsJSObject()) return true;
Jakob Kummerow 2015/10/23 12:03:42 nit: wouldn't "return false" be more appropriate?
neis 2015/10/29 15:17:25 I don't want to return false without also checking
// OrdinaryDefineOwnProperty, by virtue of calling
// DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2)
// and IntegerIndexedExotics (ES6 9.4.5.3), with one exception:
// TODO(jkummerow): Setting an indexed accessor on a typed array should throw.
- return OrdinaryDefineOwnProperty(isolate, object, key, desc, should_throw);
+ return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key,
+ desc, should_throw);
}

Powered by Google App Engine
This is Rietveld 408576698