Bug 624758 - crash [@nsSHistory::EvictContentViewersInRange] and [@nsSHistory::EvictGlobalContentViewer] don't handle failure of GetTransactionAtIndex. r=smaug, a=blocking-fennec

--HG--
extra : rebase_source : 9ebbd9e4d438ea2e20b61d80a76f765ab63ad4e6
This commit is contained in:
Doug Turner 2011-01-28 21:40:23 -08:00
parent 9e578f622b
commit 3a0bf89697

View File

@ -903,6 +903,8 @@ nsSHistory::EvictContentViewersInRange(PRInt32 aStart, PRInt32 aEnd)
{ {
nsCOMPtr<nsISHTransaction> trans; nsCOMPtr<nsISHTransaction> trans;
GetTransactionAtIndex(aStart, getter_AddRefs(trans)); GetTransactionAtIndex(aStart, getter_AddRefs(trans));
if (!trans)
return;
for (PRInt32 i = aStart; i < aEnd; ++i) { for (PRInt32 i = aStart; i < aEnd; ++i) {
nsCOMPtr<nsISHEntry> entry; nsCOMPtr<nsISHEntry> entry;
@ -969,6 +971,11 @@ nsSHistory::EvictGlobalContentViewer()
nsCOMPtr<nsISHTransaction> trans; nsCOMPtr<nsISHTransaction> trans;
shist->GetTransactionAtIndex(startIndex, getter_AddRefs(trans)); shist->GetTransactionAtIndex(startIndex, getter_AddRefs(trans));
if (!trans) {
shist = static_cast<nsSHistory*>(PR_NEXT_LINK(shist));
continue;
}
for (PRInt32 i = startIndex; i <= endIndex; ++i) { for (PRInt32 i = startIndex; i <= endIndex; ++i) {
nsCOMPtr<nsISHEntry> entry; nsCOMPtr<nsISHEntry> entry;
trans->GetSHEntry(getter_AddRefs(entry)); trans->GetSHEntry(getter_AddRefs(entry));