Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: test/mjsunit/harmony/proxies.js

Issue 7828080: Fix and test use of property descriptor objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Kevin's comments. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698