Auto merge of #20671 - cbrewster:history_url, r=asajeffrey

Make session history aware of URLs

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20671)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-04-30 13:33:23 -04:00 committed by GitHub
commit 847115ba04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 192 additions and 56 deletions

View file

@ -330900,6 +330900,12 @@
{}
]
],
"html/browsers/history/the-history-interface/history_pushstate_url.html": [
[
"/html/browsers/history/the-history-interface/history_pushstate_url.html",
{}
]
],
"html/browsers/history/the-history-interface/history_replacestate.html": [
[
"/html/browsers/history/the-history-interface/history_replacestate.html",
@ -561099,6 +561105,10 @@
"8add09b76d8662f4343188a1ac36fe71fd4a225d",
"testharness"
],
"html/browsers/history/the-history-interface/history_pushstate_url.html": [
"d5e1649c88102f27da5fe1ac16715cfee7f70f84",
"testharness"
],
"html/browsers/history/the-history-interface/history_replacestate.html": [
"91cf4970bfa565ee8b846582bdbe608d38902fe7",
"testharness"

View file

@ -1,7 +1,6 @@
[scroll-restoration-fragment-scrolling-samedoc.html]
type: testharness
expected: TIMEOUT
bug: https://github.com/servo/servo/issues/14970
[Manual scroll restoration should take precedent over scrolling to fragment in cross doc navigation]
expected: TIMEOUT
expected: FAIL

View file

@ -1,7 +1,6 @@
[scroll-restoration-navigation-samedoc.html]
type: testharness
expected: TIMEOUT
bug: https://github.com/servo/servo/issues/14970
[history.{push,replace}State retain scroll restoration mode and navigation in the same document respects it]
expected: TIMEOUT
expected: FAIL

View file

@ -0,0 +1,24 @@
<!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>