do less on abort if not done

This commit is contained in:
Patrick Shaughnessy 2020-01-25 17:47:47 -05:00
parent 937efba0cd
commit 52d8336d7f
4 changed files with 15 additions and 29 deletions

View file

@ -758,7 +758,12 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
}
// Step 3
self.ready_state.set(XMLHttpRequestState::Unsent);
if self.ready_state.get() == XMLHttpRequestState::Done {
self.change_ready_state(XMLHttpRequestState::Unsent);
self.response_status.set(Err(()));
self.response.borrow_mut().clear();
self.response_headers.borrow_mut().clear();
}
}
// https://xhr.spec.whatwg.org/#the-responseurl-attribute
@ -961,6 +966,7 @@ impl XMLHttpRequest {
fn change_ready_state(&self, rs: XMLHttpRequestState) {
assert_ne!(self.ready_state.get(), rs);
self.ready_state.set(rs);
if rs != XMLHttpRequestState::Unsent {
let event = Event::new(
&self.global(),
atom!("readystatechange"),
@ -969,6 +975,7 @@ impl XMLHttpRequest {
);
event.fire(self.upcast());
}
}
fn process_headers_available(
&self,

View file

@ -1,9 +0,0 @@
[abort-during-open.any.worker.html]
[XMLHttpRequest: abort() during OPEN]
expected: FAIL
[abort-during-open.any.html]
[XMLHttpRequest: abort() during OPEN]
expected: FAIL

View file

@ -1,9 +0,0 @@
[abort-event-abort.any.html]
[XMLHttpRequest: The abort() method: do not fire abort event in OPENED state when send() flag is unset.]
expected: FAIL
[abort-event-abort.any.worker.html]
[XMLHttpRequest: The abort() method: do not fire abort event in OPENED state when send() flag is unset.]
expected: FAIL

View file

@ -1,8 +1,5 @@
[send-data-unexpected-tostring.htm]
type: testharness
[abort() called from data stringification]
expected: FAIL
[open() called from data stringification]
expected: FAIL