From f71108680b30848e48e0a1f7a6cef7fa37ec46b1 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 22 Dec 2019 23:48:40 +0100 Subject: 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. --- .../htmlparser/tests/mochitest/test_bug715739.html | 34 ++++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'parser/htmlparser/tests/mochitest') diff --git a/parser/htmlparser/tests/mochitest/test_bug715739.html b/parser/htmlparser/tests/mochitest/test_bug715739.html index 597160a19..e59fdf332 100644 --- a/parser/htmlparser/tests/mochitest/test_bug715739.html +++ b/parser/htmlparser/tests/mochitest/test_bug715739.html @@ -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); + + -- cgit v1.2.3