Debian Codegraph @

rhino/testsrc/tests/ecma_3/Exceptions/15.11.7.6-001.js

raw symbols SCIP
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/. */
5
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 gTestfile = '15.11.7.6-001.js';
15 var UBound = 0;
16 var BUGNUMBER = 201989;
17 var summary = 'Prototype of predefined error objects should be DontEnum';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
24
25
26 /*
27 * Tests that |F.prototype| is not enumerable in |F|
28 */
29 function testDontEnum(F)
30 {
31 var proto = F.prototype;
32
33 for (var prop in F)
34 {
35 if (F[prop] === proto)
36 return false;
37 }
38 return true;
39 }
40
41
42 var list = [
43 "Error",
44 "ConversionError",
45 "EvalError",
46 "RangeError",
47 "ReferenceError",
48 "SyntaxError",
49 "TypeError",
50 "URIError"
51 ];
52
53
54 for (i in list)
55 {
56 var F = this[list[i]];
57
58 // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
59 if (F)
60 {
61 status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|';
62 actual = testDontEnum(F);
63 expect = true;
64 addThis();
65 }
66 }
67
68
69
70 //-----------------------------------------------------------------------------
71 test();
72 //-----------------------------------------------------------------------------
73
74
75
76 function addThis()
77 {
78 statusitems[UBound] = status;
79 actualvalues[UBound] = actual;
80 expectedvalues[UBound] = expect;
81 UBound++;
82 }
83
84
85 function test()
86 {
87 enterFunc('test');
88 printBugNumber(BUGNUMBER);
89 printStatus(summary);
90
91 for (var i=0; i<UBound; i++)
92 {
93 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
94 }
95
96 exitFunc ('test');
97 }