| 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 | * Date: 14 October 2001 |
| 8 | * |
| 9 | * SUMMARY: Regression test for Bugzilla bug 104584 |
| 10 | * See http://bugzilla.mozilla.org/show_bug.cgi?id=104584 |
| 11 | * |
| 12 | * Testing that we don't crash on this code. The idea is to |
| 13 | * call F,G WITHOUT providing an argument. This caused a crash |
| 14 | * on the second call to obj.toString() or print(obj) below - |
| 15 | */ |
| 16 | |
| 17 | //----------------------------------------------------------------------------- |
| 18 | var gTestfile = 'regress-104584.js'; |
| 19 | var BUGNUMBER = 104584; |
| 20 | var summary = "Testing that we don't crash on this code -"; |
| 21 | |
| 22 | printBugNumber(BUGNUMBER); |
| 23 | printStatus (summary); |
| 24 | |
| 25 | F(); |
| 26 | G(); |
| 27 | |
| 28 | reportCompare('No Crash', 'No Crash', ''); |
| 29 | |
| 30 | function F(obj) |
| 31 | { |
| 32 | if(!obj) |
| 33 | obj = {}; |
| 34 | obj.toString(); |
| 35 | gc(); |
| 36 | obj.toString(); |
| 37 | } |
| 38 | |
| 39 | |
| 40 | function G(obj) |
| 41 | { |
| 42 | if(!obj) |
| 43 | obj = {}; |
| 44 | print(obj); |
| 45 | gc(); |
| 46 | print(obj); |
| 47 | } |