tor-browser

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

arguments-unmapped-mutation.js (737B)


      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: Unmapped arguments object mutation during traversal using for..of
      6 info: |
      7    "Unmapped" arguments objects should be able to be traversed using a
      8    `for..of` loop, and dynamic changes to their contents should be reflected
      9    in the iterated values.
     10 flags: [noStrict]
     11 ---*/
     12 
     13 var expected = [1, 4, 6];
     14 var i = 0;
     15 
     16 (function() {
     17  'use strict';
     18  for (var value of arguments) {
     19    assert.sameValue(value, expected[i], 'argument at index ' + i);
     20    i++;
     21    arguments[i] *= 2;
     22  }
     23 }(1, 2, 3));
     24 
     25 assert.sameValue(i, 3, 'Visits all arguments');
     26 
     27 reportCompare(0, 0);