OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 272 matching lines...) Loading... |
283 // Check slicing on arguments object when argument has been deleted by index. | 283 // Check slicing on arguments object when argument has been deleted by index. |
284 (function() { | 284 (function() { |
285 function func(x, y, z) { | 285 function func(x, y, z) { |
286 assertEquals(3, arguments.length); | 286 assertEquals(3, arguments.length); |
287 delete arguments[1]; | 287 delete arguments[1]; |
288 assertEquals([x,,z], Array.prototype.slice.call(arguments, 0)); | 288 assertEquals([x,,z], Array.prototype.slice.call(arguments, 0)); |
289 } | 289 } |
290 | 290 |
291 func('a', 'b', 'c'); | 291 func('a', 'b', 'c'); |
292 })(); | 292 })(); |
| 293 |
| 294 // Check slicing of holey objects with elements in the prototype |
| 295 (function() { |
| 296 function f() { |
| 297 delete arguments[1]; |
| 298 arguments.__proto__[1] = 5; |
| 299 var result = Array.prototype.slice.call(arguments); |
| 300 delete arguments.__proto__[1]; |
| 301 assertEquals([1,5,3], result); |
| 302 } |
| 303 f(1,2,3); |
| 304 })(); |
OLD | NEW |