From 6fbd2aa5b7628bd47971806ddf438cd350a60bee Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Wed, 14 Sep 2016 10:59:17 -0700 Subject: [PATCH] Avoid deadlock in main_fetch --- components/net/fetch/methods.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 23fb67ce82b..1f3eb0e5a24 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -361,13 +361,14 @@ fn main_fetch(request: Rc, cache: &mut CORSCache, cors_flag: bool, } } } else if let Some(ref mut target) = *target { - if let ResponseBody::Done(ref vec) = *response.body.lock().unwrap() { + let body = response.body.lock().unwrap(); + if let ResponseBody::Done(ref vec) = *body { // in case there was no channel to wait for, the body was // obtained synchronously via basic_fetch for data/file/about/etc // We should still send the body across as a chunk target.process_response_chunk(vec.clone()); } else { - assert!(*response.body.lock().unwrap() == ResponseBody::Empty) + assert!(*body == ResponseBody::Empty) } }