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/content-security-policy/navigate-to/support | |
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/content-security-policy/navigate-to/support')
19 files changed, 211 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/delayed_frame.py b/testing/web-platform/tests/content-security-policy/navigate-to/support/delayed_frame.py new file mode 100644 index 0000000000..06bcb9b680 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/delayed_frame.py @@ -0,0 +1,12 @@ +import time +def main(request, response): + time.sleep(1) + headers = [(b"Content-Type", b"text/html")] + return headers, u''' +<!DOCTYPE html> +<head> +</head> +<body> + DELAYED FRAME +</body +''' diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html new file mode 100644 index 0000000000..a4121944ea --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + </script> +</head> + +<body> +<form action='{{GET[action]}}' target='_self' id='form'> + <input type="text" name="dummy"> + <div id="form-div"></div> +</form> + +<script> + try { + url = new URL("{{GET[action]}}", location.href); + for (var p of url.searchParams) { + var elem = document.createElement('input'); + elem.type = 'text'; + elem.name = p[0]; + elem.value = p[1]; + document.getElementById('form-div').appendChild(elem); + } + } catch(ex) {} + + document.getElementById('form').submit(); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html.sub.headers new file mode 100644 index 0000000000..a42cfe2d95 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/form_action_navigation.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}}; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html new file mode 100644 index 0000000000..15b1365cc2 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> + +<body> +<script> + window.addEventListener('securitypolicyviolation', function(e) { + opener.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + + try { + location.href = "{{GET[target]}}"; + } catch(ex) {} +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html.sub.headers new file mode 100644 index 0000000000..a42cfe2d95 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/href_location_navigation.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}}; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html new file mode 100644 index 0000000000..2434271211 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> + +<body> +<a href="{{GET[target]}}" id="link">dummy link</a> +<script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + + document.getElementById('link').click(); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html.sub.headers new file mode 100644 index 0000000000..a42cfe2d95 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/link_click_navigation.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}}; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html new file mode 100644 index 0000000000..64bae27fed --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + </script> + + <meta http-equiv="refresh" content="0; url={{GET[target]}}"> +</head> + +<body> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html.sub.headers new file mode 100644 index 0000000000..a42cfe2d95 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/meta_refresh_navigation.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}}; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html new file mode 100644 index 0000000000..a84c9c64ca --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + </script> +</head> + +<body> +<a href="post_message_to_frame_owner.html" id="link" target="_parent">dummy link</a> +<script> + document.getElementById('link').click(); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html.sub.headers new file mode 100644 index 0000000000..a42cfe2d95 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/navigate_parent.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}}; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/post_message_to_frame_owner.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/post_message_to_frame_owner.html new file mode 100644 index 0000000000..c25e49d146 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/post_message_to_frame_owner.html @@ -0,0 +1,6 @@ +<script> + if (window.opener) + window.opener.postMessage({result: 'success'}, '*'); + else + top.postMessage({result: 'success'}, '*'); +</script>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py b/testing/web-platform/tests/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py new file mode 100644 index 0000000000..0f6f6eca7b --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/redirect_to_post_message_to_frame_owner.py @@ -0,0 +1,6 @@ +def main(request, response): + response.status = 302 + if b"location" in request.GET: + response.headers.set(b"Location", request.GET[b"location"]) + else: + response.headers.set(b"Location", b"post_message_to_frame_owner.html") diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html new file mode 100644 index 0000000000..9e26c02be3 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<head> + <script> + window.onmessage = function(e) { + if (e.data == "start_test") { + document.getElementById('link').click(); + location.href = "{{location[server]}}/content-security-policy/navigate-to/support/spv-test-iframe3.sub.html"; + } + } + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({iframe: 'iframe1', violatedDirective: e.violatedDirective}, '*'); + }); + </script> +</head> + +<body> + <a href="{{location[server]}}/content-security-policy/navigate-to/support/delayed_frame.py" id="link" target="iframe2">dummy link</a> + IFRAME 1 +</body> diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html.sub.headers new file mode 100644 index 0000000000..9d83b92d96 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe1.sub.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: navigate-to {{location[server]}}/content-security-policy/navigate-to/support/spv-test-iframe3.sub.html 'unsafe-allow-redirects'; report-uri /reporting/resources/report.py?op=put&reportID={{GET[report_id]}} diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe2.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe2.sub.html new file mode 100644 index 0000000000..1329683c88 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe2.sub.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<head> +</head> +<body> + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({iframe: 'iframe1', violatedDirective: e.violatedDirective}, '*'); + }); + setTimeout(function() { + top.postMessage("end_test", "*"); + }, 4000); + </script> + IFRAME 2 +</body> diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe3.sub.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe3.sub.html new file mode 100644 index 0000000000..09dbf6863d --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/spv-test-iframe3.sub.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<head> + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({iframe: 'iframe3', violatedDirective: e.violatedDirective}, '*'); + }); + </script> +</head> + +<body> + IFRAME 3 +</body> diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html b/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html new file mode 100644 index 0000000000..2450ff1c0a --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <script> + window.addEventListener('securitypolicyviolation', function(e) { + top.postMessage({result: 'fail', violatedDirective: e.violatedDirective}, '*'); + }); + </script> +</head> + +<body> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html.sub.headers b/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html.sub.headers new file mode 100644 index 0000000000..d3c635b9a0 --- /dev/null +++ b/testing/web-platform/tests/content-security-policy/navigate-to/support/wait_for_navigation.html.sub.headers @@ -0,0 +1,4 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Pragma: no-cache +Content-Security-Policy: {{GET[csp]}} |