Update web-platform-tests to revision fb15e14b52049f952612623ee0d7fb7a620a57c9

This commit is contained in:
WPT Sync Bot 2018-11-01 21:34:37 -04:00
parent 200cc8aa6b
commit 4a942c982f
141 changed files with 2563 additions and 1589 deletions

View file

@ -1,11 +1,15 @@
// META: global=window,worker
promise_test(async t => {
const response = await fetch("../../../xhr/resources/headers-basic.asis");
assert_equals(response.headers.get("foo-test"), "1, 2, 3");
}, "response.headers.get('foo-test')");
promise_test(async t => {
const response = await fetch("../../../xhr/resources/headers-www-authenticate.asis");
assert_equals(response.headers.get("www-authenticate"), "1, 2, 3, 4");
}, "response.headers.get('www-authenticate')");
[
["content-length", "0", "header-content-length"],
["content-length", "0, 0", "header-content-length-twice"],
["double-trouble", ", ", "headers-double-empty"],
["foo-test", "1, 2, 3", "headers-basic"],
["heya", ", \u000B\u000C, 1, , , 2", "headers-some-are-empty"],
["www-authenticate", "1, 2, 3, 4", "headers-www-authenticate"],
].forEach(testValues => {
promise_test(async t => {
const response = await fetch("../../../xhr/resources/" + testValues[2] + ".asis");
assert_equals(response.headers.get(testValues[0]), testValues[1]);
}, "response.headers.get('" + testValues[0] + "') expects " + testValues[1]);
});

View file

@ -1,28 +0,0 @@
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
var fails = ["first", "uppercase"],
passes = ["last", "quoted", "quoted-single", "no-x"]
fails.forEach(function(urlpart) {
async_test(function(t) {
var script = document.createElement("script")
script.onerror = t.step_func_done(function(){})
script.onload = t.unreached_func("Unexpected load event")
script.src = "resources/nosniff-" + urlpart + ".asis"
document.body.appendChild(script)
}, "URL query: " + urlpart)
})
passes.forEach(function(urlpart) {
async_test(function(t) {
var script = document.createElement("script")
script.onerror = t.unreached_func("Unexpected error event")
script.onload = t.step_func_done(function(){})
script.src = "resources/nosniff-" + urlpart + ".asis"
document.body.appendChild(script)
}, "URL query: " + urlpart)
})
</script>

View file

@ -0,0 +1,24 @@
promise_test(() => fetch("resources/x-content-type-options.json").then(res => res.json()).then(runTests), "Loading JSON…");
function runTests(allTestData) {
for (let i = 0; i < allTestData.length; i++) {
const testData = allTestData[i],
input = encodeURIComponent(testData.input);
async_test(t => {
const script = document.createElement("script");
t.add_cleanup(() => script.remove());
// A <script> element loading a classic script does not care about the MIME type, unless
// X-Content-Type-Options: nosniff is specified, in which case a JavaScript MIME type is
// enforced, which x/x is not.
if (testData.nosniff) {
script.onerror = t.step_func_done();
script.onload = t.unreached_func("Script should not have loaded");
} else {
script.onerror = t.unreached_func("Script should have loaded");
script.onload = t.step_func_done();
}
script.src = "resources/nosniff.py?nosniff=" + input;
document.body.appendChild(script);
}, input);
}
}

View file

@ -1,7 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
X-Content-Type-options: nosniff
X-Content-Type-Options: no
// nothing to see here

View file

@ -1,7 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
X-Content-Type-Options: no
X-Content-Type-options: nosniff
// nothing to see here

View file

@ -1,6 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
Content-Type-Options: nosniff
// nothing to see here

View file

@ -1,6 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
X-Content-Type-Options: 'NosniFF'
// nothing to see here

View file

@ -1,6 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
X-Content-Type-Options: "nosniFF"
// nothing to see here

View file

@ -1,6 +0,0 @@
HTTP/1.1 200 YOU HAVE NO POWER HERE
Content-Length: 22
Content-Type: x/x
X-Content-Type-Options: NOSNIFF
// nothing to see here

View file

@ -0,0 +1,10 @@
def main(request, response):
response.add_required_headers = False
output = "HTTP/1.1 220 YOU HAVE NO POWER HERE\r\n"
output += "Content-Length: 22\r\n"
output += "Content-Type: x/x\r\n"
output += request.GET.first("nosniff") + "\r\n"
output += "\r\n"
output += "// nothing to see here"
response.writer.write(output)
response.close_connection = True

View file

@ -0,0 +1,58 @@
[
{
"input": "X-Content-Type-Options: NOSNIFF",
"nosniff": true
},
{
"input": "x-content-type-OPTIONS: nosniff",
"nosniff": true
},
{
"input": "X-Content-Type-Options: nosniff,,@#$#%%&^&^*()()11!",
"nosniff": true
},
{
"input": "X-Content-Type-Options: @#$#%%&^&^*()()11!,nosniff",
"nosniff": false
},
{
"input": "X-Content-Type-Options: nosniff\r\nX-Content-Type-Options: no",
"nosniff": true
},
{
"input": "X-Content-Type-Options: no\r\nX-Content-Type-Options: nosniff",
"nosniff": false
},
{
"input": "X-Content-Type-Options:\r\nX-Content-Type-Options: nosniff",
"nosniff": false
},
{
"input": "X-Content-Type-Options: ,nosniff",
"nosniff": false
},
{
"input": "X-Content-Type-Options: nosniff\u000C",
"nosniff": false
},
{
"input": "X-Content-Type-Options: nosniff\u000B",
"nosniff": false
},
{
"input": "X-Content-Type-Options: nosniff\u000B,nosniff",
"nosniff": false
},
{
"input": "X-Content-Type-Options: 'NosniFF'",
"nosniff": false
},
{
"input": "X-Content-Type-Options: \"nosniFF\"",
"nosniff": false
},
{
"input": "Content-Type-Options: nosniff",
"nosniff": false
}
]