diff options
Diffstat (limited to 'testing/web-platform/tests/wasm/jsapi/functions/entry.html')
-rw-r--r-- | testing/web-platform/tests/wasm/jsapi/functions/entry.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/wasm/jsapi/functions/entry.html b/testing/web-platform/tests/wasm/jsapi/functions/entry.html new file mode 100644 index 0000000000..1501807449 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/entry.html @@ -0,0 +1,43 @@ +<!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> |