test_XHRResponseURL.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=998076
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 998076</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. <script type="application/javascript" src="file_XHRResponseURL.js"></script>
  12. <script type="application/javascript">
  13. /** Test for Bug 998076 **/
  14. "use strict";
  15. window.addEventListener("message", function (aEvent) {
  16. var data = aEvent.data;
  17. if (data === "done") {
  18. SimpleTest.finish();
  19. return;
  20. }
  21. if (data === "start") {
  22. return;
  23. }
  24. if (data.type === "is") {
  25. SimpleTest.is(data.actual, data.expected, data.message);
  26. window.postMessage("pong", "*");
  27. return;
  28. }
  29. if (data.type === "ok") {
  30. SimpleTest.ok(data.bool, data.message);
  31. window.postMessage("pong", "*");
  32. return;
  33. }
  34. if (data.type === "info") {
  35. SimpleTest.info(data.message);
  36. window.postMessage("pong", "*");
  37. return;
  38. }
  39. if (data.type === "todo") {
  40. SimpleTest.todo(data.bool, data.message);
  41. window.postMessage("pong", "*");
  42. return;
  43. }
  44. if (data.type === "todo_is") {
  45. SimpleTest.todo_is(data.actual, data.expected, data.message);
  46. window.postMessage("pong", "*");
  47. return;
  48. }
  49. });
  50. function runTests() {
  51. SimpleTest.waitForExplicitFinish();
  52. window.postMessage("start", "*");
  53. }
  54. </script>
  55. </head>
  56. <body onload="runTests()">
  57. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=998076">Mozilla Bug 998076</a>
  58. <p id="display"></p>
  59. <div id="content" style="display: none">
  60. </div>
  61. <pre id="test">
  62. </pre>
  63. </body>
  64. </html>