tor-browser

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

15.2.3.6-4-351.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-351
      6 description: >
      7    ES5 Attributes - fail to update [[Enumerable]] attribute of data
      8    property ([[Writable]] is true, [[Enumerable]] is false,
      9    [[Configurable]] is false) to different value
     10 ---*/
     11 
     12 var obj = {};
     13 
     14 Object.defineProperty(obj, "prop", {
     15  value: 2010,
     16  writable: true,
     17  enumerable: false,
     18  configurable: false
     19 });
     20 
     21 var propertyDefineCorrect = obj.hasOwnProperty("prop");
     22 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
     23 assert.throws(TypeError, function() {
     24  Object.defineProperty(obj, "prop", {
     25    enumerable: true
     26  });
     27 });
     28 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
     29 assert(propertyDefineCorrect, 'propertyDefineCorrect !== true');
     30 assert.sameValue(desc1.enumerable, false, 'desc1.enumerable');
     31 assert.sameValue(obj.prop, 2010, 'obj.prop');
     32 assert.sameValue(desc2.enumerable, false, 'desc2.enumerable');
     33 
     34 reportCompare(0, 0);