mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
1. Add an Option<Pipeline_id> field to the LoadData struct, and a corresponding parameter to LoadData::new()
2. Change addEvent in the NetworkEventActor to add_request and add_response
This commit is contained in:
parent
6e91ebb1fe
commit
01eb31ae8a
18 changed files with 152 additions and 151 deletions
|
@ -68,7 +68,7 @@ fn read_block<R: Read>(reader: &mut R) -> Result<ReadResult, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
fn load(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>,
|
||||
fn load(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>,
|
||||
cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>) {
|
||||
// FIXME: At the time of writing this FIXME, servo didn't have any central
|
||||
// location for configuration. If you're reading this and such a
|
||||
|
@ -143,7 +143,7 @@ reason: \"certificate verify failed\" }]))";
|
|||
) => {
|
||||
let mut image = resources_dir_path();
|
||||
image.push("badcert.html");
|
||||
let load_data = LoadData::new(Url::from_file_path(&*image).unwrap());
|
||||
let load_data = LoadData::new(Url::from_file_path(&*image).unwrap(), None);
|
||||
file_loader::factory(load_data, start_chan, classifier);
|
||||
return;
|
||||
},
|
||||
|
@ -200,15 +200,6 @@ reason: \"certificate verify failed\" }]))";
|
|||
info!("{:?}", load_data.data);
|
||||
}
|
||||
|
||||
let request_id = uuid::Uuid::new_v4().to_simple_string();
|
||||
let net_event = NetworkEvent::HttpRequest(
|
||||
load_data.url.clone(),
|
||||
load_data.method.clone(),
|
||||
load_data.headers.clone(),
|
||||
load_data.data.clone()
|
||||
);
|
||||
devtools_chan.as_ref().map(|chan| chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id.clone(), net_event)));
|
||||
|
||||
// Avoid automatically sending request body if a redirect has occurred.
|
||||
let writer = match load_data.data {
|
||||
Some(ref data) if iters == 1 => {
|
||||
|
@ -243,6 +234,18 @@ reason: \"certificate verify failed\" }]))";
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Send an HttpRequest message to devtools with a unique request_id
|
||||
// TODO: Do this only if load_data has some pipeline_id, and send the pipeline_id in the message
|
||||
let request_id = uuid::Uuid::new_v4().to_simple_string();
|
||||
if let Some(ref chan) = devtools_chan {
|
||||
let net_event = NetworkEvent::HttpRequest(load_data.url.clone(),
|
||||
load_data.method.clone(),
|
||||
load_data.headers.clone(),
|
||||
load_data.data.clone());
|
||||
chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id.clone(), net_event)).unwrap();
|
||||
}
|
||||
|
||||
let mut response = match writer.send() {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
|
@ -341,9 +344,12 @@ reason: \"certificate verify failed\" }]))";
|
|||
}
|
||||
}
|
||||
|
||||
println!("Http loader Response");
|
||||
let net_event_response = NetworkEvent::HttpResponse(metadata.headers.clone(), metadata.status.clone(), None);
|
||||
devtools_chan.as_ref().map(|chan| chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)));
|
||||
// Send an HttpResponse message to devtools with the corresponding request_id
|
||||
// TODO: Send this message only if load_data has a pipeline_id that is not None
|
||||
if let Some(ref chan) = devtools_chan {
|
||||
let net_event_response = NetworkEvent::HttpResponse(metadata.headers.clone(), metadata.status.clone(), None);
|
||||
chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)).unwrap();
|
||||
}
|
||||
|
||||
match encoding_str {
|
||||
Some(encoding) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue