Update web-platform-tests to revision 2d42384cf21efd71843295d319c1bab85b3acf4a

This commit is contained in:
WPT Sync Bot 2019-01-11 20:32:19 -05:00
parent f2b224d610
commit e851ef0cd2
1014 changed files with 5653 additions and 1590 deletions

View file

@ -8,5 +8,10 @@ def main(request, response):
headers.append(("Access-Control-Allow-Origin", request.headers["origin"]))
body = json.dumps({ "header": request.headers.get("sec-metadata", "") })
body = json.dumps({
"dest": request.headers.get("sec-fetch-dest", ""),
"mode": request.headers.get("sec-fetch-mode", ""),
"site": request.headers.get("sec-fetch-site", ""),
"user": request.headers.get("sec-fetch-user", ""),
})
return headers, body

View file

@ -3,6 +3,11 @@ import json
def main(request, response):
headers = [("Content-Type", "text/javascript")]
body = "var header = %s;" % json.dumps(request.headers.get("sec-metadata", ""));
body = "var header = %s;" % json.dumps({
"dest": request.headers.get("sec-fetch-dest", ""),
"mode": request.headers.get("sec-fetch-mode", ""),
"site": request.headers.get("sec-fetch-site", ""),
"user": request.headers.get("sec-fetch-user", ""),
});
return headers, body

View file

@ -1,18 +1,11 @@
function parse_metadata(value) {
let result = {};
value.split(',').forEach(item => {
let parsed = item.trim().split('=');
result[parsed[0]] = parsed[1];
});
return result;
}
function assert_header_equals(value, expected) {
// check that the returned value is an object, not a String
assert_not_equals(value, "", "Empty Sec-Metadata header.");
let result = parse_metadata(value);
assert_equals(result.cause, expected.cause, "cause");
assert_equals(result.destination, expected.destination, "destination");
assert_equals(result.target, expected.target, "target");
assert_equals(result.site, expected.site, "site");
if (typeof(value) === "string"){
assert_not_equals(value, "No header has been recorded");
value = JSON.parse(value);
}
assert_equals(value.dest, expected.dest, "dest");
// Mode is commented out as no test cases have been filled out yet
// assert_equals(value.mode, expected.mode, "mode");
assert_equals(value.site, expected.site, "site");
assert_equals(value.user, expected.user, "user");
}

View file

@ -12,5 +12,10 @@ def main(request, response):
if (window.top != window)
window.top.postMessage(data, "*");
</script>
""" % json.dumps(request.headers.get("Sec-Metadata", ""))
""" % json.dumps({
"dest": request.headers.get("sec-fetch-dest", ""),
"mode": request.headers.get("sec-fetch-mode", ""),
"site": request.headers.get("sec-fetch-site", ""),
"user": request.headers.get("sec-fetch-user", ""),
})
return headers, body

View file

@ -2,6 +2,7 @@ import os
import uuid
import hashlib
import time
import json
def main(request, response):
## Get the query parameter (key) from URL ##
@ -30,8 +31,14 @@ def main(request, response):
## Record incoming Sec-Metadata header value
else:
try:
## Return empty string as a default value ##
header = request.headers.get("Sec-Metadata", "")
## Return a serialized JSON object with one member per header. If the ##
## header isn't present, the member will contain an empty string. ##
header = json.dumps({
"dest": request.headers.get("sec-fetch-dest", ""),
"mode": request.headers.get("sec-fetch-mode", ""),
"site": request.headers.get("sec-fetch-site", ""),
"user": request.headers.get("sec-fetch-user", ""),
})
request.server.stash.put(testId, header)
except KeyError:
## The header is already recorded or it doesn't exist