mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838304 - null out mResult when removing container nodes.
r=Mano
This commit is contained in:
parent
96d37dc57a
commit
47cc1feb6b
@ -232,6 +232,9 @@ nsNavHistoryResultNode::OnRemoving()
|
|||||||
* This will find the result for this node. We can ask the nearest container
|
* This will find the result for this node. We can ask the nearest container
|
||||||
* for this value (either ourselves or our parents should be a container,
|
* for this value (either ourselves or our parents should be a container,
|
||||||
* and all containers have result pointers).
|
* and all containers have result pointers).
|
||||||
|
*
|
||||||
|
* @note The result may be null, if the container is detached from the result
|
||||||
|
* who owns it.
|
||||||
*/
|
*/
|
||||||
nsNavHistoryResult*
|
nsNavHistoryResult*
|
||||||
nsNavHistoryResultNode::GetResult()
|
nsNavHistoryResultNode::GetResult()
|
||||||
@ -240,12 +243,11 @@ nsNavHistoryResultNode::GetResult()
|
|||||||
do {
|
do {
|
||||||
if (node->IsContainer()) {
|
if (node->IsContainer()) {
|
||||||
nsNavHistoryContainerResultNode* container = TO_CONTAINER(node);
|
nsNavHistoryContainerResultNode* container = TO_CONTAINER(node);
|
||||||
NS_ASSERTION(container->mResult, "Containers must have valid results");
|
|
||||||
return container->mResult;
|
return container->mResult;
|
||||||
}
|
}
|
||||||
node = node->mParent;
|
node = node->mParent;
|
||||||
} while (node);
|
} while (node);
|
||||||
NS_NOTREACHED("No container node found in hierarchy!");
|
MOZ_ASSERT(false, "No container node found in hierarchy!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,6 +371,7 @@ nsNavHistoryContainerResultNode::OnRemoving()
|
|||||||
for (int32_t i = 0; i < mChildren.Count(); ++i)
|
for (int32_t i = 0; i < mChildren.Count(); ++i)
|
||||||
mChildren[i]->OnRemoving();
|
mChildren[i]->OnRemoving();
|
||||||
mChildren.Clear();
|
mChildren.Clear();
|
||||||
|
mResult = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -691,7 +694,7 @@ nsNavHistoryContainerResultNode::GetSortType()
|
|||||||
if (mResult)
|
if (mResult)
|
||||||
return mResult->mSortingMode;
|
return mResult->mSortingMode;
|
||||||
|
|
||||||
NS_NOTREACHED("We should always have a result");
|
// This is a detached container, just use natural order.
|
||||||
return nsINavHistoryQueryOptions::SORT_BY_NONE;
|
return nsINavHistoryQueryOptions::SORT_BY_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,8 +711,6 @@ nsNavHistoryContainerResultNode::GetSortingAnnotation(nsACString& aAnnotation)
|
|||||||
mParent->GetSortingAnnotation(aAnnotation);
|
mParent->GetSortingAnnotation(aAnnotation);
|
||||||
else if (mResult)
|
else if (mResult)
|
||||||
aAnnotation.Assign(mResult->mSortingAnnotation);
|
aAnnotation.Assign(mResult->mSortingAnnotation);
|
||||||
else
|
|
||||||
NS_NOTREACHED("We should always have a result");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2051,6 +2052,7 @@ nsNavHistoryQueryResultNode::OnRemoving()
|
|||||||
{
|
{
|
||||||
nsNavHistoryResultNode::OnRemoving();
|
nsNavHistoryResultNode::OnRemoving();
|
||||||
ClearChildren(true);
|
ClearChildren(true);
|
||||||
|
mResult = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2282,7 +2284,7 @@ nsNavHistoryQueryResultNode::FillChildren()
|
|||||||
|
|
||||||
uint16_t sortType = GetSortType();
|
uint16_t sortType = GetSortType();
|
||||||
|
|
||||||
if (mResult->mNeedsToApplySortingMode) {
|
if (mResult && mResult->mNeedsToApplySortingMode) {
|
||||||
// We should repopulate container and then apply sortingMode. To avoid
|
// We should repopulate container and then apply sortingMode. To avoid
|
||||||
// sorting 2 times we simply do that here.
|
// sorting 2 times we simply do that here.
|
||||||
mResult->SetSortingMode(mResult->mSortingMode);
|
mResult->SetSortingMode(mResult->mSortingMode);
|
||||||
@ -2456,7 +2458,7 @@ nsNavHistoryQueryResultNode::GetSortType()
|
|||||||
if (mResult)
|
if (mResult)
|
||||||
return mResult->mSortingMode;
|
return mResult->mSortingMode;
|
||||||
|
|
||||||
NS_NOTREACHED("We should always have a result");
|
// This is a detached container, just use natural order.
|
||||||
return nsINavHistoryQueryOptions::SORT_BY_NONE;
|
return nsINavHistoryQueryOptions::SORT_BY_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2470,8 +2472,6 @@ nsNavHistoryQueryResultNode::GetSortingAnnotation(nsACString& aAnnotation) {
|
|||||||
else if (mResult) {
|
else if (mResult) {
|
||||||
aAnnotation.Assign(mResult->mSortingAnnotation);
|
aAnnotation.Assign(mResult->mSortingAnnotation);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
NS_NOTREACHED("We should always have a result");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3157,6 +3157,7 @@ nsNavHistoryFolderResultNode::OnRemoving()
|
|||||||
{
|
{
|
||||||
nsNavHistoryResultNode::OnRemoving();
|
nsNavHistoryResultNode::OnRemoving();
|
||||||
ClearChildren(true);
|
ClearChildren(true);
|
||||||
|
mResult = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3368,7 +3369,7 @@ nsNavHistoryFolderResultNode::OnChildrenFilled()
|
|||||||
// nodes and the result node pointers on the containers.
|
// nodes and the result node pointers on the containers.
|
||||||
FillStats();
|
FillStats();
|
||||||
|
|
||||||
if (mResult->mNeedsToApplySortingMode) {
|
if (mResult && mResult->mNeedsToApplySortingMode) {
|
||||||
// We should repopulate container and then apply sortingMode. To avoid
|
// We should repopulate container and then apply sortingMode. To avoid
|
||||||
// sorting 2 times we simply do that here.
|
// sorting 2 times we simply do that here.
|
||||||
mResult->SetSortingMode(mResult->mSortingMode);
|
mResult->SetSortingMode(mResult->mSortingMode);
|
||||||
|
Loading…
Reference in New Issue
Block a user