mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make readystatechange fire more often (fixes#13481)
This commit is contained in:
parent
c7e1a575a5
commit
fe8749eae6
2 changed files with 11 additions and 4 deletions
|
@ -974,9 +974,16 @@ impl XMLHttpRequest {
|
||||||
*self.response.borrow_mut() = partial_response;
|
*self.response.borrow_mut() = partial_response;
|
||||||
if !self.sync.get() {
|
if !self.sync.get() {
|
||||||
if self.ready_state.get() == XMLHttpRequestState::HeadersReceived {
|
if self.ready_state.get() == XMLHttpRequestState::HeadersReceived {
|
||||||
self.change_ready_state(XMLHttpRequestState::Loading);
|
self.ready_state.set(XMLHttpRequestState::Loading);
|
||||||
return_if_fetch_was_terminated!();
|
|
||||||
}
|
}
|
||||||
|
let global = self.global();
|
||||||
|
let event = Event::new(
|
||||||
|
global.r(),
|
||||||
|
atom!("readystatechange"),
|
||||||
|
EventBubbles::DoesNotBubble,
|
||||||
|
EventCancelable::Cancelable);
|
||||||
|
event.fire(self.upcast());
|
||||||
|
return_if_fetch_was_terminated!();
|
||||||
self.dispatch_response_progress_event(atom!("progress"));
|
self.dispatch_response_progress_event(atom!("progress"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>XMLHttpRequest: the LOADING state change should only happen once</title>
|
<title>XMLHttpRequest: the LOADING state change may be emitted multiple times</title>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[10]/dt[1]">
|
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[10]/dt[1]">
|
||||||
|
@ -26,7 +26,7 @@ test.step(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.readyState === 4) {
|
if (client.readyState === 4) {
|
||||||
assert_equals(countedLoading, 1, "LOADING state change may only be emitted once");
|
assert_equals(countedLoading, 10, "LOADING state change may be emitted multiple times");
|
||||||
|
|
||||||
test.done();
|
test.done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue