OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 assertEquals("", a.join("")); | 84 assertEquals("", a.join("")); |
85 a[123123123] = "o"; | 85 a[123123123] = "o"; |
86 a[1255215215] = "p"; | 86 a[1255215215] = "p"; |
87 assertEquals("op", a.join("")); | 87 assertEquals("op", a.join("")); |
88 | 88 |
89 a = new Array(100001); | 89 a = new Array(100001); |
90 for (var i = 0; i < a.length; i++) a[i] = undefined; | 90 for (var i = 0; i < a.length; i++) a[i] = undefined; |
91 a[5] = "ab"; | 91 a[5] = "ab"; |
92 a[90000] = "cd"; | 92 a[90000] = "cd"; |
93 assertEquals("abcd", a.join("")); // Must not throw. | 93 assertEquals("abcd", a.join("")); // Must not throw. |
| 94 |
| 95 |
| 96 // Make sure that each element is accessed exactly once, and in the correct |
| 97 // order. |
| 98 { |
| 99 var log = []; |
| 100 var p = new Proxy({length: 3, 0: 'a', 1: 'b'}, { |
| 101 get: function(t, k, r) { log.push(k); return Reflect.get(t, k, r); } |
| 102 }); |
| 103 |
| 104 assertEquals("a,b,", Array.prototype.join.call(p)); |
| 105 assertEquals(["length", "0", "1", "2"], log); |
| 106 } |
OLD | NEW |