fune/testing/web-platform/tests/webcodecs/encodedVideoChunk-serialization.crossAgentCluster.helper.html
Chun-Min Chang 35f580ba0f Bug 1838984 - Add more EncodedVideoChunk serialization WPTs r=smaug
This patch adds tests checking if EncodedVideoChunk can be passed within
the same origins or across the origins, can be passed from window to
worker, and also check some cases that serialization is not allowed.

Differential Revision: https://phabricator.services.mozilla.com/D183035
2023-07-21 00:44:55 +00:00

23 lines
625 B
HTML

<!DOCTYPE html>
<html>
<body>
<p id='location'></p>
<div id='log'></div>
<script>
document.querySelector('#location').innerHTML = window.origin;
let received = new Map();
window.onmessage = (e) => {
let msg = e.data + ' (from ' + e.origin + ')';
document.querySelector('#log').innerHTML += '<p>' + msg + '<p>';
if (e.data.hasOwnProperty('id')) {
e.source.postMessage(
received.get(e.data.id) ? 'RECEIVED' : 'NOT_RECEIVED', '*');
return;
}
if (e.data.toString() == '[object EncodedVideoChunk]') {
received.set(e.data.timestamp, e.data);
}
};
</script>
</body>
</html>