diff options
Diffstat (limited to 'testing/web-platform/tests/wasm/jsapi/functions/resources')
11 files changed, 80 insertions, 0 deletions
diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/README.md b/testing/web-platform/tests/wasm/jsapi/functions/resources/README.md new file mode 100644 index 0000000000..a89258a4e0 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/README.md @@ -0,0 +1,5 @@ +A couple notes about the files scattered in this `resources/` directory: + +* The nested directory structure is necessary here so that relative URL resolution can be tested; we need different sub-paths for each document. + +* The semi-duplicate `window-to-open.html`s scattered throughout are present because Firefox, at least, does not fire `Window` `load` events for 404s, so we want to ensure that no matter which global is used, `window`'s `load` event is hit and our tests can proceed. diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/current/current.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/current/current.html new file mode 100644 index 0000000000..63d9c437fc --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/current/current.html @@ -0,0 +1,4 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Current page used as a test helper</title> + diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/current/resources/window-to-open.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/current/resources/window-to-open.html new file mode 100644 index 0000000000..1bc4cca9a3 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/current/resources/window-to-open.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>If the current settings object is used this page will be opened</title> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/entry-incumbent.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/entry-incumbent.html new file mode 100644 index 0000000000..6b210563e9 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/entry-incumbent.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Incumbent page used as a test helper</title> + +<iframe src="relevant/relevant.html" id="r"></iframe> +<iframe src="current/current.html" id="c"></iframe> + +<script> +const relevant = document.querySelector("#r"); +const current = document.querySelector("#c"); + +window.runWindowOpenVeryIndirectly = (...args) => { + return current.contentWindow.open.call(relevant.contentWindow, ...args); +}; +</script> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/function/function.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/function/function.html new file mode 100644 index 0000000000..979b902eaa --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/function/function.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Realm for a host function used as a test helper</title> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/function/resources/window-to-open.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/function/resources/window-to-open.html new file mode 100644 index 0000000000..3928c1f8aa --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/function/resources/window-to-open.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>If the function's settings object is used this page will be opened</title> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/incumbent-incumbent.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/incumbent-incumbent.html new file mode 100644 index 0000000000..5e84f65a08 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/incumbent-incumbent.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Incumbent page used as a test helper</title> + +<script src="/wasm/jsapi/wasm-module-builder.js"></script> +<script src="/wasm/jsapi/functions/helper.js"></script> + +<iframe src="relevant/relevant.html" id="r"></iframe> +<iframe src="current/current.html" id="c"></iframe> + +<script> +const relevant = document.querySelector("#r"); +const current = document.querySelector("#c"); + +window.runWindowPostMessageVeryIndirectly = (...args) => { + return current.contentWindow.postMessage.call(relevant.contentWindow, ...args); +}; + +// This tests the backup incumbent settings object stack scenario, by avoiding putting user code on the stack. +window.runWindowPostMessageVeryIndirectlyWithNoUserCode = (...args) => { + const runWindowPostMessage = current.contentWindow.postMessage.bind(relevant.contentWindow, ...args); + call_later(runWindowPostMessage); +}; +</script> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/relevant.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/relevant.html new file mode 100644 index 0000000000..06df91c237 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/relevant.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Relevant page used as a test helper</title> + +<script> +// incumbent.html will end up posting a message to here. We need to signal back the "source". + +window.onmessage = e => { + const testId = e.data; + const sourceURL = e.source.document.URL; + + window.dispatchEvent(new CustomEvent("messagereceived", { detail: [testId, sourceURL] })); +}; +</script> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/resources/window-to-open.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/resources/window-to-open.html new file mode 100644 index 0000000000..4138b5a084 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/relevant/resources/window-to-open.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>If the relevant settings object is used this page will be opened</title> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/resources/window-to-open.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/resources/window-to-open.html new file mode 100644 index 0000000000..7743b9b578 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/resources/window-to-open.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>If the incumbent settings object is used this page will be opened</title> diff --git a/testing/web-platform/tests/wasm/jsapi/functions/resources/window-to-open.html b/testing/web-platform/tests/wasm/jsapi/functions/resources/window-to-open.html new file mode 100644 index 0000000000..ce357937f5 --- /dev/null +++ b/testing/web-platform/tests/wasm/jsapi/functions/resources/window-to-open.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>If the entry settings object is used this page will be opened</title> |