mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Avoid crashing when calling insertRule("@import ...") on a detached sheet.
This should unblock the fuzzers for now, though it's not the ideal solution. It's the only reasonably easy solution to unblock them though, I think. We should probably always keep track of the document a stylesheet was associated with. We'll need that for constructible stylesheets anyway. That requires some though on how to get the cycle-collection and such right, though, and I wouldn't be able to write or land that ASAP. Differential Revision: https://phabricator.services.mozilla.com/D23584
This commit is contained in:
parent
95ee1a5adf
commit
9f4643ac24
1 changed files with 7 additions and 0 deletions
|
@ -189,6 +189,13 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedImportRule))
|
||||
}
|
||||
|
||||
// FIXME(emilio): We should always be able to have a loader
|
||||
// around! See bug 1533783.
|
||||
if self.loader.is_none() {
|
||||
error!("Saw @import rule, but no way to trigger the load");
|
||||
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedImportRule))
|
||||
}
|
||||
|
||||
let url_string = input.expect_url_or_string()?.as_ref().to_owned();
|
||||
let url = CssUrl::parse_from_string(url_string, &self.context);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue