diff options
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html')
-rw-r--r-- | testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html new file mode 100644 index 0000000000..57dd5dff10 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html @@ -0,0 +1,27 @@ +<!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.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 = (promise, promiseMethod, ...args) => { + const runWindowPostMessage = current.contentWindow.postMessage.bind(relevant.contentWindow, ...args); + promise[promiseMethod](runWindowPostMessage); + }; + + window.resolveThenableThatRunsWindowPostMessageVeryIndirectlyWithNoUserCode = (...args) => { + Promise.resolve({ + then: current.contentWindow.postMessage.bind(relevant.contentWindow, ...args) + }); + }; +</script> |