diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-10-04 09:46:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 09:46:11 -0500 |
commit | d42235ee905acf6bea7f5983c77124b8be9656fc (patch) | |
tree | 4aa4044d8e777b7fab09913a2801205156dafac7 /components/script/dom/xmlhttprequest.rs | |
parent | d067f469d07ced138f9a63d1bdfc83fbc201a62f (diff) | |
parent | fe8749eae68fbcde9bc953a4c1c0b626f5f186cb (diff) | |
download | servo-d42235ee905acf6bea7f5983c77124b8be9656fc.tar.gz servo-d42235ee905acf6bea7f5983c77124b8be9656fc.zip |
Auto merge of #13485 - mathieuh:xhr-event, r=jdm
Make readystatechange fire more often (fixes #13481)
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13481 (github issue number if applicable).
<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13485)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 4643921bc2d..caebbddd09e 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -973,9 +973,16 @@ impl XMLHttpRequest { *self.response.borrow_mut() = partial_response; if !self.sync.get() { if self.ready_state.get() == XMLHttpRequestState::HeadersReceived { - self.change_ready_state(XMLHttpRequestState::Loading); - return_if_fetch_was_terminated!(); + self.ready_state.set(XMLHttpRequestState::Loading); } + let global = self.global(); + let event = Event::new( + global.r(), + atom!("readystatechange"), + EventBubbles::DoesNotBubble, + EventCancelable::Cancelable); + event.fire(self.upcast()); + return_if_fetch_was_terminated!(); self.dispatch_response_progress_event(atom!("progress")); } }, |