mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180. - Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
parent
fb4f421c8b
commit
296fa2512b
21852 changed files with 2080936 additions and 892894 deletions
|
@ -22,8 +22,14 @@
|
|||
client.open("GET", "resources/well-formed.xml", false)
|
||||
client.send(null)
|
||||
assert_equals(client.readyState, 4)
|
||||
assert_equals(client.status, 200)
|
||||
assert_equals(client.responseXML.documentElement.localName, "html")
|
||||
client.abort()
|
||||
assert_equals(client.readyState, 0)
|
||||
assert_equals(client.status, 0)
|
||||
assert_equals(client.statusText, "")
|
||||
assert_equals(client.responseXML, null)
|
||||
assert_equals(client.getAllResponseHeaders(), "")
|
||||
assert_array_equals(result, expected)
|
||||
test.done()
|
||||
})
|
||||
|
|
15
tests/wpt/web-platform-tests/XMLHttpRequest/historical.html
Normal file
15
tests/wpt/web-platform-tests/XMLHttpRequest/historical.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Historical features</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
["moz-blob", "moz-chunked-text", "moz-chunked-arraybuffer"].forEach(function(rt) {
|
||||
test(function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.responseType = rt;
|
||||
assert_equals(xhr.responseType, "");
|
||||
}, "Support for responseType = " + rt);
|
||||
});
|
||||
</script>
|
|
@ -26,8 +26,8 @@
|
|||
client = new ifr.contentWindow.XMLHttpRequest();
|
||||
count++;
|
||||
// Important to do a normal navigation, not a reload.
|
||||
win.location.href = "resources/init.htm";
|
||||
}, 100);
|
||||
win.location.href = "resources/init.htm?avoid-replace";
|
||||
}, 0);
|
||||
}
|
||||
doc.body.appendChild(ifr);
|
||||
} else if(1 == count) {
|
||||
|
|
|
@ -5,7 +5,7 @@ def main(request, response):
|
|||
("Access-Control-Allow-Credentials", "true"),
|
||||
("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"),
|
||||
("Access-Control-Allow-Headers", "x-test, x-foo"),
|
||||
("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length")]
|
||||
("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length, x-request-data")]
|
||||
|
||||
if "delay" in request.GET:
|
||||
delay = int(request.GET.first("delay"))
|
||||
|
@ -15,5 +15,6 @@ def main(request, response):
|
|||
headers.append(("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"))
|
||||
headers.append(("X-Request-Content-Length", request.headers.get("Content-Length", "NO")))
|
||||
headers.append(("X-Request-Content-Type", request.headers.get("Content-Type", "NO")))
|
||||
headers.append(("X-Request-Data", request.body))
|
||||
|
||||
return headers, "Test"
|
||||
|
|
|
@ -22,53 +22,56 @@
|
|||
}
|
||||
|
||||
function getNextEvent(arr) {
|
||||
var eventStr = arr.shift();
|
||||
var event = { str: arr.shift() };
|
||||
|
||||
// we can only handle strings, numbers (readystates) and undefined
|
||||
if (eventStr === undefined) {
|
||||
if (event.str === undefined) {
|
||||
return event;
|
||||
}
|
||||
if (typeof eventStr !== "string") {
|
||||
if (Number.isInteger(eventStr)) {
|
||||
eventStr = "readystatechange(" + eventStr + ")";
|
||||
|
||||
if (typeof event.str !== "string") {
|
||||
if (Number.isInteger(event.str)) {
|
||||
event.state = event.str;
|
||||
event.str = "readystatechange(" + event.str + ")";
|
||||
} else {
|
||||
throw "Test error: unexpected event type " + eventStr;
|
||||
throw "Test error: unexpected event type " + event.str;
|
||||
}
|
||||
}
|
||||
|
||||
// parse out the general type, loaded and total values
|
||||
var type = eventStr.type = eventStr.split("(")[0].split(".").pop();
|
||||
eventStr.mayFollowOptionalProgressEvents = type == "progress" ||
|
||||
type == "load" || type == "abort" || type == "error";
|
||||
var loadedAndTotal = eventStr.match(/\((\d)+,(\d)+/);
|
||||
var type = event.type = event.str.split("(")[0].split(".").pop();
|
||||
var loadedAndTotal = event.str.match(/.*\((\d+),(\d+),(true|false)\)/);
|
||||
if (loadedAndTotal) {
|
||||
eventStr.loaded = parseInt(loadedAndTotal[0]);
|
||||
eventStr.total = parseInt(loadedAndTotal[1]);
|
||||
event.loaded = parseInt(loadedAndTotal[1]);
|
||||
event.total = parseInt(loadedAndTotal[2]);
|
||||
event.lengthComputable = loadedAndTotal[3] == "true";
|
||||
}
|
||||
|
||||
return eventStr;
|
||||
return event;
|
||||
}
|
||||
|
||||
global.assert_xhr_event_order_matches = function(expected) {
|
||||
var recorded = recorded_xhr_events;
|
||||
var lastRecordedLoaded = -1;
|
||||
|
||||
while(expected.length && recorded.length) {
|
||||
var currentExpected = getNextEvent(expected),
|
||||
currentRecorded = getNextEvent(recorded);
|
||||
|
||||
// skip to the last progress event if we've hit one
|
||||
while (recorded.length && currentRecorded.type == "progress") {
|
||||
assert_greater(currentRecorded.loaded, lastRecordedLoaded,
|
||||
"progress event 'loaded' values must only increase");
|
||||
// skip to the last progress event if we've hit one (note the next
|
||||
// event after a progress event should be a LOADING readystatechange,
|
||||
// if there are multiple progress events in a row).
|
||||
while (recorded.length && currentRecorded.type == "progress" &&
|
||||
parseInt(recorded) === 3) {
|
||||
assert_greater_than(currentRecorded.loaded, lastRecordedLoaded,
|
||||
"progress event 'loaded' values must only increase");
|
||||
lastRecordedLoaded = currentRecorded.loaded;
|
||||
currentRecorded = getNextEvent(recorded);
|
||||
}
|
||||
if (currentRecorded.type == "loadstart") {
|
||||
if (currentRecorded.type == "loadend") {
|
||||
recordedProgressCount = 0;
|
||||
lastRecordedLoaded = -1;
|
||||
}
|
||||
|
||||
assert_equals(currentRecorded, currentExpected);
|
||||
assert_equals(currentRecorded.str, currentExpected.str);
|
||||
}
|
||||
if (recorded.length) {
|
||||
throw "\nUnexpected extra events: " + recorded.join(", ");
|
||||
|
|
|
@ -9,28 +9,60 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function redirect(code) {
|
||||
var test = async_test(document.title + " (" + code + ")")
|
||||
function extractBody(body) {
|
||||
if (body === null) {
|
||||
return { body: "", type: "NO" };
|
||||
}
|
||||
|
||||
if (typeof body == "string") {
|
||||
return { body: body, type: "text/plain;charset=UTF-8" };
|
||||
}
|
||||
|
||||
if (body instanceof Uint8Array) {
|
||||
var arr = Array.prototype.slice.call(body);
|
||||
return { body: String.fromCharCode.apply(null, arr), type: "NO" }
|
||||
}
|
||||
|
||||
return { body: "EXTRACT NOT IMPLEMENTED",
|
||||
type: "EXTRACT NOT IMPLEMENTED" }
|
||||
}
|
||||
|
||||
function redirect(code, name = code, method = "GET", body = null, setExplicitType = true) {
|
||||
var test = async_test(document.title + " (" + name + ")")
|
||||
test.step(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.onreadystatechange = function() {
|
||||
test.step(function() {
|
||||
if(client.readyState == 4) {
|
||||
assert_equals(client.getResponseHeader("x-request-method"), "GET")
|
||||
assert_equals(client.getResponseHeader("x-request-content-type"), "application/x-pony")
|
||||
test.done()
|
||||
if (client.readyState == 4) {
|
||||
assert_equals(client.status, 200);
|
||||
assert_equals(client.getResponseHeader("x-request-method"),
|
||||
method);
|
||||
var { body: expectedBody, type: expectedType } = extractBody(body);
|
||||
if (setExplicitType) {
|
||||
expectedType = "application/x-pony";
|
||||
}
|
||||
assert_equals(client.getResponseHeader("x-request-content-type"),
|
||||
expectedType);
|
||||
assert_equals(client.getResponseHeader("x-request-data"),
|
||||
expectedBody);
|
||||
test.done();
|
||||
}
|
||||
})
|
||||
}
|
||||
client.open("GET", "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+"&code=" + code)
|
||||
client.setRequestHeader("Content-Type", "application/x-pony")
|
||||
client.send(null)
|
||||
client.open(method, "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+"&code=" + code)
|
||||
if (setExplicitType) {
|
||||
client.setRequestHeader("Content-Type", "application/x-pony")
|
||||
}
|
||||
client.send(body)
|
||||
})
|
||||
}
|
||||
redirect("301")
|
||||
redirect("302")
|
||||
redirect("303")
|
||||
redirect("307")
|
||||
redirect("307", "307 post with null", "POST", null, false);
|
||||
redirect("307", "307 post with string", "POST", "hello", false);
|
||||
redirect("307", "307 post with typed array", "POST", new Uint8Array([65, 66, 67]), false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
assert_throws("SyntaxError", function() { client.setRequestHeader("x-test", value) }, ' given value ' + value+', ');
|
||||
});
|
||||
}
|
||||
try_value("t\x00t");
|
||||
try_value("t\rt");
|
||||
try_value("t\nt");
|
||||
try_value("t\bt");
|
||||
try_value("\x7f");
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest();
|
||||
client.open("GET", "...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue