Bug 1667035 - Crash in [@ mozilla::dom::CanonicalBrowsingContext::RemoveDynEntriesFromActiveSessionHistoryEntry], r=jesup

Differential Revision: https://phabricator.services.mozilla.com/D91632
This commit is contained in:
Olli Pettay 2020-09-29 08:28:09 +00:00
Родитель e003e4d581
Коммит 518fc9cb15
1 изменённых файлов: 3 добавлений и 0 удалений

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

@ -623,6 +623,9 @@ void CanonicalBrowsingContext::ReplaceActiveSessionHistoryEntry(
void CanonicalBrowsingContext::RemoveDynEntriesFromActiveSessionHistoryEntry() {
nsISHistory* shistory = GetSessionHistory();
// In theory shistory can be null here if the method is called right after
// CanonicalBrowsingContext::ReplacedBy call.
NS_ENSURE_TRUE_VOID(shistory);
nsCOMPtr<nsISHEntry> root = nsSHistory::GetRootSHEntry(mActiveEntry);
shistory->RemoveDynEntries(shistory->GetIndexOfEntry(root), mActiveEntry);
}