mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
More fixes for bug # 46828. r=pollmann sr=rpotts
This commit is contained in:
parent
807c6458a5
commit
f2997f535f
@ -1263,9 +1263,12 @@ nsDocShell::AddChildSHEntry(nsISHEntry * aCloneRef, nsISHEntry * aNewEntry,
|
||||
rv = mSessionHistory->GetEntryAtIndex(index, PR_FALSE,
|
||||
getter_AddRefs(currentEntry));
|
||||
if (currentEntry) {
|
||||
PRUint32 cloneID=0;
|
||||
nsCOMPtr<nsISHEntry> nextEntry; //(do_CreateInstance(NS_SHENTRY_CONTRACTID));
|
||||
// NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
rv = CloneAndReplace(currentEntry, aCloneRef, aNewEntry,
|
||||
if (aCloneRef)
|
||||
aCloneRef->GetID(&cloneID);
|
||||
rv = CloneAndReplace(currentEntry, cloneID, aNewEntry,
|
||||
getter_AddRefs(nextEntry));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@ -4125,17 +4128,19 @@ nsDocShell::PersistLayoutHistoryState()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::CloneAndReplace(nsISHEntry * src, nsISHEntry * cloneRef,
|
||||
nsDocShell::CloneAndReplace(nsISHEntry * src, PRUint32 aCloneID,
|
||||
nsISHEntry * replaceEntry, nsISHEntry ** resultEntry)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(resultEntry);
|
||||
if (!src || !replaceEntry || !cloneRef)
|
||||
if (!src || !replaceEntry)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsISHEntry * dest = (nsISHEntry *) nsnull;
|
||||
|
||||
if (src == cloneRef) {
|
||||
|
||||
PRUint32 srcID;
|
||||
src->GetID(&srcID);
|
||||
|
||||
if (srcID == aCloneID) {
|
||||
dest = replaceEntry;
|
||||
*resultEntry = dest;
|
||||
NS_IF_ADDREF(*resultEntry);
|
||||
@ -4146,6 +4151,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, nsISHEntry * cloneRef,
|
||||
nsCOMPtr<nsILayoutHistoryState> LHS;
|
||||
PRUnichar * title=nsnull;
|
||||
nsCOMPtr<nsISHEntry> parent;
|
||||
PRUint32 id;
|
||||
result = nsComponentManager::CreateInstance(NS_SHENTRY_CONTRACTID, NULL,
|
||||
NS_GET_IID(nsISHEntry), (void **) &dest);
|
||||
if (!NS_SUCCEEDED(result))
|
||||
@ -4157,6 +4163,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, nsISHEntry * cloneRef,
|
||||
src->GetLayoutHistoryState(getter_AddRefs(LHS));
|
||||
//XXX Is this correct? parent is a weak ref in nsISHEntry
|
||||
src->GetParent(getter_AddRefs(parent));
|
||||
src->GetID(&id);
|
||||
|
||||
// XXX do we care much about valid values for these uri, title etc....
|
||||
dest->SetURI(uri);
|
||||
@ -4164,6 +4171,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, nsISHEntry * cloneRef,
|
||||
dest->SetLayoutHistoryState(LHS);
|
||||
dest->SetTitle(title);
|
||||
dest->SetParent(parent);
|
||||
dest->SetID(id);
|
||||
*resultEntry = dest;
|
||||
|
||||
PRInt32 childCount= 0;
|
||||
@ -4183,7 +4191,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, nsISHEntry * cloneRef,
|
||||
nsCOMPtr<nsISHEntry> destChild;
|
||||
if (!NS_SUCCEEDED(result))
|
||||
return result;
|
||||
result = CloneAndReplace(srcChild, cloneRef, replaceEntry, getter_AddRefs(destChild));
|
||||
result = CloneAndReplace(srcChild, aCloneID, replaceEntry, getter_AddRefs(destChild));
|
||||
if (!NS_SUCCEEDED(result))
|
||||
return result;
|
||||
result = destContainer->AddChild(destChild, i);
|
||||
|
@ -243,7 +243,7 @@ protected:
|
||||
#endif
|
||||
// NS_IMETHOD GetCurrentSHE(PRInt32 aChildOffset, nsISHEntry ** aResult);
|
||||
NS_IMETHOD PersistLayoutHistoryState();
|
||||
NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, nsISHEntry * aCloneRef,
|
||||
NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, PRUint32 aCloneID,
|
||||
nsISHEntry * areplaceEntry, nsISHEntry **destEntry);
|
||||
// Global History
|
||||
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
||||
|
@ -61,6 +61,11 @@ attribute nsISHEntry parent;
|
||||
* when reload is pressed, it has the appropriate reload flag
|
||||
*/
|
||||
attribute unsigned long loadType;
|
||||
/**
|
||||
* An ID to help identify this entry from others during
|
||||
* subframe navigation
|
||||
*/
|
||||
attribute unsigned long ID;
|
||||
|
||||
/** Additional ways to create an entry */
|
||||
void create(in nsIURI aURI, in wstring aTitle, in nsIDOMDocument aDocument,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
|
||||
PRUint32 gEntryID=0;
|
||||
//*****************************************************************************
|
||||
//*** nsSHEntry: Object Management
|
||||
//*****************************************************************************
|
||||
@ -33,6 +34,7 @@ nsSHEntry::nsSHEntry()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mParent = nsnull;
|
||||
mID = gEntryID++;
|
||||
}
|
||||
|
||||
nsSHEntry::~nsSHEntry()
|
||||
@ -163,6 +165,20 @@ NS_IMETHODIMP nsSHEntry::SetLoadType(PRUint32 aLoadType)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetID(PRUint32 * aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetID(PRUint32 aID)
|
||||
{
|
||||
mID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSHEntry::Create(nsIURI * aURI, const PRUnichar * aTitle, nsIDOMDocument * aDOMDocument,
|
||||
nsIInputStream * aInputStream, nsILayoutHistoryState * aHistoryLayoutState)
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
|
||||
nsVoidArray mChildren;
|
||||
PRUint32 mLoadType;
|
||||
PRUint32 mID;
|
||||
nsISHEntry * mParent; // weak reference
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user