tor-browser

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

mapped-arguments-nonconfigurable-nonwritable-4.js (919B)


      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 two
      9    [[DefineOwnProperty]] calls. Add intervening call to [[Set]].
     10 flags: [noStrict]
     11 ---*/
     12 
     13 function argumentsNonConfigurableThenNonWritableWithInterveningSet(a) {
     14  Object.defineProperty(arguments, "0", {configurable: false});
     15  arguments[0] = 2;
     16  Object.defineProperty(arguments, "0", {writable: false});
     17  assert.sameValue(a, 2);
     18  assert.sameValue(arguments[0], 2);
     19 
     20  // Postcondition: Arguments mapping is removed.
     21  a = 3;
     22  assert.sameValue(a, 3);
     23  assert.sameValue(arguments[0], 2);
     24 }
     25 argumentsNonConfigurableThenNonWritableWithInterveningSet(1);
     26 
     27 reportCompare(0, 0);