summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webcodecs/videoFrame-serialization.crossAgentCluster.serviceworker.js
blob: 218157c5e9a130a648495e5998a74d34bd996ade (plain)
1
2
3
4
5
6
7
8
9
10
11
let received = new Map();
self.onmessage = (e) => {
  if (e.data.hasOwnProperty('id')) {
    e.source.postMessage(
      received.get(e.data.id) ? 'RECEIVED' : 'NOT_RECEIVED');
    return;
  }
  if (e.data.toString() == '[object VideoFrame]') {
    received.set(e.data.timestamp, e.data);
  }
};