Skip to content

Commit

Permalink
Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSE…
Browse files Browse the repository at this point in the history
…RT_UNREACHABLE. r=froydnj

This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
  • Loading branch information
cpeterso committed Jun 18, 2018
1 parent ed185e6 commit 2afd829
Showing 281 changed files with 653 additions and 587 deletions.
2 changes: 1 addition & 1 deletion accessible/base/AccGroupInfo.cpp
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ AccGroupInfo::NextItemTo(Accessible* aItem)
}
}

NS_NOTREACHED("Item in the middle of the group but there's no next item!");
MOZ_ASSERT_UNREACHABLE("Item in the middle of the group but there's no next item!");
return nullptr;
}

8 changes: 4 additions & 4 deletions accessible/base/DocManager.cpp
Original file line number Diff line number Diff line change
@@ -319,7 +319,7 @@ DocManager::OnProgressChange(nsIWebProgress* aWebProgress,
int32_t aCurTotalProgress,
int32_t aMaxTotalProgress)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

@@ -328,7 +328,7 @@ DocManager::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIURI* aLocation,
uint32_t aFlags)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

@@ -337,7 +337,7 @@ DocManager::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsresult aStatus,
const char16_t* aMessage)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

@@ -346,7 +346,7 @@ DocManager::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t aState)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

2 changes: 1 addition & 1 deletion accessible/base/TextUpdater.cpp
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ TextUpdater::ComputeTextChangeEvents(const nsAString& aStr1,
--colIdx;
continue;
}
NS_NOTREACHED("huh?");
MOZ_ASSERT_UNREACHABLE("huh?");
return;
}

4 changes: 2 additions & 2 deletions accessible/base/nsAccUtils.cpp
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ nsAccUtils::ConvertToScreenCoords(int32_t aX, int32_t aY,
}

default:
NS_NOTREACHED("invalid coord type!");
MOZ_ASSERT_UNREACHABLE("invalid coord type!");
}

return coords;
@@ -352,7 +352,7 @@ nsAccUtils::ConvertScreenCoordsTo(int32_t *aX, int32_t *aY,
}

default:
NS_NOTREACHED("invalid coord type!");
MOZ_ASSERT_UNREACHABLE("invalid coord type!");
}
}

4 changes: 2 additions & 2 deletions accessible/generic/BaseAccessibles.cpp
Original file line number Diff line number Diff line change
@@ -41,14 +41,14 @@ LeafAccessible::ChildAtPoint(int32_t aX, int32_t aY,
bool
LeafAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
{
NS_NOTREACHED("InsertChildAt called on leaf accessible!");
MOZ_ASSERT_UNREACHABLE("InsertChildAt called on leaf accessible!");
return false;
}

bool
LeafAccessible::RemoveChild(Accessible* aChild)
{
NS_NOTREACHED("RemoveChild called on leaf accessible!");
MOZ_ASSERT_UNREACHABLE("RemoveChild called on leaf accessible!");
return false;
}

4 changes: 2 additions & 2 deletions accessible/generic/HyperTextAccessible.cpp
Original file line number Diff line number Diff line change
@@ -1259,7 +1259,7 @@ HyperTextAccessible::TextBounds(int32_t aStartOffset, int32_t aEndOffset,
while (childIdx < static_cast<int32_t>(ChildCount())) {
nsIFrame* frame = GetChildAt(childIdx++)->GetFrame();
if (!frame) {
NS_NOTREACHED("No frame for a child!");
MOZ_ASSERT_UNREACHABLE("No frame for a child!");
continue;
}

@@ -1505,7 +1505,7 @@ HyperTextAccessible::CaretLineNumber()
caretFrame = parentFrame;
}

NS_NOTREACHED("DOM ancestry had this hypertext but frame ancestry didn't");
MOZ_ASSERT_UNREACHABLE("DOM ancestry had this hypertext but frame ancestry didn't");
return lineNumber;
}

2 changes: 1 addition & 1 deletion accessible/html/HTMLListAccessible.cpp
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ void
HTMLLIAccessible::UpdateBullet(bool aHasBullet)
{
if (aHasBullet == !!mBullet) {
NS_NOTREACHED("Bullet and accessible are in sync already!");
MOZ_ASSERT_UNREACHABLE("Bullet and accessible are in sync already!");
return;
}

2 changes: 1 addition & 1 deletion accessible/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
@@ -720,7 +720,7 @@ - (NSString*)role
switch (mRole) {
#include "RoleMap.h"
default:
NS_NOTREACHED("Unknown role.");
MOZ_ASSERT_UNREACHABLE("Unknown role.");
return NSAccessibilityUnknownRole;
}

2 changes: 1 addition & 1 deletion accessible/xul/XULMenuAccessible.cpp
Original file line number Diff line number Diff line change
@@ -529,7 +529,7 @@ XULMenupopupAccessible::ContainerWidget() const
menuPopupFrame = static_cast<nsMenuPopupFrame*>(menuParent);
}

NS_NOTREACHED("Shouldn't be a real case.");
MOZ_ASSERT_UNREACHABLE("Shouldn't be a real case.");
return nullptr;
}

