initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma_3 / Function / regress-104584.js
1 /*
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/
6 *
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.
11 *
12 * The Original Code is mozilla.org code.
13 *
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.
18 *
19 * Contributor(s): jband@netscape.com, pschwartau@netscape.com
20 * Date: 14 October 2001
21 *
22 * SUMMARY: Regression test for Bugzilla bug 104584
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104584
24 *
25 * Testing that we don't crash on this code. The idea is to 
26 * call F,G WITHOUT providing an argument. This caused a crash
27 * on the second call to obj.toString() or print(obj) below -
28 */
29 //-----------------------------------------------------------------------------
30 var bug = 104584;
31 var summary = "Testing that we don't crash on this code -";
32
33 printBugNumber (bug);
34 printStatus (summary);
35
36 F();
37 G(); 
38
39 function F(obj)
40 {
41   if(!obj)
42     obj = {};
43   obj.toString();
44   gc();
45   obj.toString();
46 }
47
48
49 function G(obj)
50 {
51   if(!obj)
52     obj = {};
53   print(obj);
54   gc();
55   print(obj);
56 }