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/referrer-policy/css-integration/font-face | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.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/referrer-policy/css-integration/font-face')
5 files changed, 228 insertions, 0 deletions
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html new file mode 100644 index 0000000000..ac26aa2828 --- /dev/null +++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS integration - Font from imported stylesheet (external)</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> + <!-- Common global functions for referrer-policy tests. --> + <script src="/common/security-features/resources/common.sub.js"></script> + <meta name="referrer" content="never"> + </head> + <body> + <p>Check that resources from imported stylesheets (loaded from external + stylesheets) are loaded with the referrer and referrer policy from the + external stylesheet.</p> + + <div class="styled"></div> + + <script> + promise_test(function(css_test) { + let id = token(); + let css_url = location.protocol + "//www1." + location.hostname + ":" + + location.port + + "/common/security-features/subresource/stylesheet.py?id=" + id + + "&import-rule" + "&type=font"; + let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port; + let css_referrer = url_prefix + + "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font"; + let font_url = url_prefix + "/common/security-features/subresource/font.py" + + "?id=" + id + "&report-headers" + "&type=font"; + + return new Promise(resolve => { + let link = document.createElement("link"); + link.href = css_url; + link.rel = "stylesheet"; + link.onload = resolve; + document.head.appendChild(link); + }) + .then(() => timeoutPromise(css_test, 1000)) + .then(() => requestViaXhr(font_url)) + .then(function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, css_referrer); + }); + }, "Font from imported stylesheet (external)."); + </script> + + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html new file mode 100644 index 0000000000..fa21a1d53f --- /dev/null +++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS integration - Font from external stylesheet</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> + <!-- Common global functions for referrer-policy tests. --> + <script src="/common/security-features/resources/common.sub.js"></script> + <meta name="referrer" content="never"> + </head> + <body> + <p>Check that resources from external stylesheets are loaded with + the referrer and referrer policy from the external stylesheet.</p> + + <div class="styled"></div> + + <script> + promise_test(function(css_test) { + let id = token(); + let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; + let css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font"; + let font_url = url_prefix + "/common/security-features/subresource/font.py" + + "?id=" + id + "&report-headers"; + + return new Promise(resolve => { + let link = document.createElement("link"); + link.href = css_url; + link.rel = "stylesheet"; + link.onload = resolve; + document.head.appendChild(link); + }) + .then(() => timeoutPromise(css_test, 1000)) + .then(() => requestViaXhr(font_url)) + .then(function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, css_url); + }); + }, "Font from external stylesheet."); + </script> + + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html new file mode 100644 index 0000000000..d2c8ae754f --- /dev/null +++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS integration - Font from imported stylesheet (internal)</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> + <!-- Common global functions for referrer-policy tests. --> + <script src="/common/security-features/resources/common.sub.js"></script> + <meta name="referrer" content="origin"> + </head> + <body> + <p>Check that resources from stylesheets (imported from internal + stylesheets) are loaded with the referrer and referrer policy from from the + imported style sheet.</p> + + <div class="styled"></div> + + <script> + promise_test(function(css_test) { + let id = token(); + let url_prefix = location.protocol + "//www1." + location.hostname + ":" + + location.port + "/common/security-features/subresource/"; + let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font"; + let font_url = url_prefix + "font.py?report-headers&id=" + id; + + let style = document.createElement("style"); + style.textContent = "@import url('" + css_url + "');"; + document.head.appendChild(style); + return timeoutPromise(css_test, 1000) + .then(() => requestViaXhr(font_url)) + .then(function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, css_url); + }); + }, "Font from imported stylesheet (internal)."); + </script> + + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html new file mode 100644 index 0000000000..43aa37151b --- /dev/null +++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS integration - Font from internal stylesheet</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> + <!-- Common global functions for referrer-policy tests. --> + <script src="/common/security-features/resources/common.sub.js"></script> + <meta name="referrer" content="origin"> + </head> + <body> + <p>Check that resources from internal stylesheets are loaded with + the referrer and referrer policy from the document.</p> + + <div class="styled"></div> + + <script> + promise_test(function(css_test) { + let id = token(); + let css_url = location.protocol + "//www1." + location.hostname + ":" + + location.port + + "/common/security-features/subresource/font.py" + "?id=" + + id + "&type=font"; + let font_url = css_url + "&report-headers"; + + let style = document.createElement("style"); + style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}"; + document.head.appendChild(style); + return timeoutPromise(css_test, 1000) + .then(() => requestViaXhr(font_url)) + .then(function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, location.origin + "/"); + }); + }, "Font from internal stylesheet."); + </script> + + <div id="log"></div> + </body> +</html> diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html new file mode 100644 index 0000000000..6c864afd9a --- /dev/null +++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS integration - Font from external stylesheet inserted via a ProcessingInstruction</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/utils.js"></script> + <!-- Common global functions for referrer-policy tests. --> + <script src="/common/security-features/resources/common.sub.js"></script> + <meta name="referrer" content="never"> + </head> + <body> + <p>Check that resources from external stylesheets (referenced from a + ProcessingInstruction) are loaded with the referrer and referrer policy + from the external stylesheet.</p> + + <div class="styled"></div> + + <script> + promise_test(function(css_test) { + let id = token(); + let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port; + let css_url = url_prefix + + "/common/security-features/subresource/stylesheet.py?id=" + + id + "&type=font"; + let expected = url_prefix + + "/common/security-features/subresource/stylesheet.py?id=" + + id + "&type=font"; + let font_url = url_prefix + "/common/security-features/subresource/font.py" + + "?id=" + id + "&report-headers"; + + let processingInstruction = + document.createProcessingInstruction( + "xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\""); + document.insertBefore(processingInstruction, document.firstChild); + return timeoutPromise(css_test, 1000) + .then(() => requestViaXhr(font_url)) + .then(function(message) { + assert_own_property(message, "headers"); + assert_own_property(message, "referrer"); + assert_equals(message.referrer, expected); + }); + }, "Font from external stylesheet (from ProcessingInstruction)."); + </script> + + <div id="log"></div> + </body> +</html> |