tor-browser

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

15.2.3.6-4-255.js (1280B)


      1 // Copyright (c) 2012 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es5id: 15.2.3.6-4-255
      6 description: >
      7    Object.defineProperty - 'O' is an Array, 'name' is an array index
      8    named property, 'name' is accessor property and 'desc' is accessor
      9    descriptor, and the [[Configurable]] attribute value of 'name' is
     10    false, test TypeError is thrown if the [[Get]] field of 'desc' is
     11    present, and the [[Get]] field of 'desc' and the [[Get]] attribute
     12    value of 'name' are two objects which refer to the different
     13    objects (15.4.5.1 step 4.c)
     14 includes: [propertyHelper.js]
     15 ---*/
     16 
     17 var arrObj = [];
     18 
     19 function getFunc() {
     20  return 12;
     21 }
     22 Object.defineProperty(arrObj, "1", {
     23  get: getFunc
     24 });
     25 
     26 try {
     27  Object.defineProperty(arrObj, "1", {
     28    get: function() {
     29      return 14;
     30    }
     31  });
     32 
     33  throw new Test262Error("Expected TypeError");
     34 } catch (e) {
     35  assert(e instanceof TypeError);
     36  assert(arrObj.hasOwnProperty("1"));
     37 
     38  var desc = Object.getOwnPropertyDescriptor(arrObj, "1");
     39 
     40  assert(arrObj[1] === getFunc());
     41 
     42  assert(desc.hasOwnProperty("set") && typeof desc.set === "undefined");
     43 }
     44 
     45 verifyProperty(arrObj, "1", {
     46  enumerable: false,
     47  configurable: false,
     48 });
     49 
     50 reportCompare(0, 0);