Index: test/mjsunit/harmony/proxies.js |
diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js |
index 8d8f83996e255832168fa0c3c5a2d3f117888cb8..734c978f82a3105e4c6cb99dcb90efa700883c06 100644 |
--- a/test/mjsunit/harmony/proxies.js |
+++ b/test/mjsunit/harmony/proxies.js |
@@ -575,12 +575,12 @@ TestSetThrow(Proxy.create({ |
var key |
var val |
-function TestSetForDerived(handler) { |
- TestWithProxies(TestSetForDerived2, handler) |
+function TestSetForDerived(trap) { |
+ TestWithProxies(TestSetForDerived2, trap) |
} |
-function TestSetForDerived2(create, handler) { |
- var p = create(handler) |
+function TestSetForDerived2(create, trap) { |
+ var p = create({getPropertyDescriptor: trap, getOwnPropertyDescriptor: trap}) |
var o = Object.create(p, {x: {value: 88, writable: true}, |
'1': {value: 89, writable: true}}) |
@@ -607,8 +607,13 @@ function TestSetForDerived2(create, handler) { |
assertEquals(45, o.p_nonwritable = 45) |
assertEquals("p_nonwritable", key) |
- assertEquals(45, o.p_nonwritable) |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_nonwritable")) |
+ |
+ assertThrows(function(){ "use strict"; o.p_nonwritable = 45 }, TypeError) |
+ assertEquals("p_nonwritable", key) |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_nonwritable")) |
+ val = "" |
assertEquals(46, o.p_setter = 46) |
assertEquals("p_setter", key) |
assertEquals(46, val) // written to parent |
@@ -624,32 +629,37 @@ function TestSetForDerived2(create, handler) { |
assertThrows(function(){ "use strict"; o.p_nosetter = 50 }, TypeError) |
assertEquals("p_nosetter", key) |
assertEquals("", val) // not written at all |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_nosetter")); |
assertThrows(function(){ o.p_nonconf = 53 }, TypeError) |
assertEquals("p_nonconf", key) |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_nonconf")); |
assertThrows(function(){ o.p_throw = 51 }, "myexn") |
assertEquals("p_throw", key) |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_throw")); |
assertThrows(function(){ o.p_setterthrow = 52 }, "myexn") |
assertEquals("p_setterthrow", key) |
+ assertFalse(Object.prototype.hasOwnProperty.call(o, "p_setterthrow")); |
} |
-TestSetForDerived({ |
- getPropertyDescriptor: function(k) { |
+ |
+TestSetForDerived( |
+ function(k) { |
key = k; |
switch (k) { |
case "p_writable": return {writable: true, configurable: true} |
case "p_nonwritable": return {writable: false, configurable: true} |
- case "p_setter":return {set: function(x) { val = x }, configurable: true} |
- case "p_nosetter": return {get: function() { return 1 }, configurable: true} |
- case "p_nonconf":return {} |
+ case "p_setter": return {set: function(x) {val = x}, configurable: true} |
+ case "p_nosetter": return {get: function() {return 1}, configurable: true} |
+ case "p_nonconf": return {} |
case "p_throw": throw "myexn" |
case "p_setterthrow": return {set: function(x) { throw "myexn" }} |
default: return undefined |
} |
} |
-}) |
+) |
// Evil proxy-induced side-effects shouldn't crash. |