tor-browser

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

15.2.3.6-4-508.js (1038B)


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