tor-browser

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

regress-338653.js (1141B)


      1 // |reftest| slow
      2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 //-----------------------------------------------------------------------------
      8 var BUGNUMBER = 338653;
      9 var summary = 'Force GC when JSRuntime.gcMallocBytes hits ' +
     10  'JSRuntime.gcMaxMallocBytes';
     11 var actual = 'No Crash';
     12 var expect = 'No Crash';
     13 
     14 printBugNumber(BUGNUMBER);
     15 printStatus (summary);
     16 print('This test should never fail explicitly. ' +
     17      'You must view the memory usage during the test. ' +
     18      'This test fails if the memory usage repeatedly spikes ' +
     19      'by several hundred megabytes.');
     20 
     21 function dosubst()
     22 {
     23  var f = '0x';
     24  var s = f;
     25 
     26  for (var i = 0; i < 18; i++)
     27  {
     28    s += s;
     29  }
     30 
     31  var index = s.indexOf(f);
     32  while (index != -1 && index < 10000) {
     33    s = s.substr(0, index) + '1' + s.substr(index + f.length);
     34    index = s.indexOf(f);
     35  }
     36 
     37 }
     38 
     39 dosubst(); 
     40 
     41 reportCompare(expect, actual, summary);