diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index bbb2d0201f6..de30bb00ee4 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -9,6 +9,7 @@ use selectors::matching::{SelectorMap, Rule}; use selectors::matching::DeclarationBlock as GenericDeclarationBlock; use selectors::parser::PseudoElement; use selectors::tree::TNode; +use std::process; use util::resource_files::read_resource_file; use util::smallvec::VecLike; @@ -59,13 +60,21 @@ impl Stylist { // FIXME: presentational-hints.css should be at author origin with zero specificity. // (Does it make a difference?) for &filename in ["user-agent.css", "servo.css", "presentational-hints.css"].iter() { - let ua_stylesheet = Stylesheet::from_bytes( - &read_resource_file(&[filename]).unwrap(), - Url::parse(&format!("chrome:///{:?}", filename)).unwrap(), - None, - None, - Origin::UserAgent); - stylist.add_stylesheet(ua_stylesheet); + match read_resource_file(&[filename]) { + Ok(res) => { + let ua_stylesheet = Stylesheet::from_bytes( + &res, + Url::parse(&format!("chrome:///{:?}", filename)).unwrap(), + None, + None, + Origin::UserAgent); + stylist.add_stylesheet(ua_stylesheet); + } + Err(..) => { + error!("Stylist::new() failed at loading {}!", filename); + process::exit(1); + } + } } stylist }