js/src/tests/ecma_3/Exceptions/15.11.7.6-001.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /*
     7  *
     8  * Date:    14 April 2003
     9  * SUMMARY: Prototype of predefined error objects should be DontEnum
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 201989;
    16 var summary = 'Prototype of predefined error objects should be DontEnum';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 /*
    26  * Tests that |F.prototype| is not enumerable in |F|
    27  */
    28 function testDontEnum(F)
    29 {
    30   var proto = F.prototype;
    32   for (var prop in F)
    33   {
    34     if (F[prop] === proto)
    35       return false;
    36   }
    37   return true;
    38 }
    41 var list = [
    42   "Error",
    43   "ConversionError",
    44   "EvalError",
    45   "RangeError",
    46   "ReferenceError",
    47   "SyntaxError",
    48   "TypeError",
    49   "URIError"
    50   ];
    53 for (i in list)
    54 {
    55   var F = this[list[i]];
    57   // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
    58   if (F)
    59   {
    60     status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|';
    61     actual = testDontEnum(F);
    62     expect = true;
    63     addThis();
    64   }
    65 }
    69 //-----------------------------------------------------------------------------
    70 test();
    71 //-----------------------------------------------------------------------------
    75 function addThis()
    76 {
    77   statusitems[UBound] = status;
    78   actualvalues[UBound] = actual;
    79   expectedvalues[UBound] = expect;
    80   UBound++;
    81 }
    84 function test()
    85 {
    86   enterFunc('test');
    87   printBugNumber(BUGNUMBER);
    88   printStatus(summary);
    90   for (var i=0; i<UBound; i++)
    91   {
    92     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    93   }
    95   exitFunc ('test');
    96 }

mercurial