diff --git a/src/objects.cc b/src/objects.cc index 67ccd31014..b096203154 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -805,7 +805,8 @@ MaybeHandle JSProxy::GetProperty(Isolate* isolate, inconsistent = inconsistent || (PropertyDescriptor::IsAccessorDescriptor(&target_desc) && - !target_desc.configurable() && target_desc.get()->IsUndefined()); + !target_desc.configurable() && target_desc.get()->IsUndefined() && + !trap_result->IsUndefined()); if (inconsistent) { THROW_NEW_ERROR( isolate, diff --git a/test/mjsunit/harmony/proxies-get.js b/test/mjsunit/harmony/proxies-get.js index 8e85912987..04ebd31257 100644 --- a/test/mjsunit/harmony/proxies-get.js +++ b/test/mjsunit/harmony/proxies-get.js @@ -52,7 +52,7 @@ (function testFailingInvariant() { var target = {}; - var handler = { get: function(){ return "value" }} + var handler = { get: function(r, p){ if (p != "key4") return "value" }} var proxy = new Proxy(target, handler); assertEquals("value", proxy.property); assertEquals("value", proxy.key); @@ -92,6 +92,14 @@ assertThrows(function(){ proxy.key }, TypeError); assertEquals("value", proxy.key2); assertThrows(function(){ proxy.key3 }, TypeError); + + // Define a non-configurable setter without a corresponding getter on the + // target for which the handler will return undefined. + Object.defineProperty(target, "key4", { + configurable: false, + set: function() { } + }); + assertSame(undefined, proxy.key4); })(); (function testGetInternalIterators() {