Bug 1363036 - Part 1: Remove MOZ_DIAGNOSTIC_ASSERTs previously added for bug hunting. r?smaug
MozReview-Commit-ID: BAkuRlHtMcP
--- a/docshell/shistory/nsSHEntry.cpp
+++ b/docshell/shistory/nsSHEntry.cpp
@@ -974,12 +974,12 @@ nsSHEntry::SetLastTouched(uint32_t aLast
return NS_OK;
}
NS_IMETHODIMP
nsSHEntry::SetSHistory(nsISHistory* aSHistory)
{
nsWeakPtr shistory = do_GetWeakReference(aSHistory);
// mSHistory can not be changed once it's set
- MOZ_DIAGNOSTIC_ASSERT(!mShared->mSHistory || (mShared->mSHistory == shistory));
+ MOZ_ASSERT(!mShared->mSHistory || (mShared->mSHistory == shistory));
mShared->mSHistory = shistory;
return NS_OK;
}
--- a/docshell/shistory/nsSHEntryShared.cpp
+++ b/docshell/shistory/nsSHEntryShared.cpp
@@ -132,17 +132,17 @@ nsSHEntryShared::SetContentViewer(nsICon
if (mContentViewer || !aViewer) {
DropPresentationState();
}
// If we're setting mContentViewer to null, state should already be cleared
// in the DropPresentationState() call above; If we're setting it to a
// non-null content viewer, the entry shouldn't have been tracked either.
- MOZ_DIAGNOSTIC_ASSERT(!GetExpirationState()->IsTracked());
+ MOZ_ASSERT(!GetExpirationState()->IsTracked());
mContentViewer = aViewer;
if (mContentViewer) {
// mSHistory is only set for root entries, but in general bfcache only
// applies to root entries as well. BFCache for subframe navigation has been
// disabled since 2005 in bug 304860.
nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(mSHistory);
if (shistory) {
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -1315,17 +1315,17 @@ nsSHistory::AddToExpirationTracker(nsIBF
mHistoryTracker->AddObject(entry);
return NS_OK;
}
NS_IMETHODIMP
nsSHistory::RemoveFromExpirationTracker(nsIBFCacheEntry* aEntry)
{
RefPtr<nsSHEntryShared> entry = static_cast<nsSHEntryShared*>(aEntry);
- MOZ_DIAGNOSTIC_ASSERT(mHistoryTracker && !mHistoryTracker->IsEmpty());
+ MOZ_ASSERT(mHistoryTracker && !mHistoryTracker->IsEmpty());
if (!mHistoryTracker || !entry) {
return NS_ERROR_FAILURE;
}
mHistoryTracker->RemoveObject(entry);
return NS_OK;
}
@@ -1923,29 +1923,26 @@ nsSHistory::InitiateLoad(nsISHEntry* aFr
return aFrameDS->LoadURI(nextURI, loadInfo,
nsIWebNavigation::LOAD_FLAGS_NONE, false);
}
NS_IMETHODIMP
nsSHistory::SetRootDocShell(nsIDocShell* aDocShell)
{
- MOZ_DIAGNOSTIC_ASSERT(!aDocShell || !mRootDocShell);
mRootDocShell = aDocShell;
// Init mHistoryTracker on setting mRootDocShell so we can bind its event
// target to the tabGroup.
if (mRootDocShell) {
nsCOMPtr<nsPIDOMWindowOuter> win = mRootDocShell->GetWindow();
if (!win) {
return NS_ERROR_UNEXPECTED;
}
- // mHistroyTracker can only be set once.
- MOZ_DIAGNOSTIC_ASSERT(!mHistoryTracker);
RefPtr<mozilla::dom::TabGroup> tabGroup = win->TabGroup();
mHistoryTracker = mozilla::MakeUnique<HistoryTracker>(
this,
mozilla::Preferences::GetUint(CONTENT_VIEWER_TIMEOUT_SECONDS,
CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT),
tabGroup->EventTargetFor(mozilla::TaskCategory::Other));
}
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -142,18 +142,18 @@ public:
/**
* Add an object to be tracked. It must not already be tracked. It will
* be added to the newest generation, i.e., as if it was just used.
* @return an error on out-of-memory
*/
nsresult AddObjectLocked(T* aObj, const AutoLock& aAutoLock)
{
nsExpirationState* state = aObj->GetExpirationState();
- MOZ_DIAGNOSTIC_ASSERT(!state->IsTracked(),
- "Tried to add an object that's already tracked");
+ MOZ_ASSERT(!state->IsTracked(),
+ "Tried to add an object that's already tracked");
nsTArray<T*>& generation = mGenerations[mNewestGeneration];
uint32_t index = generation.Length();
if (index > nsExpirationState::MAX_INDEX_IN_GENERATION) {
NS_WARNING("More than 256M elements tracked, this is probably a problem");
return NS_ERROR_OUT_OF_MEMORY;
}
if (index == 0) {
// We might need to start the timer
@@ -171,28 +171,28 @@ public:
}
/**
* Remove an object from the tracker. It must currently be tracked.
*/
void RemoveObjectLocked(T* aObj, const AutoLock& aAutoLock)
{
nsExpirationState* state = aObj->GetExpirationState();
- MOZ_DIAGNOSTIC_ASSERT(state->IsTracked(), "Tried to remove an object that's not tracked");
+ MOZ_ASSERT(state->IsTracked(), "Tried to remove an object that's not tracked");
nsTArray<T*>& generation = mGenerations[state->mGeneration];
uint32_t index = state->mIndexInGeneration;
- MOZ_DIAGNOSTIC_ASSERT(generation.Length() > index &&
- generation[index] == aObj, "Object is lying about its index");
+ MOZ_ASSERT(generation.Length() > index &&
+ generation[index] == aObj, "Object is lying about its index");
// Move the last object to fill the hole created by removing aObj
uint32_t last = generation.Length() - 1;
T* lastObj = generation[last];
generation[index] = lastObj;
lastObj->GetExpirationState()->mIndexInGeneration = index;
generation.RemoveElementAt(last);
- MOZ_DIAGNOSTIC_ASSERT(generation.Length() == last);
+ MOZ_ASSERT(generation.Length() == last);
state->mGeneration = nsExpirationState::NOT_TRACKED;
// We do not check whether we need to stop the timer here. The timer
// will check that itself next time it fires. Checking here would not
// be efficient since we'd need to track all generations. Also we could
// thrash by incessantly creating and destroying timers if someone
// kept adding and removing an object from the tracker.
}