tor-browser

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

15.2.3.6-4-525.js (1056B)


      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-525
      6 description: >
      7    ES5 Attributes - fail to update [[Get]] attribute of accessor
      8    property ([[Get]] is a Function, [[Set]] is undefined,
      9    [[Enumerable]] is false, [[Configurable]] is false) to different
     10    value
     11 ---*/
     12 
     13 var obj = {};
     14 var getFunc = function() {
     15  return 1001;
     16 };
     17 
     18 Object.defineProperty(obj, "prop", {
     19  get: getFunc,
     20  set: undefined,
     21  enumerable: false,
     22  configurable: false
     23 });
     24 
     25 var result1 = obj.prop === 1001;
     26 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
     27 assert.throws(TypeError, function() {
     28  Object.defineProperty(obj, "prop", {
     29    get: undefined
     30  });
     31 });
     32 var result2 = obj.prop === 1001;
     33 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
     34 
     35 assert(result1, 'result1 !== true');
     36 assert(result2, 'result2 !== true');
     37 assert.sameValue(desc1.get, getFunc, 'desc1.get');
     38 assert.sameValue(desc2.get, getFunc, 'desc2.get');
     39 
     40 reportCompare(0, 0);