Bug 1127201 (attempt 2, part 2) - Remove remaining uses of NS_ABORT_IF_FALSE. r=Waldo.

For the poisoning in nsPresArena.cpp I made it print out the details, because
that seems useful. For the other I simply removed the printing of the
unexpected value because that seems less important; we have countless
assertions like that elsewhere in the codebase that don't print the unexpected
value.

--HG--
extra : rebase_source : 34bb135d34c67db8c1db1742a53ea84e472083c6
This commit is contained in:
Nicholas Nethercote 2015-02-09 17:05:37 -08:00
Родитель df2965c8ac
Коммит 6731149c55
4 изменённых файлов: 51 добавлений и 75 удалений

Просмотреть файл

@ -75,14 +75,18 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize)
char* limit = p + list->mEntrySize;
for (; p < limit; p += sizeof(uintptr_t)) {
uintptr_t val = *reinterpret_cast<uintptr_t*>(p);
NS_ABORT_IF_FALSE(val == mozPoisonValue(),
nsPrintfCString("PresArena: poison overwritten; "
"wanted %.16" PRIx64 " "
"found %.16" PRIx64 " "
"errors in bits %.16" PRIx64 " ",
uint64_t(mozPoisonValue()),
uint64_t(val),
uint64_t(mozPoisonValue() ^ val)).get());
if (val != mozPoisonValue()) {
MOZ_ReportAssertionFailure(
nsPrintfCString("PresArena: poison overwritten; "
"wanted %.16" PRIx64 " "
"found %.16" PRIx64 " "
"errors in bits %.16" PRIx64 " ",
uint64_t(mozPoisonValue()),
uint64_t(val),
uint64_t(mozPoisonValue() ^ val)).get(),
__FILE__, __LINE__);
MOZ_CRASH();
}
}
}
#endif

Просмотреть файл

