summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/storage-access-api/resources/set-cookie.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/storage-access-api/resources/set-cookie.py
parentInitial commit. (diff)
downloadfirefox-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/storage-access-api/resources/set-cookie.py')
-rw-r--r--testing/web-platform/tests/storage-access-api/resources/set-cookie.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/storage-access-api/resources/set-cookie.py b/testing/web-platform/tests/storage-access-api/resources/set-cookie.py
new file mode 100644
index 0000000000..019697a4a8
--- /dev/null
+++ b/testing/web-platform/tests/storage-access-api/resources/set-cookie.py
@@ -0,0 +1,27 @@
+def main(request, response):
+ name = request.GET.first(b"name")
+ value = request.GET.first(b"value")
+ testcase = request.GET.first(b"testcase")
+ response_headers = [(b"Set-Cookie", name + b"=" + value)]
+
+ body = b"""
+ <!DOCTYPE html>
+ <meta charset="utf-8">
+ <title>Set Storage Access Subframe</title>
+ <script src="/resources/testharness.js"></script>
+
+ <script>
+ let querystring = window.location.search.substring(1).split("&");
+ const allowed = querystring.some(param => param.toLowerCase() === "allowed=true");
+
+ test(() => {
+ if (allowed) {
+ assert_equals(document.cookie, "%s=%s");
+ } else {
+ assert_equals(document.cookie, "");
+ }
+ }, "[%s] Cookie access is allowed: " + allowed);
+ </script>
+ """ % (name, value, testcase)
+
+ return (200, response_headers, body)