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 var p = Proxy.revocable(target, handler); | |
889 assertThrows(function() { [].concat(p.proxy); }, TypeError); | |
890 | |
891 p = Proxy.revocable(target, handler); | |
892 target = {}; | |
893 target.__proto__ = p.proxy; | |
894 assertThrows(function() { [].concat({ __proto__: p.proxy }); }, TypeError); | |
neis
2016/07/11 09:25:19
Unfortunately the test file is a bit screwed up: t
caitp
2016/07/11 11:12:08
Thanks for the info, will do
| |
895 })(); | |
OLD | NEW |