mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Don't create a new XHR until the previous one is complete.
This commit is contained in:
parent
cea1760eb7
commit
5c29637bef
2 changed files with 5 additions and 4 deletions
|
@ -1,15 +1,16 @@
|
|||
function get_test_results(id) {
|
||||
async_test(function(test) {
|
||||
var timer = window.setInterval(test.step_func(loop), 100);
|
||||
test.step_timeout(loop, 100);
|
||||
function loop() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'stash.py?id=' + id);
|
||||
xhr.onreadystatechange = test.step_func(function() {
|
||||
xhr.onload = test.step_func(function() {
|
||||
assert_equals(xhr.status, 200);
|
||||
if (xhr.responseText) {
|
||||
assert_equals(xhr.responseText, "OK");
|
||||
test.done();
|
||||
window.clearTimeout(timer);
|
||||
} else {
|
||||
test.step_timeout(loop, 100);
|
||||
}
|
||||
});
|
||||
xhr.send();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue