test_chromeWorker.xul 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0"?>
  2. <!--
  3. Any copyright is dedicated to the Public Domain.
  4. http://creativecommons.org/publicdomain/zero/1.0/
  5. -->
  6. <window title="DOM Worker Threads Test"
  7. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  8. onload="test();">
  9. <script type="application/javascript"
  10. src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  11. <script type="application/javascript"
  12. src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
  13. <script type="application/javascript" src="dom_worker_helper.js"/>
  14. <script type="application/javascript">
  15. <![CDATA[
  16. function test()
  17. {
  18. waitForWorkerFinish();
  19. var worker = new ChromeWorker("chromeWorker_worker.js");
  20. worker.onmessage = function(event) {
  21. is(event.data, "Done!", "Wrong message!");
  22. finish();
  23. }
  24. worker.onerror = function(event) {
  25. ok(false, "Worker had an error: " + event.message);
  26. worker.terminate();
  27. finish();
  28. }
  29. worker.postMessage("go");
  30. }
  31. ]]>
  32. </script>
  33. <body xmlns="http://www.w3.org/1999/xhtml">
  34. <p id="display"></p>
  35. <div id="content" style="display:none;"></div>
  36. <pre id="test"></pre>
  37. </body>
  38. <label id="test-result"/>
  39. </window>