From ec1d6a114188765744910ed4dfc63fc1fa4ca2c6 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 3 May 2019 11:28:32 +0200 Subject: [PATCH] HTML: compare window sizing for noopener/noreferrer For https://github.com/whatwg/html/pull/3297. --- .../noopener-noreferrer-sizing.window.js | 17 +++++++++++++++++ .../support/sizing-target.html | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 html/browsers/the-window-object/noopener-noreferrer-sizing.window.js create mode 100644 html/browsers/the-window-object/support/sizing-target.html diff --git a/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js b/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js new file mode 100644 index 00000000000000..cc53ba5f2f5941 --- /dev/null +++ b/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js @@ -0,0 +1,17 @@ +const windowProps = ["innerWidth", "innerHeight"]; + +["noopener", "noreferrer"].forEach(openerStyle => { + async_test(t => { + const channelName = "34342" + openerStyle + "8907"; + const channel = new BroadcastChannel(channelName); + window.open("support/sizing-target.html?" + channelName, "", openerStyle); + channel.onmessage = t.step_func_done(e => { + // Send message first so if asserts throw the popup is still closed + channel.postMessage(null); + + for(const prop of windowProps) { + assert_equals(window[prop], e.data[prop]); + } + }); + }, `window.open() with ${openerStyle} should have equal viewport width and height`); +}); diff --git a/html/browsers/the-window-object/support/sizing-target.html b/html/browsers/the-window-object/support/sizing-target.html new file mode 100644 index 00000000000000..7cd5348a858569 --- /dev/null +++ b/html/browsers/the-window-object/support/sizing-target.html @@ -0,0 +1,17 @@ + +