OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Flags: --harmony-proxies | 28 // Flags: --harmony-proxies |
29 | 29 |
30 | 30 |
31 // TODO(rossberg): for-in not implemented on proxies. | |
32 | |
33 | |
34 // Helper. | 31 // Helper. |
35 | 32 |
36 function TestWithProxies(test, x, y, z) { | 33 function TestWithProxies(test, x, y, z) { |
37 test(Proxy.create, x, y, z) | 34 test(Proxy.create, x, y, z) |
38 test(function(h) {return Proxy.createFunction(h, function() {})}, x, y, z) | 35 test(function(h) {return Proxy.createFunction(h, function() {})}, x, y, z) |
39 } | 36 } |
40 | 37 |
41 | 38 |
42 | 39 |
43 // Getting property descriptors (Object.getOwnPropertyDescriptor). | 40 // Getting property descriptors (Object.getOwnPropertyDescriptor). |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 128 } |
132 | 129 |
133 function TestGet2(create, handler) { | 130 function TestGet2(create, handler) { |
134 var p = create(handler) | 131 var p = create(handler) |
135 assertEquals(42, p.a) | 132 assertEquals(42, p.a) |
136 assertEquals("a", key) | 133 assertEquals("a", key) |
137 assertEquals(42, p["b"]) | 134 assertEquals(42, p["b"]) |
138 assertEquals("b", key) | 135 assertEquals("b", key) |
139 assertEquals(42, p[99]) | 136 assertEquals(42, p[99]) |
140 assertEquals("99", key) | 137 assertEquals("99", key) |
| 138 assertEquals(42, (function(n) { return p[n] })("c")) |
| 139 assertEquals("c", key) |
| 140 assertEquals(42, (function(n) { return p[n] })(101)) |
| 141 assertEquals("101", key) |
141 | 142 |
142 var o = Object.create(p, {x: {value: 88}}) | 143 var o = Object.create(p, {x: {value: 88}}) |
143 assertEquals(42, o.a) | 144 assertEquals(42, o.a) |
144 assertEquals("a", key) | 145 assertEquals("a", key) |
145 assertEquals(42, o["b"]) | 146 assertEquals(42, o["b"]) |
146 assertEquals("b", key) | 147 assertEquals("b", key) |
147 assertEquals(42, o[99]) | 148 assertEquals(42, o[99]) |
148 assertEquals("99", key) | 149 assertEquals("99", key) |
149 assertEquals(88, o.x) | 150 assertEquals(88, o.x) |
150 assertEquals(88, o["x"]) | 151 assertEquals(88, o["x"]) |
| 152 assertEquals(42, (function(n) { return o[n] })("c")) |
| 153 assertEquals("c", key) |
| 154 assertEquals(42, (function(n) { return o[n] })(101)) |
| 155 assertEquals("101", key) |
| 156 assertEquals(88, (function(n) { return o[n] })("x")) |
151 } | 157 } |
152 | 158 |
153 TestGet({ | 159 TestGet({ |
154 get: function(r, k) { key = k; return 42 } | 160 get: function(r, k) { key = k; return 42 } |
155 }) | 161 }) |
156 | 162 |
157 TestGet({ | 163 TestGet({ |
158 get: function(r, k) { return this.get2(r, k) }, | 164 get: function(r, k) { return this.get2(r, k) }, |
159 get2: function(r, k) { key = k; return 42 } | 165 get2: function(r, k) { key = k; return 42 } |
160 }) | 166 }) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 function TestGetCall2(create, handler) { | 200 function TestGetCall2(create, handler) { |
195 var p = create(handler) | 201 var p = create(handler) |
196 assertEquals(55, p.f()) | 202 assertEquals(55, p.f()) |
197 assertEquals(55, p["f"]()) | 203 assertEquals(55, p["f"]()) |
198 assertEquals(55, p.f("unused", "arguments")) | 204 assertEquals(55, p.f("unused", "arguments")) |
199 assertEquals(55, p.f.call(p)) | 205 assertEquals(55, p.f.call(p)) |
200 assertEquals(55, p["f"].call(p)) | 206 assertEquals(55, p["f"].call(p)) |
201 assertEquals(55, p[101].call(p)) | 207 assertEquals(55, p[101].call(p)) |
202 assertEquals(55, p.withargs(45, 5)) | 208 assertEquals(55, p.withargs(45, 5)) |
203 assertEquals(55, p.withargs.call(p, 11, 22)) | 209 assertEquals(55, p.withargs.call(p, 11, 22)) |
| 210 assertEquals(55, (function(n) { return p[n]() })("f")) |
| 211 assertEquals(55, (function(n) { return p[n].call(p) })("f")) |
| 212 assertEquals(55, (function(n) { return p[n](15, 20) })("withargs")) |
| 213 assertEquals(55, (function(n) { return p[n].call(p, 13, 21) })("withargs")) |
204 assertEquals("6655", "66" + p) // calls p.toString | 214 assertEquals("6655", "66" + p) // calls p.toString |
205 | 215 |
206 var o = Object.create(p, {g: {value: function(x) { return x + 88 }}}) | 216 var o = Object.create(p, {g: {value: function(x) { return x + 88 }}}) |
207 assertEquals(55, o.f()) | 217 assertEquals(55, o.f()) |
208 assertEquals(55, o["f"]()) | 218 assertEquals(55, o["f"]()) |
209 assertEquals(55, o.f("unused", "arguments")) | 219 assertEquals(55, o.f("unused", "arguments")) |
210 assertEquals(55, o.f.call(o)) | 220 assertEquals(55, o.f.call(o)) |
211 assertEquals(55, o.f.call(p)) | 221 assertEquals(55, o.f.call(p)) |
212 assertEquals(55, o["f"].call(p)) | 222 assertEquals(55, o["f"].call(p)) |
213 assertEquals(55, o[101].call(p)) | 223 assertEquals(55, o[101].call(p)) |
214 assertEquals(55, o.withargs(45, 5)) | 224 assertEquals(55, o.withargs(45, 5)) |
215 assertEquals(55, o.withargs.call(p, 11, 22)) | 225 assertEquals(55, o.withargs.call(p, 11, 22)) |
216 assertEquals(90, o.g(2)) | 226 assertEquals(90, o.g(2)) |
217 assertEquals(91, o.g.call(o, 3)) | 227 assertEquals(91, o.g.call(o, 3)) |
218 assertEquals(92, o.g.call(p, 4)) | 228 assertEquals(92, o.g.call(p, 4)) |
| 229 assertEquals(55, (function(n) { return o[n]() })("f")) |
| 230 assertEquals(55, (function(n) { return o[n].call(o) })("f")) |
| 231 assertEquals(55, (function(n) { return o[n](15, 20) })("withargs")) |
| 232 assertEquals(55, (function(n) { return o[n].call(o, 13, 21) })("withargs")) |
| 233 assertEquals(93, (function(n) { return o[n](5) })("g")) |
| 234 assertEquals(94, (function(n) { return o[n].call(o, 6) })("g")) |
| 235 assertEquals(95, (function(n) { return o[n].call(p, 7) })("g")) |
219 assertEquals("6655", "66" + o) // calls o.toString | 236 assertEquals("6655", "66" + o) // calls o.toString |
220 } | 237 } |
221 | 238 |
222 TestGetCall({ | 239 TestGetCall({ |
223 get: function(r, k) { return function() { return 55 } } | 240 get: function(r, k) { return function() { return 55 } } |
224 }) | 241 }) |
225 | 242 |
226 TestGetCall({ | 243 TestGetCall({ |
227 get: function(r, k) { return this.get2(r, k) }, | 244 get: function(r, k) { return this.get2(r, k) }, |
228 get2: function(r, k) { return function() { return 55 } } | 245 get2: function(r, k) { return function() { return 55 } } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 292 |
276 function TestGetThrow(handler) { | 293 function TestGetThrow(handler) { |
277 TestWithProxies(TestGetThrow2, handler) | 294 TestWithProxies(TestGetThrow2, handler) |
278 } | 295 } |
279 | 296 |
280 function TestGetThrow2(create, handler) { | 297 function TestGetThrow2(create, handler) { |
281 var p = create(handler) | 298 var p = create(handler) |
282 assertThrows(function(){ p.a }, "myexn") | 299 assertThrows(function(){ p.a }, "myexn") |
283 assertThrows(function(){ p["b"] }, "myexn") | 300 assertThrows(function(){ p["b"] }, "myexn") |
284 assertThrows(function(){ p[3] }, "myexn") | 301 assertThrows(function(){ p[3] }, "myexn") |
| 302 assertThrows(function(){ (function(n) { p[n] })("c") }, "myexn") |
| 303 assertThrows(function(){ (function(n) { p[n] })(99) }, "myexn") |
285 | 304 |
286 var o = Object.create(p, {x: {value: 88}, '4': {value: 89}}) | 305 var o = Object.create(p, {x: {value: 88}, '4': {value: 89}}) |
287 assertThrows(function(){ o.a }, "myexn") | 306 assertThrows(function(){ o.a }, "myexn") |
288 assertThrows(function(){ o["b"] }, "myexn") | 307 assertThrows(function(){ o["b"] }, "myexn") |
289 assertThrows(function(){ o[3] }, "myexn") | 308 assertThrows(function(){ o[3] }, "myexn") |
290 assertEquals(88, o.x) | 309 assertThrows(function(){ (function(n) { o[n] })("c") }, "myexn") |
291 assertEquals(88, o["x"]) | 310 assertThrows(function(){ (function(n) { o[n] })(99) }, "myexn") |
292 assertEquals(89, o[4]) | |
293 } | 311 } |
294 | 312 |
295 TestGetThrow({ | 313 TestGetThrow({ |
296 get: function(r, k) { throw "myexn" } | 314 get: function(r, k) { throw "myexn" } |
297 }) | 315 }) |
298 | 316 |
299 TestGetThrow({ | 317 TestGetThrow({ |
300 get: function(r, k) { return this.get2(r, k) }, | 318 get: function(r, k) { return this.get2(r, k) }, |
301 get2: function(r, k) { throw "myexn" } | 319 get2: function(r, k) { throw "myexn" } |
302 }) | 320 }) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 var p = create(handler) | 364 var p = create(handler) |
347 assertEquals(42, p.a = 42) | 365 assertEquals(42, p.a = 42) |
348 assertEquals("a", key) | 366 assertEquals("a", key) |
349 assertEquals(42, val) | 367 assertEquals(42, val) |
350 assertEquals(43, p["b"] = 43) | 368 assertEquals(43, p["b"] = 43) |
351 assertEquals("b", key) | 369 assertEquals("b", key) |
352 assertEquals(43, val) | 370 assertEquals(43, val) |
353 assertEquals(44, p[77] = 44) | 371 assertEquals(44, p[77] = 44) |
354 assertEquals("77", key) | 372 assertEquals("77", key) |
355 assertEquals(44, val) | 373 assertEquals(44, val) |
| 374 |
| 375 assertEquals(45, (function(n) { return p[n] = 45 })("c")) |
| 376 assertEquals("c", key) |
| 377 assertEquals(45, val) |
| 378 assertEquals(46, (function(n) { return p[n] = 46 })(99)) |
| 379 assertEquals("99", key) |
| 380 assertEquals(46, val) |
356 } | 381 } |
357 | 382 |
358 TestSet({ | 383 TestSet({ |
359 set: function(r, k, v) { key = k; val = v; return true } | 384 set: function(r, k, v) { key = k; val = v; return true } |
360 }) | 385 }) |
361 | 386 |
362 TestSet({ | 387 TestSet({ |
363 set: function(r, k, v) { return this.set2(r, k, v) }, | 388 set: function(r, k, v) { return this.set2(r, k, v) }, |
364 set2: function(r, k, v) { key = k; val = v; return true } | 389 set2: function(r, k, v) { key = k; val = v; return true } |
365 }) | 390 }) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 452 |
428 function TestSetThrow(handler) { | 453 function TestSetThrow(handler) { |
429 TestWithProxies(TestSetThrow2, handler) | 454 TestWithProxies(TestSetThrow2, handler) |
430 } | 455 } |
431 | 456 |
432 function TestSetThrow2(create, handler) { | 457 function TestSetThrow2(create, handler) { |
433 var p = create(handler) | 458 var p = create(handler) |
434 assertThrows(function(){ p.a = 42 }, "myexn") | 459 assertThrows(function(){ p.a = 42 }, "myexn") |
435 assertThrows(function(){ p["b"] = 42 }, "myexn") | 460 assertThrows(function(){ p["b"] = 42 }, "myexn") |
436 assertThrows(function(){ p[22] = 42 }, "myexn") | 461 assertThrows(function(){ p[22] = 42 }, "myexn") |
| 462 assertThrows(function(){ (function(n) { p[n] = 45 })("c") }, "myexn") |
| 463 assertThrows(function(){ (function(n) { p[n] = 46 })(99) }, "myexn") |
437 } | 464 } |
438 | 465 |
439 TestSetThrow({ | 466 TestSetThrow({ |
440 set: function(r, k, v) { throw "myexn" } | 467 set: function(r, k, v) { throw "myexn" } |
441 }) | 468 }) |
442 | 469 |
443 TestSetThrow({ | 470 TestSetThrow({ |
444 set: function(r, k, v) { return this.set2(r, k, v) }, | 471 set: function(r, k, v) { return this.set2(r, k, v) }, |
445 set2: function(r, k, v) { throw "myexn" } | 472 set2: function(r, k, v) { throw "myexn" } |
446 }) | 473 }) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 739 |
713 assertEquals(p, Object.defineProperty(p, "e", {get: function(){ return 5 }})) | 740 assertEquals(p, Object.defineProperty(p, "e", {get: function(){ return 5 }})) |
714 assertEquals("e", key) | 741 assertEquals("e", key) |
715 assertEquals(1, Object.getOwnPropertyNames(desc).length) | 742 assertEquals(1, Object.getOwnPropertyNames(desc).length) |
716 assertEquals(5, desc.get()) | 743 assertEquals(5, desc.get()) |
717 | 744 |
718 assertEquals(p, Object.defineProperty(p, "zzz", {})) | 745 assertEquals(p, Object.defineProperty(p, "zzz", {})) |
719 assertEquals("zzz", key) | 746 assertEquals("zzz", key) |
720 assertEquals(0, Object.getOwnPropertyNames(desc).length) | 747 assertEquals(0, Object.getOwnPropertyNames(desc).length) |
721 | 748 |
722 // TODO(rossberg): This test requires for-in on proxies. | 749 var d = create({ |
723 // var d = create({ | 750 get: function(r, k) { return (k === "value") ? 77 : void 0 }, |
724 // get: function(r, k) { return (k === "value") ? 77 : void 0 }, | 751 getOwnPropertyNames: function() { return ["value"] }, |
725 // getOwnPropertyNames: function() { return ["value"] } | 752 enumerate: function() { return ["value"] } |
726 // }) | 753 }) |
727 // assertEquals(1, Object.getOwnPropertyNames(d).length) | 754 assertEquals(1, Object.getOwnPropertyNames(d).length) |
728 // assertEquals(77, d.value) | 755 assertEquals(77, d.value) |
729 // assertEquals(p, Object.defineProperty(p, "p", d)) | 756 assertEquals(p, Object.defineProperty(p, "p", d)) |
730 // assertEquals("p", key) | 757 assertEquals("p", key) |
731 // assertEquals(1, Object.getOwnPropertyNames(desc).length) | 758 assertEquals(1, Object.getOwnPropertyNames(desc).length) |
732 // assertEquals(77, desc.value) | 759 assertEquals(77, desc.value) |
733 | 760 |
734 var props = { | 761 var props = { |
735 '11': {}, | 762 '11': {}, |
736 blub: {get: function() { return true }}, | 763 blub: {get: function() { return true }}, |
737 '': {get value() { return 20 }}, | 764 '': {get value() { return 20 }}, |
738 last: {value: 21, configurable: true, mine: "eyes"} | 765 last: {value: 21, configurable: true, mine: "eyes"} |
739 } | 766 } |
740 Object.defineProperty(props, "hidden", {value: "hidden", enumerable: false}) | 767 Object.defineProperty(props, "hidden", {value: "hidden", enumerable: false}) |
741 assertEquals(p, Object.defineProperties(p, props)) | 768 assertEquals(p, Object.defineProperties(p, props)) |
742 assertEquals("last", key) | 769 assertEquals("last", key) |
(...skipping 24 matching lines...) Expand all Loading... |
767 | 794 |
768 function TestDefineThrow(handler) { | 795 function TestDefineThrow(handler) { |
769 TestWithProxies(TestDefineThrow2, handler) | 796 TestWithProxies(TestDefineThrow2, handler) |
770 } | 797 } |
771 | 798 |
772 function TestDefineThrow2(create, handler) { | 799 function TestDefineThrow2(create, handler) { |
773 var p = create(handler) | 800 var p = create(handler) |
774 assertThrows(function(){ Object.defineProperty(p, "a", {value: 44})}, "myexn") | 801 assertThrows(function(){ Object.defineProperty(p, "a", {value: 44})}, "myexn") |
775 assertThrows(function(){ Object.defineProperty(p, 0, {value: 44})}, "myexn") | 802 assertThrows(function(){ Object.defineProperty(p, 0, {value: 44})}, "myexn") |
776 | 803 |
777 // TODO(rossberg): These tests require for-in on proxies. | 804 var d1 = create({ |
778 // var d1 = create({ | 805 get: function(r, k) { throw "myexn" }, |
779 // get: function(r, k) { throw "myexn" }, | 806 getOwnPropertyNames: function() { return ["value"] } |
780 // getOwnPropertyNames: function() { return ["value"] } | 807 }) |
781 // }) | 808 assertThrows(function(){ Object.defineProperty(p, "p", d1) }, "myexn") |
782 // assertThrows(function(){ Object.defineProperty(p, "p", d1) }, "myexn") | 809 var d2 = create({ |
783 // var d2 = create({ | 810 get: function(r, k) { return 77 }, |
784 // get: function(r, k) { return 77 }, | 811 getOwnPropertyNames: function() { throw "myexn" } |
785 // getOwnPropertyNames: function() { throw "myexn" } | 812 }) |
786 // }) | 813 assertThrows(function(){ Object.defineProperty(p, "p", d2) }, "myexn") |
787 // assertThrows(function(){ Object.defineProperty(p, "p", d2) }, "myexn") | |
788 | 814 |
789 var props = {bla: {get value() { throw "otherexn" }}} | 815 var props = {bla: {get value() { throw "otherexn" }}} |
790 assertThrows(function(){ Object.defineProperties(p, props) }, "otherexn") | 816 assertThrows(function(){ Object.defineProperties(p, props) }, "otherexn") |
791 } | 817 } |
792 | 818 |
793 TestDefineThrow({ | 819 TestDefineThrow({ |
794 defineProperty: function(k, d) { throw "myexn" } | 820 defineProperty: function(k, d) { throw "myexn" } |
795 }) | 821 }) |
796 | 822 |
797 TestDefineThrow({ | 823 TestDefineThrow({ |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 | 1487 |
1462 | 1488 |
1463 | 1489 |
1464 // Prototype (Object.getPrototypeOf, Object.prototype.isPrototypeOf). | 1490 // Prototype (Object.getPrototypeOf, Object.prototype.isPrototypeOf). |
1465 | 1491 |
1466 function TestPrototype() { | 1492 function TestPrototype() { |
1467 var o1 = {} | 1493 var o1 = {} |
1468 var p1 = Proxy.create({}) | 1494 var p1 = Proxy.create({}) |
1469 var p2 = Proxy.create({}, o1) | 1495 var p2 = Proxy.create({}, o1) |
1470 var p3 = Proxy.create({}, p2) | 1496 var p3 = Proxy.create({}, p2) |
1471 var p4 = Proxy.create({}, 666) | 1497 var p4 = Proxy.create({}, null) |
1472 var o2 = Object.create(p3) | 1498 var o2 = Object.create(p3) |
1473 | 1499 |
1474 assertSame(Object.getPrototypeOf(o1), Object.prototype) | 1500 assertSame(Object.getPrototypeOf(o1), Object.prototype) |
1475 assertSame(Object.getPrototypeOf(p1), null) | 1501 assertSame(Object.getPrototypeOf(p1), null) |
1476 assertSame(Object.getPrototypeOf(p2), o1) | 1502 assertSame(Object.getPrototypeOf(p2), o1) |
1477 assertSame(Object.getPrototypeOf(p3), p2) | 1503 assertSame(Object.getPrototypeOf(p3), p2) |
1478 assertSame(Object.getPrototypeOf(p4), null) | 1504 assertSame(Object.getPrototypeOf(p4), null) |
1479 assertSame(Object.getPrototypeOf(o2), p3) | 1505 assertSame(Object.getPrototypeOf(o2), p3) |
1480 | 1506 |
1481 assertTrue(Object.prototype.isPrototypeOf(o1)) | 1507 assertTrue(Object.prototype.isPrototypeOf(o1)) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 }) | 1625 }) |
1600 | 1626 |
1601 TestKeys(["[object Object]"], { | 1627 TestKeys(["[object Object]"], { |
1602 get keys() { | 1628 get keys() { |
1603 return function() { return [{}] } | 1629 return function() { return [{}] } |
1604 } | 1630 } |
1605 }) | 1631 }) |
1606 | 1632 |
1607 TestKeys(["a", "0"], { | 1633 TestKeys(["a", "0"], { |
1608 getOwnPropertyNames: function() { return ["a", 23, "zz", "", 0] }, | 1634 getOwnPropertyNames: function() { return ["a", 23, "zz", "", 0] }, |
1609 getOwnPropertyDescriptor: function(k) { return {enumerable: k.length == 1} } | 1635 getOwnPropertyDescriptor: function(k) { |
| 1636 return k == "" ? undefined : {enumerable: k.length == 1} |
| 1637 } |
1610 }) | 1638 }) |
1611 | 1639 |
1612 TestKeys(["23", "zz", ""], { | 1640 TestKeys(["23", "zz", ""], { |
1613 getOwnPropertyNames: function() { return this.getOwnPropertyNames2() }, | 1641 getOwnPropertyNames: function() { return this.getOwnPropertyNames2() }, |
1614 getOwnPropertyNames2: function() { return ["a", 23, "zz", "", 0] }, | 1642 getOwnPropertyNames2: function() { return ["a", 23, "zz", "", 0] }, |
1615 getOwnPropertyDescriptor: function(k) { | 1643 getOwnPropertyDescriptor: function(k) { |
1616 return this.getOwnPropertyDescriptor2(k) | 1644 return this.getOwnPropertyDescriptor2(k) |
1617 }, | 1645 }, |
1618 getOwnPropertyDescriptor2: function(k) { return {enumerable: k.length != 1} } | 1646 getOwnPropertyDescriptor2: function(k) { return {enumerable: k.length != 1} } |
1619 }) | 1647 }) |
1620 | 1648 |
1621 TestKeys(["a", "b", "c", "5"], { | 1649 TestKeys(["a", "b", "c", "5"], { |
1622 get getOwnPropertyNames() { | 1650 get getOwnPropertyNames() { |
1623 return function() { return ["0", 4, "a", "b", "c", 5] } | 1651 return function() { return ["0", 4, "a", "b", "c", 5, "ety"] } |
1624 }, | 1652 }, |
1625 get getOwnPropertyDescriptor() { | 1653 get getOwnPropertyDescriptor() { |
1626 return function(k) { return {enumerable: k >= "44"} } | 1654 return function(k) { |
| 1655 return k == "ety" ? undefined : {enumerable: k >= "44"} |
| 1656 } |
1627 } | 1657 } |
1628 }) | 1658 }) |
1629 | 1659 |
1630 TestKeys([], { | 1660 TestKeys([], { |
1631 get getOwnPropertyNames() { | 1661 get getOwnPropertyNames() { |
1632 return function() { return ["a", "b", "c"] } | 1662 return function() { return ["a", "b", "c"] } |
1633 }, | 1663 }, |
1634 getOwnPropertyDescriptor: function(k) { return {} } | 1664 getOwnPropertyDescriptor: function(k) { return {} } |
1635 }) | 1665 }) |
1636 | 1666 |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 | 2187 |
2158 TestIsEnumerableThrow(Proxy.create({ | 2188 TestIsEnumerableThrow(Proxy.create({ |
2159 get: function(pr, pk) { throw "myexn" } | 2189 get: function(pr, pk) { throw "myexn" } |
2160 })) | 2190 })) |
2161 | 2191 |
2162 TestIsEnumerableThrow(Proxy.create({ | 2192 TestIsEnumerableThrow(Proxy.create({ |
2163 get: function(pr, pk) { | 2193 get: function(pr, pk) { |
2164 return function(k) { throw "myexn" } | 2194 return function(k) { throw "myexn" } |
2165 } | 2195 } |
2166 })) | 2196 })) |
OLD | NEW |