mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
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:
commit
9358b6a2fb
3 changed files with 24 additions and 5 deletions
|
@ -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.");
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<script>
|
||||
parent.testContentDocument();
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue