From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Fri, 19 Apr 2024 03:47:29 +0200
Subject: Adding upstream version 115.8.0esr.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 .../generic/subresource-test/area-navigate.html    | 39 ++++++++++++++++++++
 .../attr-referrer-invalid-value.html               | 25 +++++++++++++
 .../generic/subresource-test/fetch-messaging.html  | 42 ++++++++++++++++++++++
 .../generic/subresource-test/iframe-messaging.html | 38 ++++++++++++++++++++
 .../generic/subresource-test/image-decoding.html   | 38 ++++++++++++++++++++
 .../generic/subresource-test/link-navigate.html    | 38 ++++++++++++++++++++
 .../generic/subresource-test/script-messaging.html | 38 ++++++++++++++++++++
 .../generic/subresource-test/worker-messaging.html | 38 ++++++++++++++++++++
 .../generic/subresource-test/xhr-messaging.html    | 38 ++++++++++++++++++++
 9 files changed, 334 insertions(+)
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/area-navigate.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/fetch-messaging.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/iframe-messaging.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/image-decoding.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/link-navigate.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/script-messaging.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/worker-messaging.html
 create mode 100644 testing/web-platform/tests/referrer-policy/generic/subresource-test/xhr-messaging.html

(limited to 'testing/web-platform/tests/referrer-policy/generic/subresource-test')

diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/area-navigate.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/area-navigate.html
new file mode 100644
index 0000000000..2a4f29654d
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/area-navigate.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Area Link messaging - cross-origin Area Link navigation</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Area Link messaging - cross-origin Area Link navigation</h1>
+    <p>If you can read JSON encoded HTTP request headers of the Area link below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+          var urlPath = '/common/security-features/subresource/document.py';
+          var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                    urlPath;
+          return requestViaArea(url)
+            .then(function(message) {
+              var pre = document.getElementById('received_message')
+              var headers = message.headers;
+              pre.innerHTML = "";
+              pre.innerHTML += url + ":\n\n";
+              pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+              assert_own_property(headers, "host")
+              assert_own_property(headers, "connection")
+            });
+        },
+        "Area is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html
new file mode 100644
index 0000000000..bfdf1166ce
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Invalid referrerPolicy attribute value</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <h1>Invalid referrerPolicy attribute value</h1>
+    <pre>Running...</pre>
+
+    <script>
+      test(function () {
+          var elements = ["iframe", "img", "a", "area", "link", "script"];
+          for (var i = 0; i < elements.length; i++) {
+              var elem = document.createElement(elements[i]);
+              elem.referrerPolicy = "unsafe-url";
+              assert_equals(elem.referrerPolicy, "unsafe-url");
+              elem.referrerPolicy = "not-valid-value";
+              assert_equals(elem.referrerPolicy, "");
+          }
+      }, "Invalid referrerpolicy values not reflected");
+    </script>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/fetch-messaging.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/fetch-messaging.html
new file mode 100644
index 0000000000..2678af822e
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/fetch-messaging.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Fetch messaging - same-origin Fetch request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Fetch messaging - same-origin Fetch request</h1>
+    <p>If you can read JSON encoded HTTP request headers of the Fetch below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      test(function() {
+        assert_true(!!window.fetch, "Fetch is not supported by this browser.");
+      }, "Fetch is supported by the browser.");
+
+      promise_test(function() {
+          var urlPath = '/common/security-features/subresource/xhr.py';
+          var url = location.protocol + "//" + location.hostname + ":" +
+                    location.port + urlPath;
+          return requestViaFetch(url)
+            .then(function(message) {
+                var pre = document.getElementById('received_message')
+                var headers = message.headers;
+                pre.innerHTML = "";
+                pre.innerHTML += url + ":\n\n";
+                pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n";
+                assert_own_property(headers, "host")
+                assert_own_property(headers, "connection")
+              });
+      }, "Fetch is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/iframe-messaging.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/iframe-messaging.html
new file mode 100644
index 0000000000..b8bdb0e5e0
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/iframe-messaging.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Iframe messaging - cross-origin iframe request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Iframe messaging - cross-origin iframe request</h1>
+    <p>If you can read JSON encoded HTTP request headers of the iframe below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/document.py';
+        var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                  urlPath;
+        return requestViaIframe(url)
+          .then(function(message) {
+            var pre = document.getElementById('received_message')
+            var headers = message.headers;
+            pre.innerHTML = "";
+            pre.innerHTML += url + ":\n\n";
+            pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+            assert_own_property(headers, "host")
+            assert_own_property(headers, "connection")
+          });
+      }, "Iframe is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/image-decoding.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/image-decoding.html
new file mode 100644
index 0000000000..76ce0e263a
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/image-decoding.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Image decoding - cross-origin image request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Image decoding - cross-origin image request</h1>
+    <p>If you can read JSON encoded HTTP headers of the image below,
+       the decoding works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/image.py';
+        var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                  urlPath + "?cache_destroyer=" + (new Date()).getTime();
+        return requestViaImage(url, undefined, "always")
+          .then(function(message) {
+            var pre = document.getElementById('received_message')
+            var headers = message.headers;
+            pre.innerHTML = "";
+            pre.innerHTML += url + ":\n\n";
+            pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+            assert_own_property(headers, "host")
+            assert_own_property(headers, "connection")
+          });
+      }, "Image is encoding headers as JSON.");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/link-navigate.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/link-navigate.html
new file mode 100644
index 0000000000..21783d3e31
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/link-navigate.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Link messaging - cross-origin Link navigation</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Link messaging - cross-origin Link navigation</h1>
+    <p>If you can read JSON encoded HTTP request headers of the Link below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/document.py';
+        var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                  urlPath;
+        return requestViaAnchor(url)
+          .then(function(message) {
+              var pre = document.getElementById('received_message')
+              var headers = message.headers;
+              pre.innerHTML = "";
+              pre.innerHTML += url + ":\n\n";
+              pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+              assert_own_property(headers, "host")
+              assert_own_property(headers, "connection")
+            });
+      }, "Link is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/script-messaging.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/script-messaging.html
new file mode 100644
index 0000000000..1bc0ba13ef
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/script-messaging.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Script messaging - cross-origin Script request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Script messaging - cross-origin Script request</h1>
+    <p>If you can read JSON encoded HTTP request headers of the Script below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/script.py';
+        var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                  urlPath;
+        return requestViaScript(url)
+          .then(function(message) {
+              var pre = document.getElementById('received_message')
+              var headers = message.headers;
+              pre.innerHTML = "";
+              pre.innerHTML += url + ":\n\n";
+              pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+              assert_own_property(headers, "host")
+              assert_own_property(headers, "connection")
+            });
+      }, "Script is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/worker-messaging.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/worker-messaging.html
new file mode 100644
index 0000000000..c2db8fe845
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/worker-messaging.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>Worker messaging - same-origin Worker request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>Worker messaging - same-origin Worker request</h1>
+    <p>If you can read JSON encoded HTTP request headers of the Worker below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/worker.py';
+        var url = location.protocol + "//" + location.hostname + ":" +
+                  location.port + urlPath;
+        return requestViaDedicatedWorker(url, {})
+          .then(function(message) {
+              var pre = document.getElementById('received_message')
+              var headers = message.headers;
+              pre.innerHTML = "";
+              pre.innerHTML += url + ":\n\n";
+              pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+              assert_own_property(headers, "host")
+              assert_own_property(headers, "connection")
+            });
+      }, "Worker is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
diff --git a/testing/web-platform/tests/referrer-policy/generic/subresource-test/xhr-messaging.html b/testing/web-platform/tests/referrer-policy/generic/subresource-test/xhr-messaging.html
new file mode 100644
index 0000000000..c1f89919ca
--- /dev/null
+++ b/testing/web-platform/tests/referrer-policy/generic/subresource-test/xhr-messaging.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->
+<html>
+  <head>
+    <title>XHR messaging - cross-origin XHR request</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <!-- Common global functions for referrer-policy tests. -->
+    <script src="/common/security-features/resources/common.sub.js"></script>
+  </head>
+  <body>
+    <h1>XHR messaging - cross-origin XHR request</h1>
+    <p>If you can read JSON encoded HTTP request headers of the XHR below,
+       the messaging works as expected.</p>
+
+    <pre id="received_message">Running...</pre>
+
+    <script>
+      promise_test(function() {
+        var urlPath = '/common/security-features/subresource/xhr.py';
+        var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
+                  urlPath;
+        return requestViaXhr(url)
+          .then(function(message) {
+              var pre = document.getElementById('received_message')
+              var headers = message.headers;
+              pre.innerHTML = "";
+              pre.innerHTML += url + ":\n\n";
+              pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"
+              assert_own_property(headers, "host")
+              assert_own_property(headers, "connection")
+            });
+      }, "XHR is responding with HTTP headers");
+    </script>
+
+    <div id="log"></div>
+  </body>
+</html>
-- 
cgit v1.2.3