Bug 1371488 part 1 - Don't create empty servo sheet for stylesheet of @import rule when loading failed. r?emilio
MozReview-Commit-ID: EnjVQIe1oeY
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -171,17 +171,22 @@ ServoStyleSheet::ParseSheet(css::Loader*
Inner()->mURLData = extraData.forget();
return NS_OK;
}
void
ServoStyleSheet::LoadFailed()
{
- Inner()->mSheet = Servo_StyleSheet_Empty(mParsingMode).Consume();
+ if (!Inner()->mSheet) {
+ // Only create empty stylesheet if this is a top level stylesheet.
+ // The raw sheet for stylesheet of @import rule is already set in
+ // loader, and we should not touch it.
+ Inner()->mSheet = Servo_StyleSheet_Empty(mParsingMode).Consume();
+ }
Inner()->mURLData = URLExtraData::Dummy();
}
nsresult
ServoStyleSheet::ReparseSheet(const nsAString& aInput)
{
// TODO(kuoe0): Bug 1367996 - Need to call document notification
// (StyleRuleAdded() and StyleRuleRemoved()) like what we do in