tor-browser

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

15.2.3.6-4-554.js (1257B)


      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-554
      6 description: >
      7    ES5 Attributes - success to update [[Enumerable]] attribute of
      8    accessor property ([[Get]] is a Function, [[Set]] is a Function,
      9    [[Enumerable]] is false, [[Configurable]] is true) 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: setFunc,
     27  enumerable: false,
     28  configurable: true
     29 });
     30 
     31 var result1 = false;
     32 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
     33 for (var p1 in obj) {
     34  if (p1 === "prop") {
     35    result1 = true;
     36  }
     37 }
     38 
     39 Object.defineProperty(obj, "prop", {
     40  enumerable: true
     41 });
     42 var result2 = false;
     43 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
     44 for (var p2 in obj) {
     45  if (p2 === "prop") {
     46    result2 = true;
     47  }
     48 }
     49 
     50 assert.sameValue(result1, false, 'result1');
     51 assert(result2, 'result2 !== true');
     52 assert.sameValue(desc1.enumerable, false, 'desc1.enumerable');
     53 assert.sameValue(desc2.enumerable, true, 'desc2.enumerable');
     54 
     55 reportCompare(0, 0);