diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html')
-rw-r--r-- | testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html b/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html new file mode 100644 index 0000000000..2a16f45496 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- + Tentative due to: + https://github.com/whatwg/html/issues/1983 +--> +<html> +<head> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +</head> +<body> + <h1>Clicking in iframe has activation state in child via MessageEvent</h1> + <ol id="instructions"> + <li>Click inside the red area. + </ol> + <iframe id="child" width="200" height="200"> + </iframe> + <script> + async_test(function(t) { + var child = document.getElementById("child"); + child.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/user-activation/resources/child-message-event-api.html"; + assert_false(navigator.userActivation.isActive); + assert_false(navigator.userActivation.hasBeenActive); + window.addEventListener("message", t.step_func(event => { + if (event.data == 'child-loaded') { + // values have false after load + assert_true(event.userActivation != null); + assert_false(event.userActivation.isActive); + assert_false(event.userActivation.hasBeenActive); + test_driver.click(child); + } else if (event.data == 'child-clicked') { + // values have activation state on click + assert_true(navigator.userActivation.hasBeenActive); + assert_true(event.userActivation != null); + assert_true(event.userActivation.isActive); + assert_true(event.userActivation.hasBeenActive); + child.contentWindow.postMessage('report', "*"); + } else if (event.data == 'child-report') { + assert_false(navigator.userActivation.isActive); + assert_true(navigator.userActivation.hasBeenActive); + assert_true(event.userActivation != null); + assert_false(event.userActivation.isActive); + assert_true(event.userActivation.hasBeenActive); + child.contentWindow.postMessage('report-no-activation', "*"); + } else if (event.data == 'child-report-no-activation') { + assert_equals(event.userActivation, null); + t.done(); + } + })); + }, "Message propagates values on post"); + </script> +</body> +</html> |