| 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: 26 Feb 2001 |
| 8 | * See http://bugzilla.mozilla.org/show_bug.cgi?id=44009 |
| 9 | * |
| 10 | * SUMMARY: Testing that we don't crash on obj.toSource() |
| 11 | */ |
| 12 | //----------------------------------------------------------------------------- |
| 13 | var gTestfile = 'regress-44009.js'; |
| 14 | var BUGNUMBER = 44009; |
| 15 | var summary = "Testing that we don't crash on obj.toSource()"; |
| 16 | var obj1 = {}; |
| 17 | var sToSource = ''; |
| 18 | var self = this; //capture a reference to the global JS object - |
| 19 | |
| 20 | |
| 21 | |
| 22 | //----------------------------------------------------------------------------- |
| 23 | test(); |
| 24 | //----------------------------------------------------------------------------- |
| 25 | |
| 26 | |
| 27 | function test() |
| 28 | { |
| 29 | enterFunc ('test'); |
| 30 | printBugNumber(BUGNUMBER); |
| 31 | printStatus (summary); |
| 32 | |
| 33 | var obj2 = {}; |
| 34 | |
| 35 | // test various objects and scopes - |
| 36 | testThis(self); |
| 37 | testThis(this); |
| 38 | testThis(obj1); |
| 39 | testThis(obj2); |
| 40 | |
| 41 | reportCompare('No Crash', 'No Crash', ''); |
| 42 | |
| 43 | exitFunc ('test'); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | // We're just testing that we don't crash by doing this - |
| 48 | function testThis(obj) |
| 49 | { |
| 50 | sToSource = obj.toSource(); |
| 51 | obj.prop = obj; |
| 52 | sToSource = obj.toSource(); |
| 53 | } |