<!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>