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

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

Issue 1427743011: [proxies] Remove "fix" functionality, add (still unused) target property. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Test Created 5 years, 1 month 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/runtime/runtime-proxy.cc ('k') | test/mjsunit/harmony/proxies-function.js » ('j') | 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 e49ea7fab8c304831523e1b926a32e83b46df296..7a8b194fabbede0fc4946d1e3eb1a474c5c48f0c 100644
--- a/test/mjsunit/harmony/proxies.js
+++ b/test/mjsunit/harmony/proxies.js
@@ -1824,59 +1824,61 @@ TestKeysThrow({
// Object.isFrozen, Object.isSealed, Object.isExtensible)
function TestFix(names, handler) {
- var proto = {p: 77}
- var assertFixing = function(o, s, f, e) {
- assertEquals(s, Object.isSealed(o))
- assertEquals(f, Object.isFrozen(o))
- assertEquals(e, Object.isExtensible(o))
- }
-
- var p1 = Proxy.create(handler, proto)
- assertFixing(p1, false, false, true)
- Object.seal(p1)
- assertFixing(p1, true, names.length === 0, false)
- assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p1).sort())
- assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
- Object.keys(p1).sort())
- assertEquals(proto, Object.getPrototypeOf(p1))
- assertEquals(77, p1.p)
- for (var n in p1) {
- var desc = Object.getOwnPropertyDescriptor(p1, n)
- if (desc !== undefined) assertFalse(desc.configurable)
- }
-
- var p2 = Proxy.create(handler, proto)
- assertFixing(p2, false, false, true)
- Object.freeze(p2)
- assertFixing(p2, true, true, false)
- assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p2).sort())
- assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
- Object.keys(p2).sort())
- assertEquals(proto, Object.getPrototypeOf(p2))
- assertEquals(77, p2.p)
- for (var n in p2) {
- var desc = Object.getOwnPropertyDescriptor(p2, n)
- if (desc !== undefined) assertFalse(desc.writable)
- if (desc !== undefined) assertFalse(desc.configurable)
- }
-
- var p3 = Proxy.create(handler, proto)
- assertFixing(p3, false, false, true)
- Object.preventExtensions(p3)
- assertFixing(p3, names.length === 0, names.length === 0, false)
- assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p3).sort())
- assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
- Object.keys(p3).sort())
- assertEquals(proto, Object.getPrototypeOf(p3))
- assertEquals(77, p3.p)
-
- var p = Proxy.create(handler, proto)
- var o = Object.create(p)
- assertFixing(p, false, false, true)
- assertFixing(o, false, false, true)
- Object.freeze(o)
- assertFixing(p, false, false, true)
- assertFixing(o, true, true, false)
+// TODO(neis): Reenable/adapt once proxies properly support these operations.
+//
+// var proto = {p: 77}
+// var assertFixing = function(o, s, f, e) {
+// assertEquals(s, Object.isSealed(o))
+// assertEquals(f, Object.isFrozen(o))
+// assertEquals(e, Object.isExtensible(o))
+// }
+//
+// var p1 = Proxy.create(handler, proto)
+// assertFixing(p1, false, false, true)
+// Object.seal(p1)
+// assertFixing(p1, true, names.length === 0, false)
+// assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p1).sort())
+// assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
+// Object.keys(p1).sort())
+// assertEquals(proto, Object.getPrototypeOf(p1))
+// assertEquals(77, p1.p)
+// for (var n in p1) {
+// var desc = Object.getOwnPropertyDescriptor(p1, n)
+// if (desc !== undefined) assertFalse(desc.configurable)
+// }
+//
+// var p2 = Proxy.create(handler, proto)
+// assertFixing(p2, false, false, true)
+// Object.freeze(p2)
+// assertFixing(p2, true, true, false)
+// assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p2).sort())
+// assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
+// Object.keys(p2).sort())
+// assertEquals(proto, Object.getPrototypeOf(p2))
+// assertEquals(77, p2.p)
+// for (var n in p2) {
+// var desc = Object.getOwnPropertyDescriptor(p2, n)
+// if (desc !== undefined) assertFalse(desc.writable)
+// if (desc !== undefined) assertFalse(desc.configurable)
+// }
+//
+// var p3 = Proxy.create(handler, proto)
+// assertFixing(p3, false, false, true)
+// Object.preventExtensions(p3)
+// assertFixing(p3, names.length === 0, names.length === 0, false)
+// assertArrayEquals(names.sort(), Object.getOwnPropertyNames(p3).sort())
+// assertArrayEquals(names.filter(function(x) {return x < "z"}).sort(),
+// Object.keys(p3).sort())
+// assertEquals(proto, Object.getPrototypeOf(p3))
+// assertEquals(77, p3.p)
+//
+// var p = Proxy.create(handler, proto)
+// var o = Object.create(p)
+// assertFixing(p, false, false, true)
+// assertFixing(o, false, false, true)
+// Object.freeze(o)
+// assertFixing(p, false, false, true)
+// assertFixing(o, true, true, false)
}
TestFix([], {
@@ -1912,23 +1914,25 @@ TestFix(["b"], {
function TestFixFunction(fix) {
- var f1 = Proxy.createFunction({
- fix: function() { return {} }
- }, function() {})
- fix(f1)
- assertEquals(0, f1.length)
-
- var f2 = Proxy.createFunction({
- fix: function() { return {length: {value: 3}} }
- }, function() {})
- fix(f2)
- assertEquals(3, f2.length)
-
- var f3 = Proxy.createFunction({
- fix: function() { return {length: {value: "huh"}} }
- }, function() {})
- fix(f3)
- assertEquals(0, f1.length)
+// TODO(neis): Reenable/adapt once proxies properly support these operations.
+//
+// var f1 = Proxy.createFunction({
+// fix: function() { return {} }
+// }, function() {})
+// fix(f1)
+// assertEquals(0, f1.length)
+//
+// var f2 = Proxy.createFunction({
+// fix: function() { return {length: {value: 3}} }
+// }, function() {})
+// fix(f2)
+// assertEquals(3, f2.length)
+//
+// var f3 = Proxy.createFunction({
+// fix: function() { return {length: {value: "huh"}} }
+// }, function() {})
+// fix(f3)
+// assertEquals(0, f1.length)
}
TestFixFunction(Object.seal)
@@ -1941,10 +1945,12 @@ function TestFixThrow(handler) {
}
function TestFixThrow2(create, handler) {
- var p = create(handler, {})
- assertThrows(function(){ Object.seal(p) }, "myexn")
- assertThrows(function(){ Object.freeze(p) }, "myexn")
- assertThrows(function(){ Object.preventExtensions(p) }, "myexn")
+// TODO(neis): Reenable/adapt once proxies properly support these operations.
+//
+// var p = create(handler, {})
+// assertThrows(function(){ Object.seal(p) }, "myexn")
+// assertThrows(function(){ Object.freeze(p) }, "myexn")
+// assertThrows(function(){ Object.preventExtensions(p) }, "myexn")
}
TestFixThrow({
@@ -1971,9 +1977,11 @@ TestFixThrow({
// TODO(rossberg): actual behaviour not specified consistently at the moment,
// just make sure that we do not crash.
function TestReentrantFix(f) {
- TestWithProxies(f, Object.freeze)
- TestWithProxies(f, Object.seal)
- TestWithProxies(f, Object.preventExtensions)
+// TODO(neis): Reenable/adapt once proxies properly support these operations.
+//
+// TestWithProxies(f, Object.freeze)
+// TestWithProxies(f, Object.seal)
+// TestWithProxies(f, Object.preventExtensions)
}
TestReentrantFix(function(create, freeze) {
« no previous file with comments | « src/runtime/runtime-proxy.cc ('k') | test/mjsunit/harmony/proxies-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698