diff options
Diffstat (limited to 'testing/web-platform/tests/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html')
-rw-r--r-- | testing/web-platform/tests/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html b/testing/web-platform/tests/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html new file mode 100644 index 0000000000..11daf738d6 --- /dev/null +++ b/testing/web-platform/tests/html/capability-delegation/resources/delegate-fullscreen-request-recipient.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<title>Capability Delegation of Fullscreen Requests test recipient</title> +<body>Capability Delegation of Fullscreen Requests test recipient body</body> + +<script> + const initiator = window.opener ? window.opener : window.top; + initiator.postMessage({"type": "recipient-loaded"}, "*"); + + function reportResult(msg) { + initiator.postMessage({"type": "result", "result": msg}, "*"); + } + + document.addEventListener('fullscreenchange', async () => { + if (document.fullscreenElement) { + await document.exitFullscreen(); + reportResult("success"); + } + }); + + document.addEventListener('fullscreenerror', () => { + reportResult("failure"); + }); + + window.addEventListener("message", e => { + if (e.data.type == "make-fullscreen-request") { + document.body.requestFullscreen(); + } + }); +</script> |