summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/get-nested-configs.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/fenced-frame/get-nested-configs.https.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/fenced-frame/get-nested-configs.https.html')
-rw-r--r--testing/web-platform/tests/fenced-frame/get-nested-configs.https.html125
1 files changed, 125 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/get-nested-configs.https.html b/testing/web-platform/tests/fenced-frame/get-nested-configs.https.html
new file mode 100644
index 0000000000..ed9f953e74
--- /dev/null
+++ b/testing/web-platform/tests/fenced-frame/get-nested-configs.https.html
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<title>window.fence.getNestedConfigs() test</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/utils.js"></script>
+<script src="/common/utils.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+
+<body>
+<script>
+promise_test(async (t) => {
+ const key = token();
+ const urn = await generateURNFromFledge(
+ "resources/get-nested-configs-inner.html", [key]);
+ attachFencedFrame(urn);
+
+ const response = await nextValueFromServer(key);
+ const [length, first_url] = response.split(",");
+
+ assert_equals(length, '20', 'There should be 20 nested configurations.');
+ assert_equals(first_url, 'opaque', 'The first config should be opaque.');
+}, 'getNestedConfigs() created by FLEDGE should return configurations');
+
+for (const resolve_to_config of [true, false]) {
+ promise_test(async (t) => {
+ const key = token();
+ const select_url_result = await runSelectURL(
+ generateURL("resources/get-nested-configs-inner.html", [key]),
+ [], resolve_to_config);
+ attachFencedFrame(select_url_result);
+
+ const response = await nextValueFromServer(key);
+ const [length, first_url] = response.split(",");
+
+ assert_equals(length, '0', 'There should be 0 nested configurations.');
+ }, 'getNestedConfigs() from a fenced frame with the ' +
+ (resolve_to_config ? 'config' : 'urn:uuid') +
+ ' from sharedStroage.selectURL() should be empty');
+}
+
+promise_test(async (t) => {
+ const key = token();
+ const url = generateURL("resources/get-nested-configs-inner.html", [key]);
+ attachFencedFrame(url, mode='default');
+
+ const response = await nextValueFromServer(key);
+ const [length, first_url] = response.split(",");
+
+ assert_equals(length, '0', 'There should be 0 nested configurations.');
+}, 'getNestedConfigs() from a default mode frame should be empty');
+
+promise_test(async (t) => {
+ const key = token();
+ const urn = await generateURNFromFledge(
+ "resources/get-nested-configs-nested-iframe.html", [key]);
+ attachFencedFrame(urn);
+
+ const response = await nextValueFromServer(key);
+ const [length, first_url] = response.split(",");
+
+ assert_equals(length, '20', 'There should be 20 nested configurations.');
+}, 'getNestedConfigs() should work in a same-origin nested iframe');
+
+promise_test(async (t) => {
+ const key = token();
+
+ const nested_url = generateURL("resources/embeddee.html", [key]);
+
+ // Navigate a fenced frame to `navigate-nested-config.html`. That page will
+ // in turn create a nested fenced frame which will be navigated to the URN of
+ // the first item in the nested configs list, `nested_url`.
+ const urn = await generateURNFromFledge(
+ "resources/navigate-nested-config.html", [key],
+ [nested_url]);
+ attachFencedFrame(urn);
+
+ const response = await nextValueFromServer(key);
+ assert_equals(response, 'PASS', 'The nested URL should load.');
+}, 'Nested configs created by FLEDGE should be navigable by fenced frame');
+
+promise_test(async (t) => {
+ const key = token();
+
+ const nested_url = generateURL("resources/embeddee.html", [key]);
+
+ // Navigate a fenced frame to `navigate-nested-config.html`. That page will
+ // in turn create a nested fenced frame which will be navigated to the URN of
+ // the first item in the nested configs list, `nested_url`.
+ const urn = await generateURNFromFledge(
+ "resources/navigate-nested-config.html", [key],
+ [nested_url]);
+ attachIFrame(urn);
+
+ const response = await nextValueFromServer(key);
+ assert_equals(response, 'PASS', 'The nested URL should load.');
+}, 'Nested configs created by FLEDGE should be navigable by URN iframe');
+
+promise_test(async (t) => {
+ const key = token();
+
+ const nested_url = generateURL("resources/embeddee.html", [key]);
+
+ // Navigate a fenced frame to `navigate-nested-config.html`. That page will
+ // in turn create a nested fenced frame which will be navigated to the URN of
+ // the first item in the nested configs list, `nested_url`. Since this URN
+ // is invalid, the navigation should gracefully fail.
+ const urn = await generateURNFromFledge(
+ "resources/navigate-nested-config.html", [key],
+ []);
+ attachFencedFrame(urn);
+
+ // There is no API to observe whether the document in the FencedFrame loaded
+ // or not. Instead, set up a timeout. If the document loads, "PASS" will be
+ // sent to the server. Otherwise "BLOCKED" will be sent after 1 second.
+ step_timeout(() => {
+ writeValueToServer(key, "BLOCKED");
+ }, 1000);
+
+ const response = await nextValueFromServer(key);
+ assert_equals(response, 'BLOCKED', 'The nested URL should not load.');
+}, 'Navigating an invalid config should be handled gracefully');
+
+</script>
+</body>
+</html>