tor-browser

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

timing-override.js (778B)


      1 // Firefox implements unconditional clamping of 20 usec; and for certain web-animation tests,
      2 // we hit some test failures because the Time Precision is too small. We override these functions
      3 // on a per-test basis for Firefox only.
      4 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
      5  window.assert_times_equal = (actual, expected, description) => {
      6    let TIME_PRECISION = 0.02;
      7    assert_approx_equals(actual, expected, TIME_PRECISION * 2, description);
      8  };
      9 
     10  window.assert_time_equals_literal = (actual, expected, description) => {
     11    let TIME_PRECISION = 0.02;
     12    if (Math.abs(expected) === Infinity) {
     13      assert_equals(actual, expected, description);
     14    } else {
     15      assert_approx_equals(actual, expected, TIME_PRECISION, description);
     16    }
     17  }
     18 }