tor-browser

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

15.2.3.6-4-285.js (1139B)


      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-285
      6 description: >
      7    Object.defineProperty - 'O' is an Array, 'name' is generic own
      8    accessor property of 'O', test TypeError is thrown when updating
      9    the [[Get]] attribute value of 'name' which is defined as
     10    non-configurable (15.4.5.1 step 5)
     11 includes: [propertyHelper.js]
     12 ---*/
     13 
     14 
     15 var arrObj = [];
     16 
     17 function getFunc() {
     18  return 12;
     19 }
     20 
     21 function setFunc(value) {
     22  arrObj.setVerifyHelpProp = value;
     23 }
     24 Object.defineProperty(arrObj, "property", {
     25  get: getFunc,
     26  set: setFunc
     27 });
     28 try {
     29  Object.defineProperty(arrObj, "property", {
     30    get: function() {
     31      return 36;
     32    }
     33  });
     34  throw new Test262Error("Expected an exception.");
     35 } catch (e) {
     36  verifyEqualTo(arrObj, "property", getFunc());
     37 
     38  verifyWritable(arrObj, "property", "setVerifyHelpProp");
     39 
     40  if (!(e instanceof TypeError)) {
     41    throw new Test262Error("Expected TypeError, got " + e);
     42  }
     43 }
     44 
     45 verifyProperty(arrObj, "property", {
     46  enumerable: false,
     47  configurable: false,
     48 });
     49 
     50 reportCompare(0, 0);