Home | History | Annotate | Download | only in Regress
      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. All
     17 * Rights Reserved.
     18 *
     19 * Contributor(s): pschwartau (at) netscape.com
     20 * Date: 26 Feb 2001
     21 * See http://bugzilla.mozilla.org/show_bug.cgi?id=44009
     22 *
     23 * SUMMARY:  Testing that we don't crash on obj.toSource()
     24 */
     25 //-------------------------------------------------------------------------------------------------
     26 var bug = 44009;
     27 var summary = "Testing that we don't crash on obj.toSource()";
     28 var obj1 = {};
     29 var sToSource = '';
     30 var self = this;  //capture a reference to the global JS object -
     31 
     32 
     33 
     34 //-------------------------------------------------------------------------------------------------
     35 test();
     36 //-------------------------------------------------------------------------------------------------
     37 
     38 
     39 function test()
     40 {
     41   enterFunc ('test');
     42   printBugNumber (bug);
     43   printStatus (summary);
     44 
     45   var obj2 = {};
     46 
     47   // test various objects and scopes -
     48   testThis(self);
     49   testThis(this);
     50   testThis(obj1);
     51   testThis(obj2);
     52 
     53   exitFunc ('test');
     54 }
     55 
     56 
     57 // We're just testing that we don't crash by doing this -
     58 function testThis(obj)
     59 {
     60   sToSource = obj.toSource();
     61   obj.prop = obj;
     62   sToSource = obj.toSource();
     63 }