tor-browser

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

S11.6.1_A2.3_T1.js (987B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    ToNumber(first expression) is called first, and then ToNumber(second
      7    expression)
      8 es5id: 11.6.1_A2.3_T1
      9 description: Checking with "throw"
     10 ---*/
     11 
     12 //CHECK#1
     13 var x = { valueOf: function () { throw "x"; } };
     14 var y = { valueOf: function () { throw "y"; } };
     15 try {
     16   x + y;
     17   throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: ' + (x + y));
     18 } catch (e) {
     19   if (e === "y") {
     20     throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)');
     21   } else {
     22     if (e !== "x") {
     23       throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: ' + (e));
     24     }
     25   }
     26 }
     27 
     28 reportCompare(0, 0);