diff options
Diffstat (limited to 'testing/web-platform/tests/fenced-frame/input-on-coop-fenced-frame.https.html')
-rw-r--r-- | testing/web-platform/tests/fenced-frame/input-on-coop-fenced-frame.https.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/input-on-coop-fenced-frame.https.html b/testing/web-platform/tests/fenced-frame/input-on-coop-fenced-frame.https.html new file mode 100644 index 0000000000..e7b44a0784 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/input-on-coop-fenced-frame.https.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<title>Test input inside a fenced frame with non-matching COOP.</title> +<link rel="help" href="https://crbug.com/1316535"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="resources/utils.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<body> +<script> + +// Navigating a fenced frame to a page with a COOP mismatch (in this case, +// unsafe-none -> same-origin-allow-popups) will force the page into a new +// browsing context group. +// +// In Chromium, this forces using a "speculative" frame host which initializes +// the new frame using a different path than normal. +// +// This test is a basic smoke test that sending input through this setup works +// and doesn't cause any crashes. See linked bug for more details. +// +// TODO(https://crbug.com/1411599): COOP is no longer taken into account inside +// fenced frames. To test the "speculative" frame host route, we might only need +// to do a cross-site navigation. Once figured out, use the new approach to test +// that route. +promise_test(async () => { + const frame = attachFencedFrameContext({ + headers: [["Cross-Origin-Opener-Policy", "same-origin-allow-popups"]] + }); + + await frame.execute(async () => { + if (document.readyState !== 'complete') { + await new Promise((resolve) => { addEventListener('load', resolve); }); + } + + assert_equals(document.readyState, 'complete', 'Fenced frame was loaded'); + + window.was_clicked = false; + addEventListener('click', () => { + window.was_clicked = true; + }); + }); + + await test_driver.click(frame.element); + + // Ensure the fenced frame actually saw the click but the real test is that + // there isn't a crash. + await frame.execute(async () => { + assert_equals(window.was_clicked, true, 'Fenced frame received click'); + }); + +}, 'Input in non-matching COOP fenced frame doesn\'t crash.'); +</script> +</body> |