mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +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) {
|
pub fn add_quirks_mode_stylesheet(&mut self) {
|
||||||
self.add_stylesheet(Stylesheet::from_bytes(
|
match read_resource_file(&["quirks-mode.css"]) {
|
||||||
&read_resource_file(&["quirks-mode.css"]).unwrap(),
|
Ok(res) => {
|
||||||
Url::parse("chrome:///quirks-mode.css").unwrap(),
|
self.add_stylesheet(Stylesheet::from_bytes(
|
||||||
None,
|
&res,
|
||||||
None,
|
Url::parse("chrome:///quirks-mode.css").unwrap(),
|
||||||
Origin::UserAgent))
|
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) {
|
pub fn add_stylesheet(&mut self, stylesheet: Stylesheet) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue