Revision e01a49c08af9328337c80b5d946d24b5274bc400 authored by Brad Werth on 26 April 2018, 08:13:36 UTC, committed by moz-wptsync-bot on 26 April 2018, 08:42:17 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1265342
gecko-commit: 3032f8adbcf177c75cb7ddacaade47e23e1ed88f
gecko-integration-branch: central
gecko-reviewers: dholbert
1 parent c09df8b
Raw File
WorkerPerformanceNow.html
<!DOCTYPE html>
<html>
<head>
<title>performance.now in dedicated workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function(t) {
  const worker = new Worker('support/WorkerSendingPerformanceNow.js');
  worker.onmessage = t.step_func_done(event => {
    const results = event.data;
    assert_true(results.length == 4);
    assert_equals(results[0], 'undefined',
      'workerStart not defined on the Worker object');
    assert_equals(results[1], 'object', "self.performance is defined");
    assert_equals(results[2], 'function', "self.performance.now is defined");
    assert_greater_than(results[3], 0, "Time in the worker should be positive");
    assert_greater_than(window.performance.now(), results[3], "Time in the worker should be before the current time in the main document");
  });
  worker.postMessage('');
}, 'performance.now() exists in dedicated workers and reports reasonable times');
</script>
</body>
</html>
back to top