| <!doctype html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>History pushState sets the url</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <div id="log"></div> |
| <script> |
| async_test(function(t) { |
| var oldLocation = window.location.toString(); |
| window.history.pushState(null, "", "#hash"); |
| assert_equals(oldLocation + "#hash", window.location.toString(), "pushState updates url"); |
| history.back(); |
| window.onhashchange = () => { |
| assert_equals(oldLocation, window.location.toString(), 'history traversal restores old url'); |
| t.done(); |
| }; |
| }, "history pushState sets url"); |
| </script> |
| </body> |
| </html> |