| <script> |
| |
| if (!sessionStorage.in_document_with_fragment_url_4) |
| sessionStorage.in_document_with_fragment_url_4 = true; |
| else |
| delete sessionStorage.in_document_with_fragment_url_4; |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function documentURLHash() |
| { |
| var index = document.URL.lastIndexOf("#"); |
| if (index == -1) |
| return ""; |
| return document.URL.substring(index); |
| } |
| |
| function hashChanged() |
| { |
| alert("Hash changed to " + documentURLHash() + " which is interesting because we shouldn't get a hashchange event in this test."); |
| } |
| |
| function loaded() |
| { |
| if (sessionStorage.in_document_with_fragment_url_4) { |
| alert("First load complete. URL's current hash is " + documentURLHash()); |
| history.replaceState(null, null, "#foo"); |
| alert("After replaceState, the URL's current hash is " + documentURLHash()); |
| var rect = document.getElementById("clickanchor").getBoundingClientRect(); |
| eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } else { |
| alert("Second load complete. URL's current hash is " + documentURLHash()); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| } |
| |
| </script> |
| <body onhashchange="hashChanged();" onload="loaded();"> |
| This page uses history.replaceState() to add #foo to its URL. Then click the second link, which has an empty href and should take you back to the original URL without the #foo.<br> |
| <a id="clickanchor" href="">Click here to return to the original page with the original url</a> |
| </body> |