tor-browser

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

S11.2.2_A3_T3.js (1030B)


      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    If Type(NewExpression) or Type(MemberExpression) is not Object, throw
      7    TypeError
      8 es5id: 11.2.2_A3_T3
      9 description: Checking "string primitive" case
     10 ---*/
     11 
     12 //CHECK#1
     13 try {
     14  new 1;
     15  throw new Test262Error('#1: new "1" throw TypeError');	
     16 }
     17 catch (e) {
     18  if ((e instanceof TypeError) !== true) {
     19    throw new Test262Error('#1: new "1" throw TypeError');	
     20  }
     21 }
     22 
     23 //CHECK#2
     24 try {
     25  var x = "1";
     26  new x;
     27  throw new Test262Error('#2: var x = "1"; new x throw TypeError');	
     28 }
     29 catch (e) {
     30  if ((e instanceof TypeError) !== true) {
     31    throw new Test262Error('#2: var x = "1"; new x throw TypeError');	
     32  }
     33 }
     34 
     35 //CHECK#3
     36 try {
     37  var x = "1";
     38  new x();
     39  throw new Test262Error('#3: var x = "1"; new x() throw TypeError'); 
     40 }
     41 catch (e) {
     42  if ((e instanceof TypeError) !== true) {
     43    throw new Test262Error('#3: var x = "1"; new x() throw TypeError'); 
     44  }
     45 }
     46 
     47 reportCompare(0, 0);