Index: test/mjsunit/harmony/proxies.js |
diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js |
index 1a33f5fb05722bc7e7bb96869ea7132ee811ab0d..aca0cc34bee59e395922124f81a8ba81873fbfb6 100644 |
--- a/test/mjsunit/harmony/proxies.js |
+++ b/test/mjsunit/harmony/proxies.js |
@@ -1068,8 +1068,6 @@ TestInThrow(Proxy.create({ |
})) |
-/* TODO(rossberg): does not work yet, JSProxy::GetPropertyAttributeWithHandler |
- * is not fully implemented.*/ |
function TestInForDerived(handler) { |
TestWithProxies(TestInForDerived2, handler) |
} |
@@ -1079,7 +1077,7 @@ function TestInForDerived2(handler, create) { |
var o = Object.create(p) |
assertTrue("a" in o) |
assertEquals("a", key) |
-// TODO(rossberg): integer indexes not correctly imlemeted yet |
+// TODO(rossberg): integer indexes not correctly implemeted yet |
// assertTrue(99 in o) |
// assertEquals("99", key) |
assertFalse("z" in o) |
@@ -1164,6 +1162,62 @@ TestInForDerived(Proxy.create({ |
+// Property descriptor conversion. |
+ |
+var descget |
+ |
+function TestDescriptorGetOrder(handler) { |
+ var p = Proxy.create(handler) |
+ var o = Object.create(p, {b: {value: 0}}) |
+ TestDescriptorGetOrder2(function(n) { p[n] }, "vV") |
+ TestDescriptorGetOrder2(function(n) { n in p }, "") |
+ TestDescriptorGetOrder2(function(n) { o[n] }, "vV") |
+ TestDescriptorGetOrder2(function(n) { n in o }, "eEcCvVwWgs") |
+} |
+ |
+function TestDescriptorGetOrder2(f, access) { |
+ descget = "" |
+ f("a") |
+ assertEquals(access, descget) |
+// TODO(rossberg): integer indexes not correctly implemented yet. |
+// descget = "" |
+// f(99) |
+// assertEquals(access, descget) |
+ descget = "" |
+ f("z") |
+ assertEquals("", descget) |
+} |
+ |
+TestDescriptorGetOrder({ |
+ getPropertyDescriptor: function(k) { |
+ if (k >= "z") return void 0 |
+ // Return a proxy as property descriptor, so that we can log accesses. |
+ return Proxy.create({ |
+ get: function(r, attr) { |
+ descget += attr[0].toUpperCase() |
+ return true |
+ }, |
+ has: function(attr) { |
+ descget += attr[0] |
+ switch (attr) { |
+ case "writable": |
+ case "enumerable": |
+ case "configurable": |
+ case "value": |
+ return true |
+ case "get": |
+ case "set": |
+ return false |
+ default: |
+ assertUnreachable() |
+ } |
+ } |
+ }) |
+ } |
+}) |
+ |
+ |
+ |
// Own Properties (Object.prototype.hasOwnProperty). |
var key |