mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make step 3 of XHR's SetResponseType method match the specification
This commit is contained in:
parent
289232ef61
commit
816c65aab0
1 changed files with 7 additions and 5 deletions
|
@ -675,16 +675,18 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
|
|||
// https://xhr.spec.whatwg.org/#the-responsetype-attribute
|
||||
fn SetResponseType(&self, response_type: XMLHttpRequestResponseType) -> ErrorResult {
|
||||
match self.global() {
|
||||
GlobalRoot::Worker(_) if response_type == XMLHttpRequestResponseType::Document
|
||||
=> return Ok(()),
|
||||
GlobalRoot::Worker(_) if response_type == XMLHttpRequestResponseType::Document => return Ok(()),
|
||||
_ => {}
|
||||
}
|
||||
match self.ready_state.get() {
|
||||
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => Err(Error::InvalidState),
|
||||
_ if self.sync.get() => Err(Error::InvalidAccess),
|
||||
_ => {
|
||||
self.response_type.set(response_type);
|
||||
Ok(())
|
||||
if let (GlobalRoot::Window(_), true) = (self.global(), self.sync.get()) {
|
||||
Err(Error::InvalidAccess)
|
||||
} else {
|
||||
self.response_type.set(response_type);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue