Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / the-iframe-element / content_document_changes_only_after_load_matures.html
1 <!doctype html>
2 <meta charset="utf-8">
3 <title>Iframe's contentDocument should only change after its pending load has matured.</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <body></body>
7 <script>
8 async_test(function(t) {
9     var iframe = document.createElement("iframe");
10     document.body.appendChild(iframe);
11     var checkedDuringParse = false;
12     iframe.onload = t.step_func_done(function() {
13         testContentDocument();
14         assert_true(checkedDuringParse);
15     });
16
17     let url = "support/iframe-that-checks-contentDocument.html";
18     window.testContentDocument = t.step_func(function() {
19         assert_true(iframe.contentDocument.location.toString().includes(url));
20         checkedDuringParse = true;
21     });
22
23     assert_equals(iframe.contentDocument.location.toString(), "about:blank");
24     iframe.src = url + "?pipe=trickle(d2)";
25     // The location of the contentDocument should not change until the new document has matured.
26     assert_equals(iframe.contentDocument.location.toString(), "about:blank");
27 }, "contentDocument should only change after a load matures.");
28 </script>