tor-browser

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

regress-363258.js (1169B)


      1 // |reftest| random -- bug 524788
      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 //-----------------------------------------------------------------------------
      9 var BUGNUMBER = 363258;
     10 var summary = 'Timer resolution';
     11 var actual = '';
     12 var expect = '';
     13 
     14 
     15 //-----------------------------------------------------------------------------
     16 test();
     17 //-----------------------------------------------------------------------------
     18 
     19 function test()
     20 {
     21  printBugNumber(BUGNUMBER);
     22  printStatus (summary);
     23 
     24  var start = 0;
     25  var stop  = 0;
     26  var i;
     27  var limit = 0;
     28  var incr  = 10;
     29  var resolution = 5;
     30  
     31  while (stop - start == 0)
     32  {
     33    limit += incr;
     34    start = Date.now();
     35    for (i = 0; i < limit; i++) {}
     36    stop = Date.now();
     37  }
     38 
     39  print('limit=' + limit + ', resolution=' + resolution + ', time=' + (stop - start));
     40 
     41  expect = true;
     42  actual = (stop - start <= resolution);
     43 
     44  reportCompare(expect, actual, summary);
     45 }