tor-browser

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

15.2.3.6-2-45.js (825B)


      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-45
      6 description: >
      7    Object.defineProperty - argument 'P' is an object whose toString
      8    method returns an object and whose valueOf method returns a
      9    primitive value
     10 ---*/
     11 
     12 var obj = {};
     13 var toStringAccessed = false;
     14 var valueOfAccessed = false;
     15 
     16 var ownProp = {
     17  toString: function() {
     18    toStringAccessed = true;
     19    return {};
     20  },
     21  valueOf: function() {
     22    valueOfAccessed = true;
     23    return "abc";
     24  }
     25 };
     26 
     27 Object.defineProperty(obj, ownProp, {});
     28 
     29 assert(obj.hasOwnProperty("abc"), 'obj.hasOwnProperty("abc") !== true');
     30 assert(valueOfAccessed, 'valueOfAccessed !== true');
     31 assert(toStringAccessed, 'toStringAccessed !== true');
     32 
     33 reportCompare(0, 0);