Auto merge of #22841 - jdm:iframe-nav-test, r=nox

Add test for contentDocument behaviour during parsing

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22503
- [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/22841)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-02-11 12:56:19 -05:00 committed by GitHub
commit 9358b6a2fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -298855,6 +298855,11 @@
{}
]
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [
[
{}
]
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-opens-modals.html": [
[
{}
@ -634124,7 +634129,7 @@
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/content_document_changes_only_after_load_matures.html": [
"2cb85700230c038d020acd099008ef48cebf1a87",
"b657f26158a9c6526e3c734afb9ce2731e1b3dd4",
"testharness"
],
"html/semantics/embedded-content/the-iframe-element/cross_origin_child.html": [
@ -634451,6 +634456,10 @@
"18ecdcb795c33d6ab7bbb43f647947defca5634d",
"support"
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-checks-contentDocument.html": [
"bc35a977e8b27360f75a901d44fedf47ad496e37",
"support"
],
"html/semantics/embedded-content/the-iframe-element/support/iframe-that-opens-modals.html": [
"50f56c6278a77e5ff80e5036c7d600d0b1fa4b91",
"support"

View file

@ -8,13 +8,20 @@
async_test(function(t) {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.onload = t.step_func(function() {
assert_true(iframe.contentDocument.location.toString().includes("support/blank.htm"));
t.done();
var checkedDuringParse = false;
iframe.onload = t.step_func_done(function() {
testContentDocument();
assert_true(checkedDuringParse);
});
let url = "support/iframe-that-checks-contentDocument.html";
window.testContentDocument = t.step_func(function() {
assert_true(iframe.contentDocument.location.toString().includes(url));
checkedDuringParse = true;
});
assert_equals(iframe.contentDocument.location.toString(), "about:blank");
iframe.src = "support/blank.htm?pipe=trickle(d2)";
iframe.src = url + "?pipe=trickle(d2)";
// The location of the contentDocument should not change until the new document has matured.
assert_equals(iframe.contentDocument.location.toString(), "about:blank");
}, "contentDocument should only change after a load matures.");

View file

@ -0,0 +1,3 @@
<script>
parent.testContentDocument();
</script>