Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake step 3 of XHR's SetResponseType method match the specification #9562
Conversation
highfive
commented
Feb 5, 2016
|
@bors-servo r+ Looks good enough to me. Thanks for taking up the issue! |
|
|
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 code actually threw errors on the WPT tests:
|
| @@ -676,12 +676,12 @@ impl XMLHttpRequestMethods for XMLHttpRequest { | |||
| fn SetResponseType(&self, response_type: XMLHttpRequestResponseType) -> ErrorResult { | |||
| match self.global() { | |||
| GlobalRoot::Worker(_) if response_type == XMLHttpRequestResponseType::Document | |||
| => return Ok(()), | |||
| => return Ok(()), | |||
| GlobalRoot::Window(_) if self.sync.get() => return Err(Error::InvalidAccess), | |||
This comment has been minimized.
This comment has been minimized.
KiChjang
Feb 6, 2016
Member
I suspect that the test failures are due to the re-ordering of steps. The match-arm for GlobalRoot::Worker(_) above is Step 1, whereas the match-arm for GlobalRoot::Window(_) if self.sync.get() is Step 3, and down there the match for self.ready_state.get() is Step 2.
|
Aw, I had hoped that that would work. I have pushed an updated patch that executes the steps in the exact order as provided by the specification. Could you check this again and re-trigger the tests? |
| _ => {} | ||
| } | ||
| match self.global() { | ||
| GlobalRoot::Window(_) if self.sync.get() => Err(Error::InvalidAccess), |
This comment has been minimized.
This comment has been minimized.
KiChjang
Feb 6, 2016
Member
if let (GlobalRoot::Window(_), true) = (self.global(), self.sync.get()) { ... } else { ... }
This comment has been minimized.
This comment has been minimized.
| XMLHttpRequestState::Loading | XMLHttpRequestState::Done => Err(Error::InvalidState), | ||
| _ if self.sync.get() => Err(Error::InvalidAccess), | ||
| XMLHttpRequestState::Loading | XMLHttpRequestState::Done => return Err(Error::InvalidState), | ||
| _ => {} |
This comment has been minimized.
This comment has been minimized.
KiChjang
Feb 6, 2016
Member
The next check can be done here, so that we don't need an explicit return keyword.
This comment has been minimized.
This comment has been minimized.
|
@bors-servo try |
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 -->
|
@bors-servo r+ |
|
|
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 -->
|
|
|
@bors-servo retry |
|
|
|
|
|
@bors-servo retry |
|
|
|
|
timvandermeij commentedFeb 5, 2016
Fixes #9552.