OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 // Flags: --allow-natives-syntax --harmony-concat-spreadable | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 function arguments_with_length_getter(f) { | 7 function arguments_with_length_getter(f) { |
8 arguments.__defineGetter__('length', f); | 8 arguments.__defineGetter__('length', f); |
9 return arguments; | 9 return arguments; |
10 } | 10 } |
11 | 11 |
12 var count = 0; | 12 var count = 0; |
13 function increment_count_return() { count++; return "boom"; } | 13 function increment_count_return() { count++; return "boom"; } |
14 function increment_count_throw() { count++; throw "boom"; } | 14 function increment_count_throw() { count++; throw "boom"; } |
15 | 15 |
(...skipping 28 matching lines...) Expand all Loading... |
44 a5.__proto__ = arguments_with_length_getter(increment_count_return); | 44 a5.__proto__ = arguments_with_length_getter(increment_count_return); |
45 a5[Symbol.isConcatSpreadable] = true; | 45 a5[Symbol.isConcatSpreadable] = true; |
46 [].concat(a5); | 46 [].concat(a5); |
47 assertEquals(3, count); | 47 assertEquals(3, count); |
48 | 48 |
49 var a6 = {}; | 49 var a6 = {}; |
50 a6.__proto__ = arguments_with_length_getter(increment_count_throw); | 50 a6.__proto__ = arguments_with_length_getter(increment_count_throw); |
51 a6[Symbol.isConcatSpreadable] = true; | 51 a6[Symbol.isConcatSpreadable] = true; |
52 assertThrows(function() { [].concat(a6); }); | 52 assertThrows(function() { [].concat(a6); }); |
53 assertEquals(4, count); | 53 assertEquals(4, count); |
OLD | NEW |