Issue #1118 - Part 6: Fix various tests that are no longer correct.

The behavior change of document.open() requires these tests to be
changed to account for the new spec behavior.
This commit is contained in:
wolfbeast 2019-12-22 23:48:40 +01:00 committed by Roy Tam
commit b753aec164
17 changed files with 71 additions and 205 deletions

View file

@ -33,24 +33,30 @@ function textChildren(node) {
return s;
}
var f, d;
function tick() {
runNumber++;
var f = document.getElementsByTagName("iframe")[0];
var d = f.contentDocument;
f = document.getElementsByTagName("iframe")[0];
d = f.contentDocument;
if (runNumber == 1) {
d.open();
f.addEventListener("load", tick);
d.write("X");
d.write("\u003cscript>document.write('Y');\u003c/script>");
d.write("Z");
d.close();
frames[1].setTimeout(`
var d = parent.d;
var f = parent.f;
d.open();
f.addEventListener("load", parent.tick);
d.write("X");
d.write("\u003cscript>document.write('Y');\u003c/script>");
d.write("Z");
d.close();
`);
return;
}
if (runNumber == 2) {
var text = textChildren(d.body);
is(text, "XYZ", "Wrong text before reload.");
is(text, "ABC", "Wrong text before reload.");
f.contentWindow.location.reload();
return;
}
@ -63,10 +69,20 @@ function tick() {
}
}
// We want to trigger a document.open/write with a different window as the
// entry global. Let's give that window a blob URL so we don't have to set up
// extra helper files.
var blob = new Blob(["ABC"], { type: "text/html" });
var blobURL = URL.createObjectURL(blob);
</script>
</pre>
<div id="content" style="display: none">
<iframe></iframe>
<iframe></iframe>
</div>
<script>
document.querySelectorAll("iframe")[1].src = blobURL;
</script>
</body>
</html>