mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Update web-platform-tests to revision dc60bfc45b49e3a5e653320e65b0fd447676b836
This commit is contained in:
parent
652a177ff5
commit
0bc549be55
690 changed files with 6588 additions and 1564 deletions
|
@ -19,8 +19,8 @@ function corsPreflight(desc, corsUrl, method, allowed, headers, safeHeaders) {
|
|||
return promise_test(function(test) {
|
||||
var uuid_token = token();
|
||||
return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(response) {
|
||||
var url = corsUrl;
|
||||
var urlParameters = "?token=" + uuid_token + "&max_age=0";
|
||||
var url = corsUrl + (corsUrl.indexOf("?") === -1 ? "?" : "&");
|
||||
var urlParameters = "token=" + uuid_token + "&max_age=0";
|
||||
var requestInit = {"mode": "cors", "method": method};
|
||||
var requestHeaders = [];
|
||||
if (headers)
|
||||
|
@ -66,6 +66,7 @@ var corsUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) +
|
|||
corsPreflight("CORS [DELETE], server allows", corsUrl, "DELETE", true);
|
||||
corsPreflight("CORS [DELETE], server refuses", corsUrl, "DELETE", false);
|
||||
corsPreflight("CORS [PUT], server allows", corsUrl, "PUT", true);
|
||||
corsPreflight("CORS [PUT], server allows, check preflight has user agent", corsUrl + "?checkUserAgentHeaderInPreflight", "PUT", true);
|
||||
corsPreflight("CORS [PUT], server refuses", corsUrl, "PUT", false);
|
||||
corsPreflight("CORS [PATCH], server allows", corsUrl, "PATCH", true);
|
||||
corsPreflight("CORS [PATCH], server refuses", corsUrl, "PATCH", false);
|
||||
|
|
|
@ -44,6 +44,7 @@ def main(request, response):
|
|||
|
||||
stashed_data['preflight'] = "1"
|
||||
stashed_data['preflight_referrer'] = request.headers.get("Referer", "")
|
||||
stashed_data['preflight_user_agent'] = request.headers.get("User-Agent", "")
|
||||
if token:
|
||||
request.server.stash.put(token, stashed_data)
|
||||
|
||||
|
@ -55,6 +56,9 @@ def main(request, response):
|
|||
if data:
|
||||
stashed_data = data
|
||||
|
||||
if "checkUserAgentHeaderInPreflight" in request.GET and request.headers.get("User-Agent") != stashed_data['preflight_user_agent']:
|
||||
return 400, headers, "ERROR: No user-agent header in preflight"
|
||||
|
||||
#use x-* headers for returning value to bodyless responses
|
||||
headers.append(("Access-Control-Expose-Headers", "x-did-preflight, x-control-request-headers, x-referrer, x-preflight-referrer, x-origin"))
|
||||
headers.append(("x-did-preflight", stashed_data['preflight']))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue