js/src/tests/js1_5/extensions/regress-44009.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/extensions/regress-44009.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * Date: 26 Feb 2001
    1.11 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=44009
    1.12 + *
    1.13 + * SUMMARY:  Testing that we don't crash on obj.toSource()
    1.14 + */
    1.15 +//-----------------------------------------------------------------------------
    1.16 +var BUGNUMBER = 44009;
    1.17 +var summary = "Testing that we don't crash on obj.toSource()";
    1.18 +var obj1 = {};
    1.19 +var sToSource = '';
    1.20 +var self = this;  //capture a reference to the global JS object -
    1.21 +
    1.22 +
    1.23 +
    1.24 +//-----------------------------------------------------------------------------
    1.25 +test();
    1.26 +//-----------------------------------------------------------------------------
    1.27 +
    1.28 +
    1.29 +function test()
    1.30 +{
    1.31 +  enterFunc ('test');
    1.32 +  printBugNumber(BUGNUMBER);
    1.33 +  printStatus (summary);
    1.34 +
    1.35 +  var obj2 = {};
    1.36 +
    1.37 +  // test various objects and scopes -
    1.38 +  testThis(self);
    1.39 +  testThis(this);
    1.40 +  testThis(obj1);
    1.41 +  testThis(obj2);
    1.42 +
    1.43 +  reportCompare('No Crash', 'No Crash', '');
    1.44 +
    1.45 +  exitFunc ('test');
    1.46 +}
    1.47 +
    1.48 +
    1.49 +// We're just testing that we don't crash by doing this -
    1.50 +function testThis(obj)
    1.51 +{
    1.52 +  sToSource = obj.toSource();
    1.53 +  obj.prop = obj;
    1.54 +  sToSource = obj.toSource();
    1.55 +}

mercurial