Bug 1290335: Improve error message of the anonymous box assertion.
MozReview-Commit-ID: 6cJSBz03Yji
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -5,16 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ServoStyleSet.h"
#include "mozilla/ServoRestyleManager.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsIDocumentInlines.h"
+#include "nsPrintfCString.h"
#include "nsStyleContext.h"
#include "nsStyleSet.h"
using namespace mozilla;
using namespace mozilla::dom;
ServoStyleSet::ServoStyleSet()
: mPresContext(nullptr)
@@ -185,17 +186,25 @@ ServoStyleSet::ResolveAnonymousBoxStyle(
bool skipFixup = aFlags & nsStyleSet::eSkipParentDisplayBasedStyleFixup;
ServoComputedValues* parentStyle =
aParentContext ? aParentContext->StyleSource().AsServoComputedValues()
: nullptr;
RefPtr<ServoComputedValues> computedValues =
dont_AddRef(Servo_GetComputedValuesForAnonymousBox(parentStyle, aPseudoTag,
mRawSet.get()));
- MOZ_ASSERT(computedValues);
+#ifdef DEBUG
+ if (!computedValues) {
+ nsString pseudo;
+ aPseudoTag->ToString(pseudo);
+ NS_ERROR(nsPrintfCString("stylo: could not get anon-box: %s",
+ NS_ConvertUTF16toUTF8(pseudo).get()).get());
+ MOZ_CRASH();
+ }
+#endif
return NS_NewStyleContext(aParentContext, mPresContext, aPseudoTag,
CSSPseudoElementType::AnonBox,
computedValues.forget(), skipFixup);
}
// manage the set of style sheets in the style set
nsresult