tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-44009.js (1314B)


      1 // |reftest| skip-if(!Object.prototype.toSource)
      2 
      3 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      4 /* This Source Code Form is subject to the terms of the Mozilla Public
      5 * License, v. 2.0. If a copy of the MPL was not distributed with this
      6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 /*
      9 * Date: 26 Feb 2001
     10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=44009
     11 *
     12 * SUMMARY:  Testing that we don't crash on obj.toSource()
     13 */
     14 //-----------------------------------------------------------------------------
     15 var BUGNUMBER = 44009;
     16 var summary = "Testing that we don't crash on obj.toSource()";
     17 var obj1 = {};
     18 var sToSource = '';
     19 var self = this;  //capture a reference to the global JS object -
     20 
     21 
     22 
     23 //-----------------------------------------------------------------------------
     24 test();
     25 //-----------------------------------------------------------------------------
     26 
     27 
     28 function test()
     29 {
     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 
     44 
     45 // We're just testing that we don't crash by doing this -
     46 function testThis(obj)
     47 {
     48  sToSource = obj.toSource();
     49  obj.prop = obj;
     50  sToSource = obj.toSource();
     51 }