summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-sizing.window.js
blob: cc53ba5f2f59414e097fa1cd29a877db7f8d0b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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`);
});