tor-browser

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

S13.2.2_A10.js (1096B)


      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    Calling a function as a constructor is possible as long as
      7    this.any_Function is declared
      8 es5id: 13.2.2_A10
      9 description: Calling a function as a constructor after it has been declared
     10 ---*/
     11 
     12 function FACTORY(){
     13   this.id = 0;
     14   
     15   this.func = function (){
     16      return 5;
     17   }
     18   
     19   this.id = this.func();
     20     
     21 }
     22 //////////////////////////////////////////////////////////////////////////////
     23 //CHECK#1
     24 try {
     25 var obj = new FACTORY();
     26 } catch (e) {
     27 throw new Test262Error('#1: var obj = new FACTORY() does not lead to throwing exception. Actual: Exception is '+e);
     28 }
     29 //
     30 //////////////////////////////////////////////////////////////////////////////
     31 
     32 //////////////////////////////////////////////////////////////////////////////
     33 //CHECK#2
     34 if (obj.id !== 5) {
     35 throw new Test262Error('#2: obj.id === 5. Actual: obj.id ==='+obj.id);
     36 }
     37 //
     38 //////////////////////////////////////////////////////////////////////////////
     39 
     40 reportCompare(0, 0);