mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317
This commit is contained in:
parent
aa199307c8
commit
2b6f573eb5
3440 changed files with 109438 additions and 41750 deletions
|
@ -1,32 +1,14 @@
|
|||
# Returns a valid response when a request has appropriate credentials.
|
||||
def main(request, response):
|
||||
credentials_mode = request.GET.first("mode")
|
||||
cookie = request.cookies.first("cookieName", None)
|
||||
source_origin = request.headers.get("origin", None);
|
||||
is_cross_origin = request.GET.first("is_cross_origin", False)
|
||||
expected_value = request.GET.first("value", None)
|
||||
source_origin = request.headers.get("origin", None)
|
||||
|
||||
# The request with the default WorkletOptions should not include the cookie.
|
||||
if credentials_mode is "default" and cookie is not None:
|
||||
return (404)
|
||||
response_headers = [("Content-Type", "text/javascript"),
|
||||
("Access-Control-Allow-Origin", source_origin),
|
||||
("Access-Control-Allow-Credentials", "true")]
|
||||
|
||||
# The request with "credentials=omit" should not include the cookie.
|
||||
if credentials_mode is "omit" and cookie is not None:
|
||||
return (404)
|
||||
if cookie == expected_value:
|
||||
return (200, response_headers, "")
|
||||
|
||||
if credentials_mode is "same-origin":
|
||||
# The cross-origin request with "credentials=same-origin" should not
|
||||
# include the cookie.
|
||||
if is_cross_origin and cookie is not None:
|
||||
return (404)
|
||||
# The same-origin request with "credentials=same-origin" should include
|
||||
# the cookie.
|
||||
if not is_cross_origin and cookie is None:
|
||||
return (404)
|
||||
|
||||
# The request with "credentials=include" should include the cookie.
|
||||
if credentials_mode is "include" and cookie is None:
|
||||
return (404)
|
||||
|
||||
return (200, [("Content-Type", "text/javascript"),
|
||||
("Access-Control-Allow-Origin", source_origin),
|
||||
("Access-Control-Allow-Credentials", "true")], "")
|
||||
return (404, response_headers)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue