tor-browser

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

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