tor-browser

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

mapped-arguments-nonconfigurable-nonwritable-3.js (1097B)


      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
     10    SetMutableBinding.
     11 flags: [noStrict]
     12 ---*/
     13 
     14 function argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(a) {
     15  Object.defineProperty(arguments, "0", {configurable: false});
     16  a = 2;
     17  Object.defineProperty(arguments, "0", {writable: false});
     18  assert.sameValue(a, 2);
     19  // `arguments[0] === 1` per ES2015, Rev 38, April 14, 2015 Final Draft.
     20  // Specification bug: https://bugs.ecmascript.org/show_bug.cgi?id=4371
     21  assert.sameValue(arguments[0], 2);
     22 
     23  // Postcondition: Arguments mapping is removed.
     24  a = 3;
     25  assert.sameValue(a, 3);
     26  assert.sameValue(arguments[0], 2);
     27 }
     28 argumentsNonConfigurableThenNonWritableWithInterveningSetMutableBinding(1);
     29 
     30 reportCompare(0, 0);