1
0
Fork 0
firefox/testing/web-platform/tests/storage-access-api/resources/script-with-cookie-header.py
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

34 lines
979 B
Python

def main(request, response):
script = request.GET.first(b"script")
# Some, but not all, urls will send a query parameter indicating their
# script will want to postMessage the parent to ack that it has loaded.
should_ack_load = b"false"
try:
# The call to request.GET.first will fail if the parameter isn't present,
# that's ok.
if request.GET.first(b"should_ack_load") == b"true":
should_ack_load = b"true"
except:
pass
cookie_header = request.headers.get(b"Cookie", b"")
body = b"""
<!DOCTYPE html>
<meta charset="utf-8">
<title>Subframe with HTTP Cookies</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
var httpCookies = "%s";
var should_ack_load = %s;
</script>
<body>
<script src="%s"></script>
</body>
""" % (cookie_header, should_ack_load, script)
return (200, [], body)