2 changes: 1 addition & 1 deletion chrome/nsChromeRegistryContent.cpp
Original file line number Diff line number Diff line change
@@ -178,7 +178,7 @@ nsChromeRegistryContent::GetFlagsFromPackage(const nsCString& aPackage,
// All functions following only make sense in chrome, and therefore assert

#define CONTENT_NOTREACHED() \
NS_NOTREACHED("Content should not be calling this")
MOZ_ASSERT_UNREACHABLE("Content should not be calling this")

#define CONTENT_NOT_IMPLEMENTED() \
CONTENT_NOTREACHED(); \
10 changes: 5 additions & 5 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
@@ -5585,7 +5585,7 @@ nsDocShell::GetVisibility(bool* aVisibility)

// Null-check for crash in bug 267804
if (!pPresShell) {
NS_NOTREACHED("parent docshell has null pres shell");
MOZ_ASSERT_UNREACHABLE("parent docshell has null pres shell");
return NS_OK;
}

@@ -6875,7 +6875,7 @@ NS_IMETHODIMP
nsDocShell::OnLocationChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
nsIURI* aURI, uint32_t aFlags)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

@@ -6985,15 +6985,15 @@ nsDocShell::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsresult aStatus, const char16_t* aMessage)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aState)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

@@ -10884,7 +10884,7 @@ nsDocShell::AddHeadersToChannel(nsIInputStream* aHeadersData,
NS_ENSURE_SUCCESS(rv, rv);
}

NS_NOTREACHED("oops");
MOZ_ASSERT_UNREACHABLE("oops");
return NS_ERROR_UNEXPECTED;
}

4 changes: 2 additions & 2 deletions docshell/base/nsDocShellLoadTypes.h
Original file line number Diff line number Diff line change
@@ -196,7 +196,7 @@ ConvertLoadTypeToDocShellInfoLoadType(uint32_t aLoadType)
docShellLoadType = nsIDocShellLoadInfo::loadReloadMixedContent;
break;
default:
NS_NOTREACHED("Unexpected load type value");
MOZ_ASSERT_UNREACHABLE("Unexpected load type value");
}

return docShellLoadType;
@@ -278,7 +278,7 @@ ConvertDocShellInfoLoadTypeToLoadType(nsDocShellInfoLoadType aDocShellLoadType)
loadType = LOAD_RELOAD_ALLOW_MIXED_CONTENT;
break;
default:
NS_NOTREACHED("Unexpected nsDocShellInfoLoadType value");
MOZ_ASSERT_UNREACHABLE("Unexpected nsDocShellInfoLoadType value");
}

return loadType;
2 changes: 1 addition & 1 deletion dom/animation/Animation.h
Original file line number Diff line number Diff line change
@@ -403,7 +403,7 @@ class Animation
} else if (mPendingState == PendingState::PausePending) {
PauseAt(aReadyTime);
} else {
NS_NOTREACHED("Can't finish pending if we're not in a pending state");
MOZ_ASSERT_UNREACHABLE("Can't finish pending if we're not in a pending state");
}
}
void ApplyPendingPlaybackRate()
4 changes: 2 additions & 2 deletions dom/animation/CSSPseudoElement.cpp
Original file line number Diff line number Diff line change
@@ -119,8 +119,8 @@ CSSPseudoElement::GetCSSPseudoElementPropertyAtom(CSSPseudoElementType aType)
return nsGkAtoms::cssPseudoElementAfterProperty;

