tor-browser

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

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


      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-configurable and non-writable
      6 info: |
      7    Mapping just stop working when property is set to non-writable. Change the
      8    descriptor using [[DefineOwnProperty]] to {configurable: false}, set a = 2 and then
      9    change property descriptor to {writable: false}. The descriptor's value is
     10    the one set before the property be configured as {writable: false}.
     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", {configurable: false});
     18  a = 2;
     19  Object.defineProperty(arguments, "0", {writable: false});
     20 
     21  verifyProperty(arguments, "0", {
     22    value: 2,
     23    writable: false,
     24    enumerable: true,
     25    configurable: false,
     26  });
     27 
     28  // Postcondition: Arguments mapping is removed.
     29  a = 3;
     30 
     31  verifyProperty(arguments, "0", {
     32    value: 2,
     33    writable: false,
     34    enumerable: true,
     35    configurable: false,
     36  });
     37 }
     38 fn(1);
     39 
     40 
     41 reportCompare(0, 0);