Bug 612887, Try to fix a session history crash, r=jst, a=blocking

This commit is contained in:
Olli Pettay 2010-11-19 14:01:10 +02:00
parent 4a11f15b87
commit 913484fabb
2 changed files with 11 additions and 1 deletions

View File

@ -755,6 +755,12 @@ nsDocShell::~nsDocShell()
{
Destroy();
nsCOMPtr<nsISHistoryInternal>
shPrivate(do_QueryInterface(mSessionHistory));
if (shPrivate) {
shPrivate->SetRootDocShell(nsnull);
}
if (--gDocShellCount == 0) {
NS_IF_RELEASE(sURIFixup);
}

View File

@ -1209,7 +1209,9 @@ nsSHistory::RemoveDuplicate(PRInt32 aIndex, PRBool aKeepNext)
// We're removing the very first session history transaction!
mListRoot = txToKeep;
}
static_cast<nsDocShell*>(mRootDocShell)->HistoryTransactionRemoved(aIndex);
if (mRootDocShell) {
static_cast<nsDocShell*>(mRootDocShell)->HistoryTransactionRemoved(aIndex);
}
if (mIndex > aIndex) {
mIndex = mIndex - 1;
}
@ -1589,6 +1591,8 @@ nsSHistory::CompareFrames(nsISHEntry * aPrevEntry, nsISHEntry * aNextEntry, nsID
nsresult
nsSHistory::InitiateLoad(nsISHEntry * aFrameEntry, nsIDocShell * aFrameDS, long aLoadType)
{
NS_ENSURE_STATE(aFrameDS && aFrameEntry);
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
/* Set the loadType in the SHEntry too to what was passed on.