tor-browser

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

nonwritable-nonenumerable-nonconfigurable-descriptors-set-by-param.js (1127B)


      1 // Copyright (C) 2017 Caio Lima. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
      6 info: |
      7    Change the descriptor using [[DefineOwnProperty]] to
      8    {writable: false, enumerable: false}, set a = 2 and then
      9    change property descriptor to {configurable: false}.
     10    The descriptor's enumerable property continue with its configured value.
     11 flags: [noStrict]
     12 esid: sec-arguments-exotic-objects-defineownproperty-p-desc
     13 includes: [propertyHelper.js]
     14 ---*/
     15 
     16 function fn(a) {
     17  Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
     18  a = 2;
     19  Object.defineProperty(arguments, "0", {configurable: false});
     20 
     21  verifyProperty(arguments, "0", {
     22    value: 1,
     23    writable: false,
     24    enumerable: false,
     25    configurable: false,
     26  });
     27 
     28  // Postcondition: Arguments mapping is removed.
     29  a = 3;
     30 
     31  verifyProperty(arguments, "0", {
     32    value: 1,
     33    writable: false,
     34    enumerable: false,
     35    configurable: false,
     36  });
     37 }
     38 fn(1);
     39 
     40 reportCompare(0, 0);