summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js
blob: a75a0346501a80ceef91d25ed250a2957f42cfb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];

test(() => {
  for(const prop of barProps) {
    assert_true(window[prop].visible);
  }
}, "All bars visible");

["noopener", "noreferrer"].forEach(openerStyle => {
  async_test(t => {
    const channelName = "5454" + openerStyle + "34324";
    const channel = new BroadcastChannel(channelName);
    window.open("support/BarProp-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 barProps) {
        assert_true(e.data[prop]);
      }
    });
  }, `window.open() with ${openerStyle} should have all bars visible`);
});