tor-browser

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

15.2.3.6-4-253.js (1148B)


      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-253
      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 [[Set]] field of 'desc' is
     11    present, and the [[Set]] field of 'desc' is an object and the
     12    [[Set]] attribute value of 'name' is undefined (15.4.5.1 step 4.c)
     13 includes: [propertyHelper.js]
     14 ---*/
     15 
     16 var arrObj = [];
     17 
     18 function getFunc() {
     19  return 12;
     20 }
     21 
     22 Object.defineProperty(arrObj, "1", {
     23  get: getFunc,
     24  set: undefined
     25 });
     26 
     27 try {
     28  Object.defineProperty(arrObj, "1", {
     29    set: function() {}
     30  });
     31  throw new Test262Error("Expected an exception.");
     32 } catch (e) {
     33  verifyEqualTo(arrObj, "1", getFunc());
     34 
     35  if (!(e instanceof TypeError)) {
     36    throw new Test262Error("Expected TypeError, got " + e);
     37  }
     38 }
     39 
     40 verifyProperty(arrObj, "1", {
     41  enumerable: false,
     42  configurable: false,
     43 });
     44 
     45 reportCompare(0, 0);