mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fetch cancellation: Send cancellation message whenever XHR needs to abort a fetch
This commit is contained in:
parent
87e4c15280
commit
27457e4d84
1 changed files with 6 additions and 0 deletions
|
@ -1023,6 +1023,12 @@ impl XMLHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn terminate_ongoing_fetch(&self) {
|
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();
|
let GenerationId(prev_id) = self.generation_id.get();
|
||||||
self.generation_id.set(GenerationId(prev_id + 1));
|
self.generation_id.set(GenerationId(prev_id + 1));
|
||||||
self.response_status.set(Ok(()));
|
self.response_status.set(Ok(()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue