Auto merge of #22999 - jdm:iframe-replace, r=asajeffrey,cbrewster

Fix replacement logic when navigating nested browsing contexts

These changes also fix a bug where traversing the session history in a nested browsing context did not update the iframe's contentWindow appropriately.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22996
- [x] There are tests for these changes

<!-- 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/22999)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-03-07 21:20:14 -05:00 committed by GitHub
commit ac3c002138
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 128 additions and 8 deletions

View file

@ -10459,6 +10459,11 @@
{}
]
],
"mozilla/resources/first.html": [
[
{}
]
],
"mozilla/resources/http-cache.js": [
[
{}
@ -10499,6 +10504,11 @@
{}
]
],
"mozilla/resources/second.html": [
[
{}
]
],
"mozilla/resources/ssl.https.html": [
[
{}
@ -12659,6 +12669,12 @@
{}
]
],
"mozilla/history.html": [
[
"/_mozilla/mozilla/history.html",
{}
]
],
"mozilla/hit-test-background.html": [
[
"/_mozilla/mozilla/hit-test-background.html",
@ -19424,6 +19440,10 @@
"9baa0cdcd5abad00b321e8b9351a1bc162783ed5",
"support"
],
"mozilla/history.html": [
"130307f1e9c8bc4c5ee6fff4d5fef8fda89a1564",
"testharness"
],
"mozilla/hit-test-background.html": [
"5212954e4ee6ecb684212e7373e24a2268434b1c",
"testharness"
@ -19796,6 +19816,10 @@
"5f0242874cfa47b84af35325ad651690cd9fb790",
"support"
],
"mozilla/resources/first.html": [
"b4359ad2855339999cfeda0c2681a51da6fdd940",
"support"
],
"mozilla/resources/http-cache.js": [
"34aaacf536f31e4d9ae003cb0891ede965201f08",
"support"
@ -19828,6 +19852,10 @@
"b0883f382e1a80609b7b2c7904e701fbe6760b14",
"support"
],
"mozilla/resources/second.html": [
"c4fbe534ed193e1d192c0338997a8d9da8eb6406",
"support"
],
"mozilla/resources/ssl.https.html": [
"8faa57c0c47c4fdf27c052d059b28ee1088235e9",
"support"

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset="utf-8">
<title>Traversing history causes iframe contentWindow to update</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="resources/first.html"></iframe>
<script>
var iframe = document.querySelector('iframe');
var t = async_test();
onload = t.step_func(function() {
iframe.onload = t.step_func(function() {
assert_true(iframe.contentWindow.location.href.endsWith('second.html'));
iframe.contentWindow.history.back();
t.step_timeout(function() {
assert_true(iframe.contentWindow.location.href.endsWith('first.html'));
iframe.contentWindow.history.forward();
t.step_timeout(function() {
assert_true(iframe.contentWindow.location.href.endsWith('second.html'));
t.done();
}, 1000);
}, 1000);
});
iframe.src = "resources/second.html";
});
</script>

View file

@ -0,0 +1 @@
<body>hello world</body>

View file

@ -0,0 +1 @@
<body>goodbye world</body>