tor-browser

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

15.2.3.3-2-45.js (697B)


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