From 3b06a0c310b9a010ecf1ef80abc5913d240f65aa Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 3 May 2018 10:13:20 +0200 Subject: [PATCH] HTML: document.open() and global variables For https://github.com/whatwg/html/pull/3651. --- .../resources/variables-frame.html | 4 ++++ .../opening-the-input-stream/variables.window.js | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/variables-frame.html create mode 100644 html/dom/dynamic-markup-insertion/opening-the-input-stream/variables.window.js diff --git a/html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/variables-frame.html b/html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/variables-frame.html new file mode 100644 index 00000000000000..0fe189914c3727 --- /dev/null +++ b/html/dom/dynamic-markup-insertion/opening-the-input-stream/resources/variables-frame.html @@ -0,0 +1,4 @@ + + diff --git a/html/dom/dynamic-markup-insertion/opening-the-input-stream/variables.window.js b/html/dom/dynamic-markup-insertion/opening-the-input-stream/variables.window.js new file mode 100644 index 00000000000000..2722dfebf325e0 --- /dev/null +++ b/html/dom/dynamic-markup-insertion/opening-the-input-stream/variables.window.js @@ -0,0 +1,11 @@ +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + frame.src = "resources/variables-frame.html"; + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.hey, "You", "precondition"); + frame.contentDocument.open(); + assert_equals(frame.contentWindow.hey, "You", "actual check"); + // Ensure a load event gets dispatched to unblock testharness + frame.contentDocument.close(); + }); +}, "Obtaining a variable from a global whose document had open() invoked");