tor-browser

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

arguments-unmapped-aliasing.js (782B)


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