summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/referrer-policy/css-integration/svg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/referrer-policy/css-integration/svg
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/referrer-policy/css-integration/svg')
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/external-stylesheet.html41
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style-with-differentorigin-base-tag.tentative.html40
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style.html35
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/internal-stylesheet.html35
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/presentation-attribute.html40
-rw-r--r--testing/web-platform/tests/referrer-policy/css-integration/svg/processing-instruction.html38
6 files changed, 229 insertions, 0 deletions
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/external-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/external-stylesheet.html
new file mode 100644
index 0000000000..12bc9eeba6
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/external-stylesheet.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS integration - styling SVG 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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.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>
+
+ <script>
+ function addLinkStyleSheet(test) {
+ let css_url = url_prefix + "stylesheet.py?id=" + test.id +
+ "&type=svg" + "&property=" + test.property;
+ test.expected = css_url;
+
+ let stylesheet =
+ document.createElementNS("http://www.w3.org/1999/xhtml", "link");
+ stylesheet.setAttribute("type", "text/css");
+ stylesheet.setAttribute("rel", "stylesheet");
+ stylesheet.setAttribute("href", css_url);
+ let svg = createSvg();
+ document.body.appendChild(svg);
+ svg.appendChild(stylesheet);
+ }
+
+ runSvgTests(svg_test_properties,
+ "Test styling SVG from external style",
+ addLinkStyleSheet);
+ </script>
+
+ <div id="log"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style-with-differentorigin-base-tag.tentative.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style-with-differentorigin-base-tag.tentative.html
new file mode 100644
index 0000000000..9a8bc6da41
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style-with-differentorigin-base-tag.tentative.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>CSS integration - styling SVG from inline style on page with different-origin base tag</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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
+ <meta name="referrer" content="origin">
+</head>
+
+<base href="http://other-page.example/" />
+
+<body>
+ <p>Check that resources from inline styles are loaded with
+ the referrer and referrer policy from the document and, in
+ particular, not from the document's overridden base URL.</p>
+ <script>
+ function setInlineStyle(test) {
+ test.expected = location.origin + "/";
+ let svg = createSvg();
+ document.body.appendChild(svg);
+ let element = svg.getElementsByTagName('path')[0];
+ element.style = test.property + ": url(" + url_prefix + "svg.py?id=" +
+ test.id + "#invalidFragment);";
+ }
+
+ runSvgTests(svg_test_properties,
+ "Styling SVG from inline styles",
+ setInlineStyle);
+ </script>
+
+ <div id="log"></div>
+</body>
+
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style.html
new file mode 100644
index 0000000000..2d4725e0bb
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/inline-style.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS integration - styling SVG from inline style</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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
+ <meta name="referrer" content="origin">
+ </head>
+ <body>
+ <p>Check that resources from inline styles are loaded with
+ the referrer and referrer policy from the document.</p>
+ <script>
+ function setInlineStyle(test)
+ {
+ test.expected = location.origin + "/";
+ let svg = createSvg();
+ document.body.appendChild(svg);
+ let element = svg.getElementsByTagName('path')[0];
+ element.style = test.property + ": url(" + url_prefix + "svg.py?id=" +
+ test.id + "#invalidFragment);";
+ }
+
+ runSvgTests(svg_test_properties,
+ "Styling SVG from inline styles",
+ setInlineStyle);
+ </script>
+
+ <div id="log"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/internal-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/internal-stylesheet.html
new file mode 100644
index 0000000000..38f4cf8b56
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/internal-stylesheet.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS integration - styling SVG from internal style</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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
+ <meta name="referrer" content="origin">
+ </head>
+ <body>
+ <p>Check that resources from internal styles are loaded with
+ the referrer and referrer policy from the document.</p>
+ <script>
+ function setInternalStyle(test) {
+ test.expected = location.origin + "/";
+ let style = document.createElementNS(svg_ns, "style");
+ style.textContent = "path { " + test.property + ": url(" + url_prefix +
+ "svg.py?id=" + test.id + "#invalidFragment);";
+ let svg = createSvg();
+ svg.appendChild(style);
+ document.body.appendChild(svg);
+ }
+
+ runSvgTests(svg_test_properties,
+ "Styling SVG from internal styles",
+ setInternalStyle);
+ </script>
+
+ <div id="log"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/presentation-attribute.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/presentation-attribute.html
new file mode 100644
index 0000000000..e2104a6a6c
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/presentation-attribute.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS integration - styling SVG from external stylesheet from
+ presentation attribute</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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
+ <meta name="referrer" content="origin">
+ </head>
+ <body>
+ <p>Check that resources from presentation attributes are loaded with
+ the referrer and referrer policy from the document.</p>
+ <script>
+ function setPresentationAttribute(test)
+ {
+ test.expected = location.origin + "/";
+ let svg = createSvg();
+ document.body.appendChild(svg);
+ let element = svg.getElementsByTagName("path")[0];
+ // The test property should have map 1:1 with presentation attribute.
+ let attr = test.property;
+ element.setAttribute(attr, "url(" + url_prefix + "svg.py?id=" +
+ test.id + "#invalidFragment)");
+ }
+
+ // mask-image is not the presentation attribute.
+ runSvgTests(svg_test_properties.filter(p => p != 'mask-image'),
+ "Styling SVG from presentation attributes",
+ setPresentationAttribute);
+ </script>
+
+ <div id="log"></div>
+ </body>
+</html>
+
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/svg/processing-instruction.html b/testing/web-platform/tests/referrer-policy/css-integration/svg/processing-instruction.html
new file mode 100644
index 0000000000..4ff9a51890
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/css-integration/svg/processing-instruction.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS integration - styling SVG from external stylesheet via
+ 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>
+ <!-- Helper functions for referrer-policy css tests. -->
+ <script src="/referrer-policy/css-integration/css-test-helper.js"></script>
+ <meta name="referrer" content="origin">
+ </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>
+ <script>
+ function addProcessingInstruction(test) {
+ let svg_url = url_prefix + "svg.py?id=" + test.id + "&type=svg" +
+ "&property=" + test.property + "&embedded-svg";
+ let iframe = document.createElement("iframe");
+ test.expected = url_prefix + "stylesheet.py?id=" + test.id +
+ "&type=svg" + "&property=" + test.property;
+ iframe.src = svg_url;
+ document.body.appendChild(iframe);
+ }
+
+ runSvgTests(svg_test_properties,
+ "Styling SVG from ProcessingInstruction",
+ addProcessingInstruction);
+ </script>
+
+ <div id="log"></div>
+ </body>
+</html>
+