diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/fenced-frame/frame-navigation.https.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | testing/web-platform/tests/fenced-frame/frame-navigation.https.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/frame-navigation.https.html b/testing/web-platform/tests/fenced-frame/frame-navigation.https.html new file mode 100644 index 0000000000..f3464c94e9 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/frame-navigation.https.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<title>Test fenced frame navigations (by a parent frame setting its src). </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/utils.js"></script> + +<body> + +<script> +promise_test(async () => { + // This test checks that fenced frames can be navigated (given a new src). + // The access pattern is as follows, to exercise same- and cross-origin + // navigations in root and nested fenced frames. + + // [root] [nested] + // simple (origin 1) + // create-nested (origin 2) + // simple (origin 1) + // simple (origin 2) + // simple (origin 2) + // simple (origin 2) + + const navigation_key = token(); + const navigation_ack_key = token(); + + // Create URL prefixes to simulate different origins. + // (www1 and www2 are different origins) + const simple_url = generateURL( + "resources/frame-navigation-inner-simple.https.html", + [navigation_key, navigation_ack_key]); + const nested_url = generateURL( + "resources/frame-navigation-inner-create-nested.https.html", + [navigation_key, navigation_ack_key]); + const origin1_simple_url = getRemoteOriginURL(simple_url); + const origin2_nested_url = getRemoteOriginURL(nested_url) + .toString().replace("www1", "www2"); + const origin2_simple_url = getRemoteOriginURL(simple_url) + .toString().replace("www1", "www2"); + + // Create a root fenced frame. + root_frame = attachFencedFrame(origin1_simple_url); + const root_load1_actual = await nextValueFromServer(navigation_key); + const root_load1_expected = "pass"; + assert_equals(root_load1_actual, root_load1_expected, + "The 1st root fenced frame navigation succeeded"); + + // Navigate the root fenced frame to a second site (which will nest). + root_frame.config = new FencedFrameConfig(origin2_nested_url); + const root_load2_actual = await nextValueFromServer(navigation_key); + const root_load2_expected = "create-nested"; + assert_equals(root_load2_actual, root_load2_expected, + "The 2nd root fenced frame navigation (cross-origin) succeeded"); + writeValueToServer(navigation_ack_key, "ACK"); + + // Check that all of the nested navigations succeed. + const nested_load1_actual = await nextValueFromServer(navigation_key); + const nested_load1_expected = "pass"; + assert_equals(nested_load1_actual, nested_load1_expected, + "The 1st nested fenced frame navigation succeeded"); + writeValueToServer(navigation_ack_key, "ACK"); + + const nested_load2_actual = await nextValueFromServer(navigation_key); + const nested_load2_expected = "pass"; + assert_equals(nested_load2_actual, nested_load2_expected, + "The 2nd nested fenced frame navigation (cross-origin) succeeded"); + writeValueToServer(navigation_ack_key, "ACK"); + + const nested_load3_actual = await nextValueFromServer(navigation_key); + const nested_load3_expected = "pass"; + assert_equals(nested_load3_actual, nested_load3_expected, + "The 3rd nested fenced frame navigation (same-origin) succeeded"); + writeValueToServer(navigation_ack_key, "ACK"); + + // Navigate the root fenced frame. + root_frame.config = root_frame.config = new FencedFrameConfig(origin2_simple_url); + const root_load3_actual = await nextValueFromServer(navigation_key); + const root_load3_expected = "pass"; + assert_equals(root_load3_actual, root_load3_expected, + "The 3rd root fenced frame navigation (same-origin) succeeded"); + +}, "Fenced frame navigation should succeed"); +</script> + +</body> |