Bug 823124: Add diagnostic (and otherwise good-to-have) assertion that non-root rule nodes must have a non-null rule (and vice-versa).
authorL. David Baron <dbaron@dbaron.org>
Fri, 21 Dec 2012 14:36:53 -0500
changeset 126174 a836a0d544dafe562c042cb7172a606200a826b1
parent 126173 e364512a658fe9dd20e711bd9b93893aee2045d1
child 126175 50b3e25c750d13ced66a71931be1c0ea1e04303b
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs823124
milestone20.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 823124: Add diagnostic (and otherwise good-to-have) assertion that non-root rule nodes must have a non-null rule (and vice-versa).
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1294,16 +1294,19 @@ nsRuleNode::nsRuleNode(nsPresContext* aC
   : mPresContext(aContext),
     mParent(aParent),
     mRule(aRule),
     mDependentBits((uint32_t(aLevel) << NS_RULE_NODE_LEVEL_SHIFT) |
                    (aIsImportant ? NS_RULE_NODE_IS_IMPORTANT : 0)),
     mNoneBits(0),
     mRefCnt(0)
 {
+  NS_ABORT_IF_FALSE(IsRoot() == !aRule,
+                    "non-root rule nodes must have a rule");
+
   mChildren.asVoid = nullptr;
   MOZ_COUNT_CTOR(nsRuleNode);
   NS_IF_ADDREF(mRule);
 
   NS_ASSERTION(IsRoot() || GetLevel() == aLevel, "not enough bits");
   NS_ASSERTION(IsRoot() || IsImportantRule() == aIsImportant, "yikes");
   /* If IsRoot(), then aContext->StyleSet() is typically null at this
      point.  In any case, we don't want to treat the root rulenode as