test_pushState_after_document_open.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=957479
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 957479</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">
  12. /** Test for Bug 957479 **/
  13. SimpleTest.waitForExplicitFinish();
  14. // Child needs to invoke us, otherwise our onload will fire before the child
  15. // has done the write/close bit.
  16. onmessage = function doTest() {
  17. is(frames[0].location.pathname, "/tests/docshell/test/file_pushState_after_document_open.html", "Should have the right path here");
  18. is(frames[0].location.hash, "", "Should have the right hash here");
  19. frames[0].history.pushState({}, '', frames[0].document.URL + "#foopy");
  20. is(frames[0].location.pathname, "/tests/docshell/test/file_pushState_after_document_open.html", "Pathname should not have changed");
  21. is(frames[0].location.hash, "#foopy", "Hash should have changed");
  22. SimpleTest.finish();
  23. }
  24. </script>
  25. </head>
  26. <body>
  27. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=957479">Mozilla Bug 957479</a>
  28. <p id="display"></p>
  29. <div id="content" style="display: none">
  30. <iframe src="file_pushState_after_document_open.html"></iframe>
  31. </div>
  32. <pre id="test">
  33. </pre>
  34. </body>
  35. </html>