OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 (function testArrayConcatArity() { | 4 (function testArrayConcatArity() { |
5 "use strict"; | 5 "use strict"; |
6 assertEquals(1, Array.prototype.concat.length); | 6 assertEquals(1, Array.prototype.concat.length); |
7 })(); | 7 })(); |
8 | 8 |
9 | 9 |
10 (function testArrayConcatNoPrototype() { | 10 (function testArrayConcatNoPrototype() { |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 if (key === "length") return Symbol(); | 865 if (key === "length") return Symbol(); |
866 if (key === "2") return "baz"; | 866 if (key === "2") return "baz"; |
867 if (key === "3") return "bar"; | 867 if (key === "3") return "bar"; |
868 }; | 868 }; |
869 var target = []; | 869 var target = []; |
870 var obj = new Proxy(target, {get: getTrap, has: () => true}); | 870 var obj = new Proxy(target, {get: getTrap, has: () => true}); |
871 | 871 |
872 assertThrows(() => [].concat(obj), TypeError); | 872 assertThrows(() => [].concat(obj), TypeError); |
873 assertThrows(() => Array.prototype.concat.apply(obj), TypeError); | 873 assertThrows(() => Array.prototype.concat.apply(obj), TypeError); |
874 })(); | 874 })(); |
| 875 |
| 876 (function testConcatRevokedProxy() { |
| 877 "use strict"; |
| 878 var target = []; |
| 879 var handler = { |
| 880 get(_, name) { |
| 881 if (name === Symbol.isConcatSpreadable) { |
| 882 p.revoke(); |
| 883 } |
| 884 return target[name]; |
| 885 } |
| 886 } |
| 887 |
| 888 p = Proxy.revocable(target, handler); |
| 889 target = {}; |
| 890 target.__proto__ = p.proxy; |
| 891 assertThrows(function() { [].concat({ __proto__: p.proxy }); }, TypeError); |
| 892 |
| 893 target = []; |
| 894 var p = Proxy.revocable(target, handler); |
| 895 assertThrows(function() { [].concat(p.proxy); }, TypeError); |
| 896 })(); |
OLD | NEW |