mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
fix Stylist::add_quirks_mode_stylesheet() to not panic when resources cannot be loaded
This commit is contained in:
parent
1cf5dd212c
commit
082479344f
1 changed files with 14 additions and 6 deletions
|
@ -163,12 +163,20 @@ impl Stylist {
|
|||
}
|
||||
|
||||
pub fn add_quirks_mode_stylesheet(&mut self) {
|
||||
self.add_stylesheet(Stylesheet::from_bytes(
|
||||
&read_resource_file(&["quirks-mode.css"]).unwrap(),
|
||||
Url::parse("chrome:///quirks-mode.css").unwrap(),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent))
|
||||
match read_resource_file(&["quirks-mode.css"]) {
|
||||
Ok(res) => {
|
||||
self.add_stylesheet(Stylesheet::from_bytes(
|
||||
&res,
|
||||
Url::parse("chrome:///quirks-mode.css").unwrap(),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent));
|
||||
}
|
||||
Err(..) => {
|
||||
error!("Stylist::add_quirks_mode_stylesheet() failed at loading 'quirks-mode.css'!");
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_stylesheet(&mut self, stylesheet: Stylesheet) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue