2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation.
17 * All Rights Reserved.
19 * Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
20 * Date: 09 October 2001
22 * SUMMARY: Regression test for Bugzilla bug 99663
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=99663
25 *******************************************************************************
26 *******************************************************************************
27 * ESSENTIAL!: this test should contain, or be loaded after, a call to
31 * Only JS version 1.2 or less has the behavior we're expecting here -
33 * Brendan: "The JS_SetVersion stickiness is necessary for tests such as
34 * this one to work properly. I think the existing js/tests have been lucky
35 * in dodging the buggy way that JS_SetVersion's effect can be undone by
38 * Note: it is the function statements for f1(), etc. that MUST be compiled
39 * in JS version 1.2 or less for the test to pass -
41 *******************************************************************************
42 *******************************************************************************
45 * NOTE: the test uses the |it| object of SpiderMonkey; don't run it in Rhino -
48 //-----------------------------------------------------------------------------
51 var summary = 'Regression test for Bugzilla bug 99663';
53 * This testcase expects error messages containing
54 * the phrase 'read-only' or something similar -
56 var READONLY = /read\s*-?\s*only/;
57 var READONLY_TRUE = 'a "read-only" error';
58 var READONLY_FALSE = 'Error: ';
59 var FAILURE = 'NO ERROR WAS GENERATED!';
64 var expectedvalues = [];
65 var actualvalues = [];
69 * These MUST be compiled in JS1.2 or less for the test to work - see above
82 for (it.rdonly in this);
94 * Begin testing by capturing actual vs. expected values.
95 * Initialize to FAILURE; this will get reset if all goes well -
104 actual = readOnly(e.message);
106 expect= READONLY_TRUE;
107 status = 'Section 1 of test - got ' + actual;
118 actual = readOnly(e.message);
120 expect= READONLY_TRUE;
121 status = 'Section 2 of test - got ' + actual;
132 actual = readOnly(e.message);
134 expect= READONLY_TRUE;
135 status = 'Section 3 of test - got ' + actual;
140 //-----------------------------------------------------------------------------
142 //-----------------------------------------------------------------------------
146 function readOnly(msg)
148 if (msg.match(READONLY))
149 return READONLY_TRUE;
150 return READONLY_FALSE + msg;
156 statusitems[UBound] = status;
157 actualvalues[UBound] = actual;
158 expectedvalues[UBound] = expect;
165 writeLineToLog ('Bug Number ' + bug);
166 writeLineToLog ('STATUS: ' + summary);
168 for (var i=0; i<UBound; i++)
170 writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]);