diff options
Diffstat (limited to 'testing/web-platform/tests/workers/support/WorkerSendingPerformanceNow.js')
-rw-r--r-- | testing/web-platform/tests/workers/support/WorkerSendingPerformanceNow.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/support/WorkerSendingPerformanceNow.js b/testing/web-platform/tests/workers/support/WorkerSendingPerformanceNow.js new file mode 100644 index 0000000000..ac12190efe --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerSendingPerformanceNow.js @@ -0,0 +1,22 @@ +function calcResponse() { + const response = [ + typeof(workerStart), + typeof(performance), + typeof(performance.now), + performance.now() + ]; + return response; +} + +self.onmessage = function(event) { + postMessage(calcResponse()); + self.close(); +} + +self.addEventListener("connect", function(event) { + const port = event.ports[0]; + port.onmessage = function(event) { + port.postMessage(calcResponse()); + port.close(); + }; +}); |