tor-browser

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

mapped-arguments-nonconfigurable-strict-delete-3.js (1008B)


      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    Mapping works when property is non-configurable, arguments property
      8    was not deleted. [[Delete]] operations throws TypeError if called
      9    from strict-mode code. Arguments property is changed with
     10    [[DefineOwnProperty]].
     11 flags: [noStrict]
     12 ---*/
     13 
     14 function argumentsAndStrictDeleteDefineOwnProperty(a) {
     15  Object.defineProperty(arguments, "0", {configurable: false});
     16 
     17  // Precondition: Delete is unsuccessful and doesn't affect mapping.
     18  var args = arguments;
     19  assert.throws(TypeError, function() { "use strict"; delete args[0]; });
     20  assert.sameValue(a, 1);
     21  assert.sameValue(arguments[0], 1);
     22 
     23  Object.defineProperty(arguments, "0", {value: 2});
     24  assert.sameValue(a, 2);
     25  assert.sameValue(arguments[0], 2);
     26 }
     27 argumentsAndStrictDeleteDefineOwnProperty(1);
     28 
     29 reportCompare(0, 0);