Bug 1323665 - Part 1: Adjust some ServoStyleSet assertions. r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Mon, 09 Jan 2017 17:42:52 +0800
changeset 328605 d832600dd8977ec6477c745b7515327b16cac86b
parent 328604 ddbb54e48d54c62350c1f58ca2138664e2efc8e1
child 328606 3c6af7904a1da4aad7484394bf34884792e265ec
push id85493
push userkwierso@gmail.com
push dateTue, 10 Jan 2017 00:45:12 +0000
treeherdermozilla-inbound@7822749b1b14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1323665
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1323665 - Part 1: Adjust some ServoStyleSet assertions. r=xidorn We're incorrectly asserting that a sheet is applicable when we remove it from the style set, but we'll actually cause the sheet to be not applicable just before we remove it from the style set. (Note how nsStyleSet doesn't assert this in RemoveStyleSheet.) Also, we were missing a corresponding assertion in AddDocStylesSheet. MozReview-Commit-ID: E5qwxwrA74F
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -317,17 +317,16 @@ ServoStyleSet::PrependStyleSheet(SheetTy
   return NS_OK;
 }
 
 nsresult
 ServoStyleSet::RemoveStyleSheet(SheetType aType,
                                 ServoStyleSheet* aSheet)
 {
   MOZ_ASSERT(aSheet);
-  MOZ_ASSERT(aSheet->IsApplicable());
   MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
 
   mSheets[aType].RemoveElement(aSheet);
 
   if (mRawSet) {
     // Maintain a mirrored list of sheets on the servo side.
     Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), aSheet->RawSheet(), !mBatching);
   }
@@ -412,16 +411,18 @@ ServoStyleSet::RemoveDocStyleSheet(Servo
 {
   return RemoveStyleSheet(SheetType::Doc, aSheet);
 }
 
 nsresult
 ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
                                 nsIDocument* aDocument)
 {
+  MOZ_ASSERT(aSheet->IsApplicable());
+
   RefPtr<StyleSheet> strong(aSheet);
 
   mSheets[SheetType::Doc].RemoveElement(aSheet);
 
   size_t index =
     aDocument->FindDocStyleSheetInsertionPoint(mSheets[SheetType::Doc], aSheet);
   mSheets[SheetType::Doc].InsertElementAt(index, aSheet);