Index: test/mjsunit/harmony/proxies-integrity.js |
diff --git a/test/mjsunit/harmony/proxies-integrity.js b/test/mjsunit/harmony/proxies-integrity.js |
index 4d1337cd166f2eb3312e87e193147d5320476ecf..9ed6005d6b2ffcbff5d24b57e83dc7605292b4a5 100644 |
--- a/test/mjsunit/harmony/proxies-integrity.js |
+++ b/test/mjsunit/harmony/proxies-integrity.js |
@@ -93,3 +93,121 @@ logger.get = function(t, trap, r) { |
assertArrayEquals( |
["defineProperty", target, toKey(symbol), noconf], log[9]); |
})(); |
+ |
+ |
+(function IsSealed() { |
+ var target = []; |
+ var proxy = new Proxy(target, handler); |
+ |
+ target.wurst = 42; |
+ target[0] = true; |
+ Object.defineProperty(target, symbol, {get: undefined}); |
+ |
+ // Extensible. |
+ |
+ log.length = 0; |
+ |
+ Object.isSealed(proxy); |
+ assertEquals(1, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ |
+ // Not extensible but not sealed. |
+ |
+ log.length = 0; |
+ Object.preventExtensions(target); |
+ |
+ Object.isSealed(proxy); |
+ assertEquals(3, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ assertArrayEquals( |
+ ["ownKeys", target], log[1]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(0)], log[2]); |
+ |
+ // Sealed. |
+ |
+ log.length = 0; |
+ Object.seal(target); |
+ |
+ Object.isSealed(proxy); |
+ assertEquals(6, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ assertArrayEquals( |
+ ["ownKeys", target], log[1]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(0)], log[2]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey("length")], log[3]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey("wurst")], log[4]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(symbol)], log[5]); |
+})(); |
+ |
+ |
+(function IsFrozen() { |
+ var target = []; |
+ var proxy = new Proxy(target, handler); |
+ |
+ target.wurst = 42; |
+ target[0] = true; |
+ Object.defineProperty(target, symbol, {get: undefined}); |
+ |
+ // Extensible. |
+ |
+ log.length = 0; |
+ |
+ Object.isFrozen(proxy); |
+ assertEquals(1, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ |
+ // Not extensible but not frozen. |
+ |
+ log.length = 0; |
+ Object.preventExtensions(target); |
+ |
+ Object.isFrozen(proxy); |
+ assertEquals(3, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ assertArrayEquals( |
+ ["ownKeys", target], log[1]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(0)], log[2]); |
+ |
+ // Frozen. |
+ |
+ log.length = 0; |
+ Object.freeze(target); |
+ |
+ Object.isFrozen(proxy); |
+ assertEquals(6, log.length) |
+ for (var i in log) assertSame(target, log[i][1]); |
+ |
+ assertArrayEquals( |
+ ["isExtensible", target], log[0]); |
+ assertArrayEquals( |
+ ["ownKeys", target], log[1]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(0)], log[2]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey("length")], log[3]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey("wurst")], log[4]); |
+ assertArrayEquals( |
+ ["getOwnPropertyDescriptor", target, toKey(symbol)], log[5]); |
+})(); |