diff options
Diffstat (limited to 'testing/web-platform/tests/credential-management/support/fedcm/set_accounts_cookie.py')
-rw-r--r-- | testing/web-platform/tests/credential-management/support/fedcm/set_accounts_cookie.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/credential-management/support/fedcm/set_accounts_cookie.py b/testing/web-platform/tests/credential-management/support/fedcm/set_accounts_cookie.py new file mode 100644 index 0000000000..ab34992210 --- /dev/null +++ b/testing/web-platform/tests/credential-management/support/fedcm/set_accounts_cookie.py @@ -0,0 +1,21 @@ +def main(request, response): + query_string = request.url_parts[3] + # We mark the cookie as HttpOnly so that this request + # can be made before login.html, which would overwrite + # the value to 1. + header_value = "accounts={}; SameSite=None; Secure; HttpOnly".format(query_string) + response.headers.set(b"Set-Cookie", header_value.encode("utf-8")) + response.headers.set(b"Content-Type", b"text/html") + + return """ +<!DOCTYPE html> +<script> +// The important part of this page are the headers. + +// If this page was opened as a popup, notify the opener. +if (window.opener) { + window.opener.postMessage("done_loading", "*"); +} +</script> +Sent header value: {}".format(header_value) +""" |