default:
NS_NOTREACHED("Should not try to get CSSPseudoElement "
"other than ::before or ::after");
MOZ_ASSERT_UNREACHABLE("Should not try to get CSSPseudoElement "
"other than ::before or ::after");
return nullptr;
}
}
4 changes: 2 additions & 2 deletions dom/animation/EffectCompositor.cpp
Original file line number Diff line number Diff line change
@@ -481,8 +481,8 @@ EffectCompositor::GetElementToRestyle(dom::Element* aElement,
return nsLayoutUtils::GetAfterPseudo(aElement);
}

NS_NOTREACHED("Should not try to get the element to restyle for a pseudo "
"other that :before or :after");
MOZ_ASSERT_UNREACHABLE("Should not try to get the element to restyle for "
"a pseudo other that :before or :after");
return nullptr;
}

4 changes: 2 additions & 2 deletions dom/animation/EffectSet.cpp
Original file line number Diff line number Diff line change
@@ -142,8 +142,8 @@ EffectSet::GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType)
return nsGkAtoms::animationEffectsForAfterProperty;

default:
NS_NOTREACHED("Should not try to get animation effects for a pseudo "
"other that :before or :after");
MOZ_ASSERT_UNREACHABLE("Should not try to get animation effects for "
"a pseudo other that :before or :after");
return nullptr;
}
}
2 changes: 1 addition & 1 deletion dom/animation/KeyframeEffect.cpp
Original file line number Diff line number Diff line change
@@ -927,7 +927,7 @@ KeyframeEffect::GetTarget(Nullable<OwningElementOrCSSPseudoElement>& aRv) const
break;

default:
NS_NOTREACHED("Animation of unsupported pseudo-type");
MOZ_ASSERT_UNREACHABLE("Animation of unsupported pseudo-type");
aRv.SetNull();
}
}
4 changes: 2 additions & 2 deletions dom/base/Element.cpp
Original file line number Diff line number Diff line change
@@ -3270,7 +3270,7 @@ Element::GetEventTargetParentForLinks(EventChainPreVisitor& aVisitor)

default:
// switch not in sync with the optimization switch earlier in this function
NS_NOTREACHED("switch statements not in sync");
MOZ_ASSERT_UNREACHABLE("switch statements not in sync");
}
}

@@ -3384,7 +3384,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)

default:
// switch not in sync with the optimization switch earlier in this function
NS_NOTREACHED("switch statements not in sync");
MOZ_ASSERT_UNREACHABLE("switch statements not in sync");
return NS_ERROR_UNEXPECTED;
}

2 changes: 1 addition & 1 deletion dom/base/FormData.cpp
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ FormData::GetEncodedSubmission(nsIURI* aURI,
nsIInputStream** aPostDataStream,
nsCOMPtr<nsIURI>& aOutURI)
{
NS_NOTREACHED("Shouldn't call FormData::GetEncodedSubmission");
MOZ_ASSERT_UNREACHABLE("Shouldn't call FormData::GetEncodedSubmission");
return NS_OK;
}

2 changes: 1 addition & 1 deletion dom/base/FragmentOrElement.cpp
Original file line number Diff line number Diff line change
@@ -2104,7 +2104,7 @@ FragmentOrElement::TextLength() const
{
// We can remove this assertion if it turns out to be useful to be able
// to depend on this returning 0
NS_NOTREACHED("called FragmentOrElement::TextLength");
MOZ_ASSERT_UNREACHABLE("called FragmentOrElement::TextLength");

return 0;
}
2 changes: 1 addition & 1 deletion dom/base/ThirdPartyUtil.cpp
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow,
currentURI = parentURI;
} while (1);

NS_NOTREACHED("should've returned");
MOZ_ASSERT_UNREACHABLE("should've returned");
return NS_ERROR_UNEXPECTED;
}

