Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -126,7 +126,8 @@ impl Actor for ConsoleActor {
self.pipeline,
message_types,
chan,
)).unwrap();
))
.unwrap();
let messages = port
.recv()
.map_err(|_| ())?
@ -135,7 +136,8 @@ impl Actor for ConsoleActor {
let json_string = message.encode().unwrap();
let json = serde_json::from_str::<Value>(&json_string).unwrap();
json.as_object().unwrap().to_owned()
}).collect();
})
.collect();
let msg = GetCachedMessagesReply {
from: self.name(),
@ -196,7 +198,8 @@ impl Actor for ConsoleActor {
self.pipeline,
input.clone(),
chan,
)).unwrap();
))
.unwrap();
//TODO: extract conversion into protocol module or some other useful place
let result = match port.recv().map_err(|_| ())? {

View file

@ -42,7 +42,7 @@ impl Actor for DeviceActor {
value: SystemInfo {
apptype: "servo".to_string(),
platformVersion: "63.0".to_string(),
}
},
};
stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@ -73,12 +73,11 @@ impl DeviceActor {
.into_iter()
.collect(),
),
)].into_iter()
)]
.into_iter()
.collect(),
),
}],
}
}
}

View file

@ -111,14 +111,16 @@ impl Actor for NodeActor {
.iter()
.map(|json_mod| {
serde_json::from_str(&serde_json::to_string(json_mod).unwrap()).unwrap()
}).collect();
})
.collect();
self.script_chan
.send(ModifyAttribute(
self.pipeline,
registry.actor_to_script(target.to_owned()),
modifications,
)).unwrap();
))
.unwrap();
let reply = ModifyAttributeReply { from: self.name() };
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
@ -228,7 +230,8 @@ impl NodeInfoToProtocol for NodeInfo {
namespace: attr.namespace,
name: attr.name,
value: attr.value,
}).collect(),
})
.collect(),
pseudoClassLocks: vec![], //TODO get this data from script
@ -324,7 +327,8 @@ impl Actor for WalkerActor {
self.pipeline,
registry.actor_to_script(target.to_owned()),
tx,
)).unwrap();
))
.unwrap();
let children = rx.recv().unwrap().ok_or(())?;
let msg = ChildrenReply {
@ -334,7 +338,8 @@ impl Actor for WalkerActor {
.into_iter()
.map(|child| {
child.encode(registry, true, self.script_chan.clone(), self.pipeline)
}).collect(),
})
.collect(),
from: self.name(),
};
stream.write_json_packet(&msg);
@ -498,7 +503,8 @@ impl Actor for PageStyleActor {
self.pipeline,
registry.actor_to_script(target.to_owned()),
tx,
)).unwrap();
))
.unwrap();
let ComputedNodeLayout {
display,
position,

View file

@ -33,7 +33,7 @@ struct HttpRequest {
struct HttpResponse {
headers: Option<HeaderMap>,
status: Option<(StatusCode, String)>,
body: Option<Vec<u8>>
body: Option<Vec<u8>>,
}
pub struct NetworkEventActor {
@ -192,7 +192,10 @@ impl Actor for NetworkEventActor {
let value = &value.to_str().unwrap().to_string();
rawHeadersString = rawHeadersString + name.as_str() + ":" + &value + "\r\n";
headersSize += name.as_str().len() + value.len();
headers.push(Header { name: name.as_str().to_owned(), value: value.to_owned() });
headers.push(Header {
name: name.as_str().to_owned(),
value: value.to_owned(),
});
}
let msg = GetRequestHeadersReply {
from: self.name(),
@ -376,8 +379,13 @@ impl NetworkEventActor {
// TODO: Send the correct values for all these fields.
let hSizeOption = self.response.headers.as_ref().map(|headers| headers.len());
let hSize = hSizeOption.unwrap_or(0);
let (status_code, status_message) = self.response.status.as_ref()
.map_or((0, "".to_owned()), |(code, text)| (code.as_u16(), text.clone()));
let (status_code, status_message) = self
.response
.status
.as_ref()
.map_or((0, "".to_owned()), |(code, text)| {
(code.as_u16(), text.clone())
});
// TODO: Send the correct values for remoteAddress and remotePort and http_version.
ResponseStartMsg {
httpVersion: "HTTP/1.1".to_owned(),
@ -395,7 +403,7 @@ impl NetworkEventActor {
if let Some(ref headers) = self.response.headers {
mString = match headers.typed_get::<ContentType>() {
Some(ct) => ct.to_string(),
_ => "".to_owned()
_ => "".to_owned(),
};
}
// TODO: Set correct values when response's body is sent to the devtools in http_loader.
@ -436,10 +444,9 @@ impl NetworkEventActor {
}
pub fn request_headers(&self) -> RequestHeadersMsg {
let size = self.request
.headers
.iter()
.fold(0, |acc, (name, value)| acc + name.as_str().len() + value.len());
let size = self.request.headers.iter().fold(0, |acc, (name, value)| {
acc + name.as_str().len() + value.len()
});
RequestHeadersMsg {
headers: self.request.headers.len(),
headersSize: size,
@ -449,7 +456,7 @@ impl NetworkEventActor {
pub fn request_cookies(&self) -> RequestCookiesMsg {
let cookies_size = match self.request.headers.typed_get::<Cookie>() {
Some(ref cookie) => cookie.len(),
_ => 0
_ => 0,
};
RequestCookiesMsg {
cookies: cookies_size,

View file

@ -106,7 +106,8 @@ impl PerformanceActor {
vec![(
"type".to_owned(),
Value::String("canCurrentlyRecord".to_owned()),
)].into_iter()
)]
.into_iter()
.collect(),
),
response: Value::Object(
@ -117,7 +118,8 @@ impl PerformanceActor {
.into_iter()
.collect(),
),
)].into_iter()
)]
.into_iter()
.collect(),
),
}],

View file

@ -30,4 +30,3 @@ impl StyleSheetsActor {
StyleSheetsActor { name: name }
}
}

View file

@ -169,7 +169,8 @@ impl TimelineActor {
emitter.send(markers);
thread::sleep(Duration::from_millis(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT));
}).expect("Thread spawning failed");
})
.expect("Thread spawning failed");
}
}
@ -195,7 +196,8 @@ impl Actor for TimelineActor {
self.pipeline,
self.marker_types.clone(),
tx,
)).unwrap();
))
.unwrap();
*self.stream.borrow_mut() = stream.try_clone().ok();
@ -248,7 +250,8 @@ impl Actor for TimelineActor {
.send(DropTimelineMarkers(
self.pipeline,
self.marker_types.clone(),
)).unwrap();
))
.unwrap();
if let Some(ref actor_name) = *self.framerate_actor.borrow() {
registry.drop_actor_later(actor_name.clone());