tor-browser

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

15.2.3.6-4-195.js (1005B)


      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-195
      6 description: >
      7    Object.defineProperty - 'O' is an Array, 'name' is an array index
      8    named property, 'name' is an inherited accessor property (15.4.5.1
      9    step 4.c)
     10 includes: [propertyHelper.js]
     11 ---*/
     12 
     13 function getFunc() {
     14  return arrObj.helpVerifySet;
     15 }
     16 
     17 function setFunc(value) {
     18  arrObj.helpVerifySet = value;
     19 }
     20 
     21 try {
     22  Object.defineProperty(Array.prototype, "0", {
     23    get: function() {
     24      return 11;
     25    },
     26    configurable: true
     27  });
     28 
     29  var arrObj = [];
     30 
     31 
     32  Object.defineProperty(arrObj, "0", {
     33    get: getFunc,
     34    set: setFunc,
     35    configurable: false
     36  });
     37 
     38  arrObj[0] = 13;
     39 
     40  verifyEqualTo(arrObj, "0", getFunc());
     41 
     42  verifyWritable(arrObj, "0", "helpVerifySet");
     43 
     44  verifyProperty(arrObj, "0", {
     45    enumerable: false,
     46    configurable: false,
     47  });
     48 } finally {
     49  delete Array.prototype[0];
     50 }
     51 
     52 reportCompare(0, 0);