tor-browser

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

mapped-arguments-nonconfigurable-nonwritable-1.js (849B)


      1 // Copyright (C) 2015 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: Mapped arguments object with non-configurable property
      6 description: >
      7    Mapped arguments property is changed to non-configurable and
      8    non-writable. Perform property attribute changes with a single
      9    [[DefineOwnProperty]] call. Mapped values are unchanged, mapping
     10    itself is removed.
     11 flags: [noStrict]
     12 ---*/
     13 
     14 function argumentsNonConfigurableAndNonWritable(a) {
     15  Object.defineProperty(arguments, "0", {configurable: false, writable: false});
     16  assert.sameValue(a, 1);
     17  assert.sameValue(arguments[0], 1);
     18 
     19  // Postcondition: Arguments mapping is removed.
     20  a = 2;
     21  assert.sameValue(a, 2);
     22  assert.sameValue(arguments[0], 1);
     23 }
     24 argumentsNonConfigurableAndNonWritable(1);
     25 
     26 reportCompare(0, 0);