1
0
Fork 0
firefox/testing/web-platform/tests/wasm/jsapi/functions/entry.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

43 lines
1.3 KiB
HTML

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