@ -717,9 +717,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
const nsCSSValue *decorationStyle =
data->ValueFor(eCSSProperty_text_decoration_style);
NS_ABORT_IF_FALSE(decorationStyle->GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString("bad text-decoration-style unit %d",
decorationStyle->GetUnit()).get());
MOZ_ASSERT(decorationStyle->GetUnit() == eCSSUnit_Enumerated,
"bad text-decoration-style unit");
AppendValueToString(eCSSProperty_text_decoration_line, aValue,
aSerialization);
@ -747,18 +746,15 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
const nsCSSValue *transDelay =
data->ValueFor(eCSSProperty_transition_delay);
NS_ABORT_IF_FALSE(transDuration->GetUnit() == eCSSUnit_List ||
transDuration->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString("bad t-duration unit %d",
transDuration->GetUnit()).get());
NS_ABORT_IF_FALSE(transTiming->GetUnit() == eCSSUnit_List ||
transTiming->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString("bad t-timing unit %d",
transTiming->GetUnit()).get());
NS_ABORT_IF_FALSE(transDelay->GetUnit() == eCSSUnit_List ||
transDelay->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString("bad t-delay unit %d",
transDelay->GetUnit()).get());
MOZ_ASSERT(transDuration->GetUnit() == eCSSUnit_List ||
transDuration->GetUnit() == eCSSUnit_ListDep,
"bad t-duration unit");
MOZ_ASSERT(transTiming->GetUnit() == eCSSUnit_List ||
transTiming->GetUnit() == eCSSUnit_ListDep,
"bad t-timing unit");
MOZ_ASSERT(transDelay->GetUnit() == eCSSUnit_List ||
transDelay->GetUnit() == eCSSUnit_ListDep,
"bad t-delay unit");
const nsCSSValueList* dur = transDuration->GetListValue();
const nsCSSValueList* tim = transTiming->GetListValue();
@ -785,10 +781,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
aValue.Truncate();
}
} else {
NS_ABORT_IF_FALSE(transProp->GetUnit() == eCSSUnit_List ||
transProp->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString("bad t-prop unit %d",
transProp->GetUnit()).get());
MOZ_ASSERT(transProp->GetUnit() == eCSSUnit_List ||
transProp->GetUnit() == eCSSUnit_ListDep,
"bad t-prop unit");
const nsCSSValueList* pro = transProp->GetListValue();
for (;;) {
pro->mValue.AppendToString(eCSSProperty_transition_property,
@ -829,10 +824,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
for (uint32_t i = 0; i < numProps; ++i) {
values[i] = data->ValueFor(subprops[i]);
NS_ABORT_IF_FALSE(values[i]->GetUnit() == eCSSUnit_List ||
values[i]->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString("bad a-duration unit %d",
values[i]->GetUnit()).get());
MOZ_ASSERT(values[i]->GetUnit() == eCSSUnit_List ||
values[i]->GetUnit() == eCSSUnit_ListDep,
"bad a-duration unit");
lists[i] = values[i]->GetListValue();
}

Просмотреть файл

@ -4539,10 +4539,8 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
else {
// The parser will never create a list that is *all* URL values --
// that's invalid.
NS_ABORT_IF_FALSE(cursorUnit == eCSSUnit_List ||
cursorUnit == eCSSUnit_ListDep,
nsPrintfCString("unrecognized cursor unit %d",
cursorUnit).get());
MOZ_ASSERT(cursorUnit == eCSSUnit_List || cursorUnit == eCSSUnit_ListDep,
"unrecognized cursor unit");
const nsCSSValueList* list = cursorValue->GetListValue();
const nsCSSValueList* list2 = list;
nsIDocument* doc = aContext->PresContext()->Document();
@ -4958,9 +4956,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
transition->SetProperty(prop);
}
} else {
NS_ABORT_IF_FALSE(val.GetUnit() == eCSSUnit_All,
nsPrintfCString("Invalid transition property unit %d",
val.GetUnit()).get());
MOZ_ASSERT(val.GetUnit() == eCSSUnit_All,
"Invalid transition property unit");
transition->SetProperty(eCSSPropertyExtra_all_properties);
}
}
@ -5111,9 +5108,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
break;
}
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString("Invalid animation-name unit %d",
animName.list->mValue.GetUnit()).get());
MOZ_ASSERT(false, "Invalid animation-name unit");
}
}
@ -5148,10 +5143,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animDirection.unit == eCSSUnit_Unset) {
animation->SetDirection(NS_STYLE_ANIMATION_DIRECTION_NORMAL);
} else if (animDirection.list) {
NS_ABORT_IF_FALSE(animDirection.list->mValue.GetUnit() ==
eCSSUnit_Enumerated,
nsPrintfCString("Invalid animation-direction unit %d",
animDirection.list->mValue.GetUnit()).get());
MOZ_ASSERT(animDirection.list->mValue.GetUnit() == eCSSUnit_Enumerated,
"Invalid animation-direction unit");
animation->SetDirection(animDirection.list->mValue.GetIntValue());
}
@ -5168,10 +5161,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animFillMode.unit == eCSSUnit_Unset) {
animation->SetFillMode(NS_STYLE_ANIMATION_FILL_MODE_NONE);
} else if (animFillMode.list) {
NS_ABORT_IF_FALSE(animFillMode.list->mValue.GetUnit() ==
eCSSUnit_Enumerated,
nsPrintfCString("Invalid animation-fill-mode unit %d",
animFillMode.list->mValue.GetUnit()).get());
MOZ_ASSERT(animFillMode.list->mValue.GetUnit() == eCSSUnit_Enumerated,
"Invalid animation-fill-mode unit");
animation->SetFillMode(animFillMode.list->mValue.GetIntValue());
}
@ -5188,10 +5179,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animPlayState.unit == eCSSUnit_Unset) {
animation->SetPlayState(NS_STYLE_ANIMATION_PLAY_STATE_RUNNING);
} else if (animPlayState.list) {
NS_ABORT_IF_FALSE(animPlayState.list->mValue.GetUnit() ==
eCSSUnit_Enumerated,
nsPrintfCString("Invalid animation-play-state unit %d",
animPlayState.list->mValue.GetUnit()).get());
MOZ_ASSERT(animPlayState.list->mValue.GetUnit() == eCSSUnit_Enumerated,
"Invalid animation-play-state unit");
animation->SetPlayState(animPlayState.list->mValue.GetIntValue());
}
@ -6217,9 +6206,7 @@ SetBackgroundList(nsStyleContext* aStyleContext,
}
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString("unexpected unit %d",
aValue.GetUnit()).get());
MOZ_ASSERT(false, "unexpected unit");
}
if (aItemCount > aMaxItemCount)
@ -6288,9 +6275,7 @@ SetBackgroundPairList(nsStyleContext* aStyleContext,
}
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString("unexpected unit %d",
aValue.GetUnit()).get());
MOZ_ASSERT(false, "unexpected unit");
}
if (aItemCount > aMaxItemCount)
@ -6585,9 +6570,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
break;
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString("unrecognized shadow unit %d",
boxShadowValue->GetUnit()).get());
MOZ_ASSERT(false, "unrecognized shadow unit");
}
// border-width, border-*-width: length, enum, inherit
@ -7927,9 +7910,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
}
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString("unrecognized content unit %d",
contentValue->GetUnit()).get());
MOZ_ASSERT(false, "unrecognized content unit");
}
// counter-increment: [string [int]]+, none, inherit

Просмотреть файл

@ -1405,16 +1405,13 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType))),
"should have aPseudoElement only for certain pseudo elements");
NS_ABORT_IF_FALSE(!(aReplacements & ~(eRestyle_CSSTransitions |
eRestyle_CSSAnimations |
eRestyle_SVGAttrAnimations |
eRestyle_StyleAttribute |
eRestyle_Force |
eRestyle_ForceDescendants)),
// FIXME: Once bug 979133 lands we'll have a better
// way to print these.
nsPrintfCString("unexpected replacement bits 0x%" PRIX32,
uint32_t(aReplacements)).get());
MOZ_ASSERT(!(aReplacements & ~(eRestyle_CSSTransitions |
eRestyle_CSSAnimations |
eRestyle_SVGAttrAnimations |
eRestyle_StyleAttribute |
eRestyle_Force |
eRestyle_ForceDescendants)),
"unexpected replacement bits");
// FIXME (perf): This should probably not rebuild the whole path, but
// only the path from the last change in the rule tree, like