test_eventDispatch.html 834 B

12345678910111213141516171819202122232425262728293031323334
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <!DOCTYPE HTML>
  6. <html>
  7. <head>
  8. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js">
  9. </script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <script type="text/javascript">
  14. const message = "Hi";
  15. var messageCount = 0;
  16. var worker = new Worker("eventDispatch_worker.js");
  17. worker.onmessage = function(event) {
  18. is(event.data, message, "Got correct data.");
  19. if (!messageCount++) {
  20. event.target.postMessage(event.data);
  21. return;
  22. }
  23. SimpleTest.finish();
  24. }
  25. worker.postMessage(message);
  26. SimpleTest.waitForExplicitFinish();
  27. </script>
  28. </body>
  29. </html>