Added devtools support to fetch for XHR + Manish's XHR ident fix

added unit test for request fetch with devtools

added devtools/fetch test
This commit is contained in:
ddh 2016-07-14 20:29:32 +01:00
parent 45209b7ffe
commit db808ca75d
9 changed files with 213 additions and 74 deletions

View file

@ -574,7 +574,7 @@ impl CoreResourceManager {
return
}
};
debug!("resource_thread: loading url: {}", load_data.url);
debug!("loading url: {}", load_data.url);
loader.call_box((load_data,
consumer,
@ -593,6 +593,7 @@ impl CoreResourceManager {
blocked_content: BLOCKED_CONTENT_RULES.clone(),
};
let ua = self.user_agent.clone();
let dc = self.devtools_chan.clone();
spawn_named(format!("fetch thread for {}", init.url), move || {
let request = Request::from_init(init);
// XXXManishearth: Check origin against pipeline id (also ensure that the mode is allowed)
@ -600,7 +601,7 @@ impl CoreResourceManager {
// todo referrer policy?
// todo service worker stuff
let mut target = Some(Box::new(sender) as Box<FetchTaskTarget + Send + 'static>);
let context = FetchContext { state: http_state, user_agent: ua };
let context = FetchContext { state: http_state, user_agent: ua, devtools_chan: dc };
fetch(Rc::new(request), &mut target, context);
})
}