tor-browser

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

S13.2_A4_T2.js (1931B)


      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 Function object(F) is constructed the following steps from 9 to 11 take place
      7    9.Create a new object as would be constructed by the expression new Object().
      8    10. Set the constructor property of Result(9) to F. This property is given attributes { DontEnum }.
      9    11. Set the "prototype" property of F to Result(9).
     10 es5id: 13.2_A4_T2
     11 description: >
     12    Checking prototype, prototype.constructor properties and
     13    {DontEnum} property of a constructor.  Using "var __gunc =
     14    function(){}" as a FunctionDeclaration
     15 ---*/
     16 
     17 var __gunc = function(){};
     18 
     19 //////////////////////////////////////////////////////////////////////////////
     20 //CHECK#1
     21 if (typeof __gunc.prototype !== 'object') {
     22 throw new Test262Error('#1: typeof __gunc.prototype === \'object\'. Actual: typeof __gunc.prototype ==='+typeof __gunc.prototype);
     23 }
     24 //
     25 //////////////////////////////////////////////////////////////////////////////
     26 
     27 //////////////////////////////////////////////////////////////////////////////
     28 //CHECK#2
     29 if (__gunc.prototype.constructor !== __gunc) {
     30 throw new Test262Error('#2: __gunc.prototype.constructor === __gunc. Actual: __gunc.prototype.constructor ==='+__gunc.prototype.constructor);
     31 }
     32 //
     33 //////////////////////////////////////////////////////////////////////////////
     34 
     35 var __constructor_was__enumed;
     36 
     37 for (__prop in __gunc.prototype){
     38    if (__prop === 'constructor')
     39        __constructor_was__enumed = true;
     40 }
     41 
     42 //////////////////////////////////////////////////////////////////////////////
     43 //CHECK#3
     44 if (__constructor_was__enumed) {
     45 throw new Test262Error('#3: __constructor_was__enumed === false. Actual: __constructor_was__enumed ==='+__constructor_was__enumed);
     46 }
     47 //
     48 //////////////////////////////////////////////////////////////////////////////
     49 
     50 reportCompare(0, 0);