tor-browser

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

15.2.3.3-2-46.js (818B)


      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-46
      6 description: >
      7    Object.getOwnPropertyDescriptor - TypeError exception was thrown
      8    when 'P' is an object that both toString and valueOf wouldn't
      9    return primitive value
     10 ---*/
     11 
     12 var obj = {
     13  "1": 1
     14 };
     15 var toStringAccessed = false;
     16 var valueOfAccessed = false;
     17 
     18 var ownProp = {
     19  toString: function() {
     20    toStringAccessed = true;
     21    return [1];
     22  },
     23  valueOf: function() {
     24    valueOfAccessed = true;
     25    return [1];
     26  }
     27 };
     28 assert.throws(TypeError, function() {
     29  Object.getOwnPropertyDescriptor(obj, ownProp);
     30 });
     31 assert(toStringAccessed, 'toStringAccessed !== true');
     32 assert(valueOfAccessed, 'valueOfAccessed !== true');
     33 
     34 reportCompare(0, 0);