tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

arguments-mapped-mutation.js (717B)


      1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 13.6.4
      5 description: Mapped arguments object mutation during traversal using for..of
      6 info: |
      7    "Mapped" arguments objects should be able to be traversed using a `for..of`
      8    loop, and dynamic changes to their contents should be reflected in the
      9    iterated values.
     10 flags: [noStrict]
     11 ---*/
     12 
     13 var expected = [1, 4, 6];
     14 var i = 0;
     15 
     16 (function() {
     17  for (var value of arguments) {
     18    assert.sameValue(value, expected[i], 'argument at index ' + i);
     19    i++;
     20    arguments[i] *= 2;
     21  }
     22 }(1, 2, 3));
     23 
     24 assert.sameValue(i, 3, 'Visits all arguments');
     25 
     26 reportCompare(0, 0);