[proxies] Add missing condition to GetProperty consistency check.

BUG=v8:1543
LOG=N
R=cbruni@chromium.org,jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1519073002

Cr-Commit-Position: refs/heads/master@{#32832}
This commit is contained in:
neis 2015-12-14 04:49:13 -08:00 committed by Commit bot
parent 28e61d5a32
commit 4460b85a3e
2 changed files with 11 additions and 2 deletions

View File

@ -805,7 +805,8 @@ MaybeHandle<Object> 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,

View File

@ -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() {