tor-browser

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

S13.2.1_A8_T2.js (886B)


      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    When the [[Call]] property for a Function object F is called, the following steps are taken:
      7    2. Evaluate F's FunctionBody;
      8    if Result.type is thrown then Result.value is thrown too
      9 es5id: 13.2.1_A8_T2
     10 description: >
     11    Throwing an exception within a function body. Declaring function
     12    with "var __func = function (message)"
     13 ---*/
     14 
     15 var CATCH_ME_IF_YOU_CAN = true;
     16 
     17 var __func = function (message){
     18    var x = 1;
     19    throw (message)
     20    return x;
     21 }
     22 
     23 try{
     24    var x=__func(CATCH_ME_IF_YOU_CAN)
     25    throw new Test262Error('#0: var x=__func(CATCH_ME_IF_YOU_CAN) lead to throwing exception');
     26 } catch(e){
     27    if (!e) {
     28    	throw new Test262Error('#1: Exception === true. Actual: exception ==='+e);
     29    }
     30 }
     31 
     32 reportCompare(0, 0);