tor-browser

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

15.2.3.7-6-a-244.js (1166B)


      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.7-6-a-244
      6 description: >
      7    Object.defineProperties - TypeError is thrown if 'O' is an Array,
      8    'P' is an array index named property that already exists on 'O' is
      9    accessor property with  [[Configurable]] false, 'desc' is accessor
     10    descriptor, the [[Get]] field of 'desc' is present, and the
     11    [[Get]] field of 'desc' and the [[Get]] attribute value of 'P' are
     12    two objects which refer to the different objects  (15.4.5.1 step
     13    4.c)
     14 includes: [propertyHelper.js]
     15 ---*/
     16 
     17 var arr = [];
     18 
     19 function get_fun() {
     20  return 36;
     21 }
     22 Object.defineProperty(arr, "1", {
     23  get: get_fun
     24 });
     25 
     26 try {
     27  Object.defineProperties(arr, {
     28    "1": {
     29      get: function() {
     30        return 12;
     31      }
     32    }
     33  });
     34 
     35  throw new Test262Error("Expected an exception.");
     36 } catch (e) {
     37  verifyEqualTo(arr, "1", get_fun());
     38 
     39  if (!(e instanceof TypeError)) {
     40    throw new Test262Error("Expected TypeError, got " + e);
     41  }
     42 }
     43 
     44 verifyProperty(arr, "1", {
     45  enumerable: false,
     46  configurable: false,
     47 });
     48 
     49 reportCompare(0, 0);