Update web-platform-tests to revision 1e42017386ce1eaeed4925fb8bc7f5417752019a

This commit is contained in:
Ms2ger 2016-07-05 17:05:14 +02:00
parent 5574a4e4c8
commit a972fdb353
2003 changed files with 16788 additions and 3140 deletions

View file

@ -0,0 +1,7 @@
def main(request, response):
import datetime, os
srcpath = os.path.join(os.path.dirname(__file__), "well-formed.xml")
srcmoddt = datetime.datetime.fromtimestamp(os.path.getmtime(srcpath))
response.headers.set("Last-Modified", srcmoddt.strftime("%a, %d %b %Y %H:%M:%S GMT"))
response.headers.set("Content-Type", "application/xml")
return open(srcpath).read()

View file

@ -10,6 +10,7 @@
<body>
<div id="log"></div>
<script>
var timePreXHR = Math.floor(new Date().getTime() / 1000);
var client = new XMLHttpRequest()
client.open("GET", "resources/well-formed.xml", false)
client.send(null)
@ -43,8 +44,18 @@
}
test(function() {
assert_true((new Date(client.getResponseHeader('Last-Modified'))).getTime() == (new Date(client.responseXML.lastModified)).getTime(), 'responseXML.lastModified time should be equal to time in response Last-Modified header')
}, 'lastModified set according to HTTP header')
var lastModified = Math.floor(new Date(client.responseXML.lastModified).getTime() / 1000);
var now = Math.floor(new Date().getTime() / 1000);
assert_greater_than_equal(lastModified, timePreXHR);
assert_less_than_equal(lastModified, now);
}, 'lastModified set to time of response if no HTTP header provided')
test(function() {
var client2 = new XMLHttpRequest()
client2.open("GET", "resources/last-modified.py", false)
client2.send(null)
assert_equals((new Date(client2.getResponseHeader('Last-Modified'))).getTime(), (new Date(client2.responseXML.lastModified)).getTime())
}, 'lastModified set to related HTTP header if provided')
test(function() {
client.responseXML.cookie = "thisshouldbeignored"

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[2]/p[3]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::a[contains(@href,'#blob-response-entity-body')]/.."/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>XMLHttpRequest: The send() method: Blob data with no mime type</title>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
var blobTests = [
["no mime type", new Blob(["data"])],
["invalid mime type", new Blob(["data"], {type: "Invalid \r\n mime \r\n type"})]
];
blobTests.forEach(function(item){
test(function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "./resources/content.py", false);
xhr.send(item[1]);
assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4");
assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO");
}, "Synchronous blob loading with " + item[0]);
var atest = async_test("Asynchronous blob loading with " + item[0]);
atest.step(function() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
atest.step(function() {
assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4");
assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO");
});
atest.done();
}
}
xhr.open("POST", "./resources/content.py", true);
xhr.send(item[1]);
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
function secondScriptRan() {
parent.postMessage("done", "*");
}
function createSecondScript() {
var script = document.createElement("script");
script.src = "data:application/javascript,secondScriptRan()";
document.head.appendChild(script);
var xhr = new XMLHttpRequest();
xhr.open("GET", "data:,", false);
xhr.send();
}
</script>
<script src="data:application/javascript,createSecondScript()" defer></script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<meta charset=utf-8>
<title>Ensure that an async script added during a defer script that then does a
sync XHR still runs</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!--
We run the test in a subframe, because something in the testharness stuff
interferes with defer scripts -->
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "done");
});
</script>
<iframe src="xmlhttprequest-sync-not-hang-scriptloader-subframe.html"></iframe>