Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch cancellation #19274

Merged
merged 6 commits into from Nov 21, 2017

Fetch cancellation: Send cancellation message whenever XHR needs to a…

…bort a fetch
  • Loading branch information
Manishearth committed Nov 18, 2017
commit 27457e4d84f6f3ef05dc9f7ee3f84fa82e0de9da
@@ -1023,6 +1023,12 @@ impl XMLHttpRequest {
}

fn terminate_ongoing_fetch(&self) {
if let Some(ref cancel_chan) = *self.cancellation_chan.borrow() {
// The receiver will be destroyed if the request has already completed;
// so we throw away the error. Cancellation is a courtesy call,
// we don't actually care if the other side heard.
let _ = cancel_chan.send(());
}
let GenerationId(prev_id) = self.generation_id.get();
self.generation_id.set(GenerationId(prev_id + 1));
self.response_status.set(Ok(()));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.