var url_200 = window.location.href; var url_404 = url_200.replace(/[^/]+$/, "this_file_is_not_going_to_be_there.dummy"); var url_connection_error = url_200.replace(/^(\w+:\/\/[^/]+?)(:\d+)?\//, "$1:9546/");
// List of tests: name of the test, URL to be requested, expected sequence
// of events and optionally a function to be called from readystatechange handler.
// Numbers in the list of events are values of XMLHttpRequest.readyState
// when readystatechange event is triggered. var tests = [
["200 OK", url_200, [1, 2, 3, 4, "load"], null],
["404 Not Found", url_404, [1, 2, 3, 4, "load"], null],
["connection error", url_connection_error, [1, 4, "error"], null],
["abort() call on readyState = 1", url_200, [1, 4], null, doAbort1],
["abort() call on readyState = 2", url_200, [1, 2, 4], doAbort2],
];
var testName = null; var currentState = 0; var currentSequence = null; var expectedSequence = null; var currentCallback = null; var finalizeTimeoutID = null;
var request = null;
runNextTest();
function doAbort1() {
if (request.readyState == 1)
request.abort();
}
function doAbort2() {
if (request.readyState == 2)
request.abort();
}
/* Utility functions */
function runNextTest() {
if (tests.length) { var test = tests.shift();
if (currentState == 4) {
// Allow remaining event to fire but then we are finished with this test
// unless we get another onReadyStateChange in which case we'll cancel
// this timeout
finalizeTimeoutID = setTimeout(finalizeTest, 0);
}
if (currentCallback)
currentCallback();
}
function onLoad() {
currentSequence.push("load");
}
function onError() {
currentSequence.push("error");
}
function compareArrays(array1, array2) {
if (array1.length != array2.length)
return false;
for (var i = 0; i < array1.length; i++)
if (array1[i] != array2[i])
return false;
return true;
}
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.