tor-browser

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

utils.js (895B)


      1 function checkLongTaskEntry(longtask, name = 'self') {
      2  assert_equals(longtask.entryType, 'longtask', 'The entryType should be longtask');
      3  assert_equals(longtask.name, name, 'Name should be ' + name + '.');
      4  assert_true(Number.isInteger(longtask.duration, 'The duration should be an integer.'));
      5  assert_greater_than_equal(longtask.duration, 50, 'The Duration should be greater than or equal to 50.');
      6  assert_greater_than_equal(longtask.startTime, 0, 'The startTime should be greater than or equal to 0.');
      7  const currentTime = performance.now();
      8  assert_less_than_equal(longtask.startTime, currentTime, 'The startTime should be less than or equal to current time.');
      9 }
     10 
     11 function hasUnrelatedTaskName(taskName, expectedTaskName) {
     12  return (taskName !== expectedTaskName);
     13 }
     14 
     15 function busyWait() {
     16  const deadline = performance.now() + 100;
     17  while (performance.now() < deadline) {}
     18 }