12 changes: 6 additions & 6 deletions dom/base/nsAttrValue.cpp
Original file line number Diff line number Diff line change
@@ -327,7 +327,7 @@ nsAttrValue::SetTo(const nsAttrValue& aOther)
// the same size so it doesn't really matter which one we assign
cont->mValue.mSVGAngle = otherCont->mValue.mSVGAngle;
} else {
NS_NOTREACHED("unknown type stored in MiscContainer");
MOZ_ASSERT_UNREACHABLE("unknown type stored in MiscContainer");
}
break;
}
@@ -593,7 +593,7 @@ nsAttrValue::ToString(nsAString& aResult) const
#ifdef DEBUG
case eColor:
{
NS_NOTREACHED("color attribute without string data");
MOZ_ASSERT_UNREACHABLE("color attribute without string data");
aResult.Truncate();
break;
}
@@ -778,7 +778,7 @@ nsAttrValue::GetEnumString(nsAString& aResult, bool aRealTag) const
table++;
}

NS_NOTREACHED("couldn't find value in EnumTable");
MOZ_ASSERT_UNREACHABLE("couldn't find value in EnumTable");
}

uint32_t
@@ -899,7 +899,7 @@ nsAttrValue::HashValue() const
// All SVG types are just pointers to classes so we can treat them alike
return NS_PTR_TO_INT32(cont->mValue.mSVGAngle);
}
NS_NOTREACHED("unknown type stored in MiscContainer");
MOZ_ASSERT_UNREACHABLE("unknown type stored in MiscContainer");
return 0;
}
}
@@ -1009,7 +1009,7 @@ nsAttrValue::Equals(const nsAttrValue& aOther) const
MOZ_ASSERT(false, "Comparing nsAttrValues that point to SVG data");
return false;
}
NS_NOTREACHED("unknown type stored in MiscContainer");
MOZ_ASSERT_UNREACHABLE("unknown type stored in MiscContainer");
return false;
}
}
@@ -1331,7 +1331,7 @@ nsAttrValue::SetIntValueAndType(int32_t aValue, ValueType aType,
}
default:
{
NS_NOTREACHED("unknown integer type");
MOZ_ASSERT_UNREACHABLE("unknown integer type");
break;
}
}
2 changes: 1 addition & 1 deletion dom/base/nsContentIterator.cpp
Original file line number Diff line number Diff line change
@@ -459,7 +459,7 @@ nsContentIterator::InitInternal(const RawRangeBoundary& aStart,

if (NS_WARN_IF(!cChild)) {
// No child at offset!
NS_NOTREACHED("nsContentIterator::nsContentIterator");
MOZ_ASSERT_UNREACHABLE("nsContentIterator::nsContentIterator");
return NS_ERROR_FAILURE;
}

6 changes: 3 additions & 3 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
@@ -5071,7 +5071,7 @@ nsContentUtils::ParseFragmentHTML(const nsAString& aSourceBuffer,
AutoTimelineMarker m(aTargetNode->OwnerDoc()->GetDocShell(), "Parse HTML");

if (nsContentUtils::sFragmentParsingActive) {
NS_NOTREACHED("Re-entrant fragment parsing attempted.");
MOZ_ASSERT_UNREACHABLE("Re-entrant fragment parsing attempted.");
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
mozilla::AutoRestore<bool> guard(nsContentUtils::sFragmentParsingActive);
@@ -5127,7 +5127,7 @@ nsContentUtils::ParseDocumentHTML(const nsAString& aSourceBuffer,
AutoTimelineMarker m(aTargetDocument->GetDocShell(), "Parse HTML");

if (nsContentUtils::sFragmentParsingActive) {
NS_NOTREACHED("Re-entrant fragment parsing attempted.");
MOZ_ASSERT_UNREACHABLE("Re-entrant fragment parsing attempted.");
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
mozilla::AutoRestore<bool> guard(nsContentUtils::sFragmentParsingActive);
@@ -5154,7 +5154,7 @@ nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer,
AutoTimelineMarker m(aDocument->GetDocShell(), "Parse XML");

if (nsContentUtils::sFragmentParsingActive) {
NS_NOTREACHED("Re-entrant fragment parsing attempted.");
MOZ_ASSERT_UNREACHABLE("Re-entrant fragment parsing attempted.");
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
mozilla::AutoRestore<bool> guard(nsContentUtils::sFragmentParsingActive);
Loading

0 comments on commit 2afd829

Please sign in to comment.