Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset="utf-8">
<title>Entry settings object for host functions</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/wasm/jsapi/wasm-module-builder.js"></script>
<script src="/wasm/jsapi/functions/helper.js"></script>
<!-- This is the entry page, so window.open() should resolve relative to it, even inside host functions. -->
<iframe src="resources/entry-incumbent.html"></iframe>
<script>
setup({ explicit_done: true });
const relativeURL = "resources/window-to-open.html";
const expectedURL = (new URL(relativeURL, location.href)).href;
const incumbentWindow = frames[0];
window.onload = () => {
async_test(t => {
const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL);
w.onload = t.step_func_done(() => {
t.add_cleanup(() => w.close());
assert_equals(w.location.href, expectedURL);
});
}, "Sanity check: this all works as expected synchronously");
async_test(t => {
// No t.step_func because that could change the realms
call_later(() => {
const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL);
w.onload = t.step_func_done(() => {
t.add_cleanup(() => w.close());
assert_equals(w.location.href, expectedURL);
});
});
}, "Start function");
done();
};
</script>