mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Propagating the load errors from network loader
This commit is contained in:
parent
8d988f20c1
commit
5e6f32a59b
15 changed files with 208 additions and 152 deletions
|
@ -183,15 +183,21 @@ impl FontCache {
|
|||
ROUTER.add_route(data_receiver.to_opaque(), box move |message| {
|
||||
let response: ResponseAction = message.to().unwrap();
|
||||
match response {
|
||||
ResponseAction::HeadersAvailable(metadata) => {
|
||||
let is_response_valid =
|
||||
metadata.content_type.as_ref().map_or(false, |content_type| {
|
||||
let mime = &content_type.0;
|
||||
is_supported_font_type(&mime.0, &mime.1)
|
||||
});
|
||||
info!("{} font with MIME type {:?}",
|
||||
ResponseAction::HeadersAvailable(meta_result) => {
|
||||
let is_response_valid = match meta_result {
|
||||
Ok(ref metadata) => {
|
||||
metadata.content_type.as_ref().map_or(false, |content_type| {
|
||||
let mime = &content_type.0;
|
||||
is_supported_font_type(&mime.0, &mime.1)
|
||||
})
|
||||
}
|
||||
Err(_) => false,
|
||||
};
|
||||
|
||||
info!("{} font with MIME type {}",
|
||||
if is_response_valid { "Loading" } else { "Ignoring" },
|
||||
metadata.content_type);
|
||||
meta_result.map(|ref meta| format!("{:?}", meta.content_type))
|
||||
.unwrap_or(format!("<Network Error>")));
|
||||
*response_valid.lock().unwrap() = is_response_valid;
|
||||
}
|
||||
ResponseAction::DataAvailable(new_bytes) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue