Skip to content

Commit

Permalink
Make step 3 of XHR's SetResponseType method match the specification
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandermeij committed Feb 6, 2016
1 parent 289232e commit 816c65a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/script/dom/xmlhttprequest.rs
Expand Up @@ -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(())
}
}
}
}
Expand Down

0 comments on commit 816c65a

Please sign in to comment.