tor-browser

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

15.2.3.6-2-48.js (933B)


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