Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /workers/worker-request-animation-frame.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>raf time in dedicated workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async function waitForMessage(worker) {
return new Promise(resolve => {
worker.onmessage = event => resolve(event);
});
}
promise_test(t => {
const worker = new Worker('support/worker-request-animation-frame.js');
const message = waitForMessage(worker);
worker.postMessage('');
message.then((event) => {
const raf_time = event.data;
assert_true(performance.now() >= raf_time,
'raf time cannot exceed time of page load');
});
return message;
}, 'requestAnimationTime reports frame time relative to worker load');
</script>