tor-browser

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

15.2.3.6-4-97.js (968B)


      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-97
      6 description: >
      7    Object.defineProperty will throw TypeError when name.configurable
      8    = false, name.[[Set]] is undefined, desc.[[Set]] refers to an
      9    object (8.12.9 step 11.a.i)
     10 includes: [propertyHelper.js]
     11 ---*/
     12 
     13 
     14 var obj = {};
     15 
     16 function getFunc() {
     17  return "property";
     18 }
     19 
     20 Object.defineProperty(obj, "property", {
     21  get: getFunc,
     22  configurable: false
     23 });
     24 
     25 try {
     26  Object.defineProperty(obj, "property", {
     27    get: getFunc,
     28    set: function() {},
     29    configurable: false
     30  });
     31 
     32  throw new Test262Error("Expected an exception.");
     33 } catch (e) {
     34  verifyEqualTo(obj, "property", getFunc());
     35 
     36  if (!(e instanceof TypeError)) {
     37    throw new Test262Error("Expected TypeError, got " + e);
     38  }
     39 }
     40 
     41 verifyProperty(obj, "property", {
     42  enumerable: false,
     43  configurable: false,
     44 });
     45 
     46 reportCompare(0, 0);