Home | History | Annotate | Download | only in Exceptions
      1 /**
      2     File Name:          global-002
      3     Corresponds To:     ecma/GlobalObject/15.1-2-n.js
      4     ECMA Section:       The global object
      5     Description:
      6 
      7     The global object does not have a [[Construct]] property; it is not
      8     possible to use the global object as a constructor with the new operator.
      9 
     10 
     11     Author:             christine (at) netscape.com
     12     Date:               12 november 1997
     13 */
     14     var SECTION = "global-002";
     15     var VERSION = "JS1_4";
     16     var TITLE   = "The Global Object";
     17 
     18     startTest();
     19     writeHeaderToLog( SECTION + " "+ TITLE);
     20 
     21     var tc = 0;
     22     var testcases = new Array();
     23 
     24 
     25     var result = "Failed";
     26     var exception = "No exception thrown";
     27     var expect = "Passed";
     28 
     29     try {
     30         result = this();
     31     } catch ( e ) {
     32         result = expect;
     33         exception = e.toString();
     34     }
     35 
     36     testcases[tc++] = new TestCase(
     37         SECTION,
     38         "result = this()" +
     39         " (threw " + exception +")",
     40         expect,
     41         result );
     42 
     43     test();
     44