tor-browser

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

15.2.3.3-2-47.js (938B)


      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.3-2-47
      6 description: >
      7    Object.getOwnPropertyDescriptor - uses inherited toString method
      8    when 'P' is an object with an own valueOf and inherited toString
      9    methods
     10 ---*/
     11 
     12 var proto = {};
     13 var valueOfAccessed = false;
     14 var toStringAccessed = false;
     15 
     16 proto.toString = function() {
     17  toStringAccessed = true;
     18  return "test";
     19 };
     20 
     21 var Con = function() {};
     22 Con.prototype = proto;
     23 
     24 var child = new Con();
     25 child.valueOf = function() {
     26  valueOfAccessed = true;
     27  return "10";
     28 };
     29 var obj = {
     30  "10": "length1",
     31  "test": "length2"
     32 };
     33 var desc = Object.getOwnPropertyDescriptor(obj, child);
     34 
     35 assert.sameValue(desc.value, "length2", 'desc.value');
     36 assert(toStringAccessed, 'toStringAccessed !== true');
     37 assert.sameValue(valueOfAccessed, false, 'valueOfAccessed');
     38 
     39 reportCompare(0, 0);