diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index c62c93486fe0..ab69b798c126 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -473,10 +473,19 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const { int32_t weight = 0; - MOZ_ASSERT(!IsPseudoElement() || - mPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount || - (!mIDList && !mClassList && !mAttrList), - "if pseudo-elements can have ID, class or attribute selectors " +#ifdef MOZ_XUL + MOZ_ASSERT(!(IsPseudoElement() && + PseudoType() != nsCSSPseudoElements::ePseudo_XULTree && + mClassList), + "If non-XUL-tree pseudo-elements can have class selectors " + "after them, specificity calculation must be updated"); +#else + MOZ_ASSERT(!(IsPseudoElement() && mClassList), + "If pseudo-elements can have class selectors " + "after them, specificity calculation must be updated"); +#endif + MOZ_ASSERT(!(IsPseudoElement() && (mIDList || mAttrList)), + "If pseudo-elements can have id or attribute selectors " "after them, specificity calculation must be updated"); if (nullptr != mCasedTag) { @@ -488,6 +497,13 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const list = list->mNext; } list = mClassList; +#ifdef MOZ_XUL + // XUL tree pseudo-elements abuse mClassList to store some private + // data; ignore that. + if (PseudoType() == nsCSSPseudoElements::ePseudo_XULTree) { + list = nullptr; + } +#endif while (nullptr != list) { weight += 0x000100; list = list->mNext;