tor-browser

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

S13.2.2_A1_T2.js (1322B)


      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    Since a function is an object, it might be set to [[Prototype]] property
      7    of a new created object through [[Construct]] property
      8 es5id: 13.2.2_A1_T2
      9 description: Declaring a function with "var __PROTO = function()"
     10 ---*/
     11 
     12 var __MONSTER="monster";
     13 var __PREDATOR="predator";
     14 
     15 var __PROTO = function(){};
     16 
     17 try{
     18    __PROTO.type=__MONSTER;
     19 }
     20 catch(e){
     21    throw new Test262Error('#0: __PROTO.type=__MONSTER does not lead to throwing exception')
     22 }
     23 
     24 var __FACTORY = function(){};
     25 
     26 __FACTORY.prototype=__PROTO;
     27 
     28 var __monster = new __FACTORY();
     29 
     30 //////////////////////////////////////////////////////////////////////////////
     31 //CHECK#1
     32 if (!(__PROTO.isPrototypeOf(__monster))) {
     33 throw new Test262Error('#1: __PROTO.isPrototypeOf(__monster) must be true');
     34 }
     35 //
     36 //////////////////////////////////////////////////////////////////////////////
     37 
     38 //////////////////////////////////////////////////////////////////////////////
     39 //CHECK#2
     40 if (__monster.type !==__MONSTER) {
     41 throw new Test262Error('#2: __monster.type ===__MONSTER. Actual: __monster.type ==='+__monster.type);
     42 }
     43 //
     44 //////////////////////////////////////////////////////////////////////////////
     45 
     46 reportCompare(0, 0);