https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 10c4433f448fa5a85cdbdcd8c5dc2765951297ae authored by Javier Fernandez on 22 December 2018, 22:34:40 UTC
[css-text] New value 'break-spaces' for the white-space property
Tip revision: 10c4433
portals-no-referrer.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
// TODO(jbroman): Remove use of BroadcastChannel for messaging once it is
// possible to postMessage to a portal the normal way.
promise_test(async () => {
  assert_true('HTMLPortalElement' in self, 'HTMLPortalElement is required for this test');
  let portal = document.createElement('portal');
  let channelName = 'portals-no-referrer';
  let broadcastChannel = new BroadcastChannel(channelName);
  try {
    let referrerPromise = new Promise((resolve, reject) => {
      broadcastChannel.addEventListener('message', e => {
        resolve(e.data);
      }, {once: true});
    });
    portal.src = `resources/postmessage-referrer.sub.html?broadcastchannel=${channelName}`;
    document.body.appendChild(portal);
    try {
      let {httpReferrer, documentReferrer} = await referrerPromise;
      assert_equals(httpReferrer, 'no-http-referrer', 'No HTTP Referer header should be sent');
      assert_equals(documentReferrer, 'no-document-referrer', 'No document.referrer should be present');
    } finally {
      document.body.removeChild(portal);
    }
  } finally {
    broadcastChannel.close();
  }
}, "portal contents should be loaded with no referrer");
</script>
</body>
back to top