https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 8409a38ef8d57d6fdad447adef206f17d1ecf9fb authored by James Graham on 14 August 2018, 18:17:53 UTC
WIP
Tip revision: 8409a38
window-open.tentative.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
  //helper functions for the tests
  function testWindowOpen(t, url, win) {
    let child_window = win.open(url, "", "");
    child_window.onload = t.step_func_done(_ => {
      assert_equals(child_window.location.href, "" + url);
      child_window.close();
    });
  }

  async_test(t => {
    testWindowOpen(t, TrustedURL.create(URLS.safe), window);
  }, "window.open: safe URL, safe construction.");

  async_test(t => {
    testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), window);
  }, "window.open: safe URL, unsafe construction.");

  async_test(t => {
    testWindowOpen(t, TrustedURL.create(URLS.safe), document);
  }, "document.open: safe URL, safe construction.");

  async_test(t => {
    testWindowOpen(t, TrustedURL.unsafelyCreate(URLS.safe), document);
  }, "document.open: safe URL, unsafe construction.");
</script>
back to top