mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #9562 - timvandermeij:setresponsetype-spec, r=KiChjang
Make step 3 of XHR's SetResponseType method match the specification Fixes #9552. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9562) <!-- Reviewable:end -->
This commit is contained in:
commit
2f52a168ca
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
|
// https://xhr.spec.whatwg.org/#the-responsetype-attribute
|
||||||
fn SetResponseType(&self, response_type: XMLHttpRequestResponseType) -> ErrorResult {
|
fn SetResponseType(&self, response_type: XMLHttpRequestResponseType) -> ErrorResult {
|
||||||
match self.global() {
|
match self.global() {
|
||||||
GlobalRoot::Worker(_) if response_type == XMLHttpRequestResponseType::Document
|
GlobalRoot::Worker(_) if response_type == XMLHttpRequestResponseType::Document => return Ok(()),
|
||||||
=> return Ok(()),
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
match self.ready_state.get() {
|
match self.ready_state.get() {
|
||||||
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => Err(Error::InvalidState),
|
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => Err(Error::InvalidState),
|
||||||
_ if self.sync.get() => Err(Error::InvalidAccess),
|
|
||||||
_ => {
|
_ => {
|
||||||
self.response_type.set(response_type);
|
if let (GlobalRoot::Window(_), true) = (self.global(), self.sync.get()) {
|
||||||
Ok(())
|
Err(Error::InvalidAccess)
|
||||||
|
} else {
|
||||||
|
self.response_type.set(response_type);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue