Auto merge of #19274 - Manishearth:xhr-cancel, r=jdm

Fetch cancellation

This PR implements cancellation for fetch, and uses it for XHR. This means that fetch clients can now send a message to the fetch task asking for the network request to be aborted.

Previously, clients like XHR had abort functionality but would implement it by simply ignoring future messages from the network task; and would not actually cancel the network fetch.

<!-- 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/19274)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-11-20 20:48:17 -06:00 committed by GitHub
commit 00b3612fe9
12 changed files with 98 additions and 31 deletions

View file

@ -109,7 +109,7 @@ pub fn Fetch(global: &GlobalScope, input: RequestInfo, init: RootedTraceableBox<
listener.notify_fetch(message.to().unwrap());
}));
core_resource_thread.send(
NetTraitsFetch(request_init, FetchChannels::ResponseMsg(action_sender))).unwrap();
NetTraitsFetch(request_init, FetchChannels::ResponseMsg(action_sender, None))).unwrap();
promise
}