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

Unified Diff: src/builtins/builtins-object.cc

Issue 2592013003: Align __lookupGetter__/__lookupSetter__ behavior with the spec (Closed)
Patch Set: Add test Created 4 years 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
« no previous file with comments | « no previous file | test/mjsunit/es6/promise-lookup-getter-setter.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-object.cc
diff --git a/src/builtins/builtins-object.cc b/src/builtins/builtins-object.cc
index f7e5f3eee6a3a18d108f0787694fa44d83d42c60..5a6b877ec379f6d59db02e7df6e0d7883a827848 100644
--- a/src/builtins/builtins-object.cc
+++ b/src/builtins/builtins-object.cc
@@ -645,13 +645,33 @@ Object* ObjectLookupAccessor(Isolate* isolate, Handle<Object> object,
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->undefined_value();
- case LookupIterator::JSPROXY:
- return isolate->heap()->undefined_value();
+ case LookupIterator::JSPROXY: {
+ PropertyDescriptor desc;
+ Maybe<bool> found = JSProxy::GetOwnPropertyDescriptor(
+ isolate, it.GetHolder<JSProxy>(), it.GetName(), &desc);
+ MAYBE_RETURN(found, isolate->heap()->exception());
+ if (found.FromJust()) {
+ if (component == ACCESSOR_GETTER && desc.has_get()) {
+ return *desc.get();
+ }
+ if (component == ACCESSOR_SETTER && desc.has_set()) {
+ return *desc.set();
+ }
+ return isolate->heap()->undefined_value();
+ }
+ Handle<Object> prototype;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, prototype, JSProxy::GetPrototype(it.GetHolder<JSProxy>()));
+ if (prototype->IsNull(isolate)) {
+ return isolate->heap()->undefined_value();
+ }
+ return ObjectLookupAccessor(isolate, prototype, key, component);
+ }
case LookupIterator::INTEGER_INDEXED_EXOTIC:
- return isolate->heap()->undefined_value();
case LookupIterator::DATA:
- continue;
+ return isolate->heap()->undefined_value();
+
case LookupIterator::ACCESSOR: {
Handle<Object> maybe_pair = it.GetAccessors();
if (maybe_pair->IsAccessorPair()) {
« no previous file with comments | « no previous file | test/mjsunit/es6/promise-lookup-getter-setter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698