diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index db5058b0e5ec..913867a6f771 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -268,6 +268,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo) nsCOMPtr referrer; nsCOMPtr owner; PRBool inheritOwner = PR_FALSE; + PRBool stopActiveDoc = PR_FALSE; nsCOMPtr shEntry; nsDocShellInfoLoadType loadType = nsIDocShellLoadInfo::loadNormal; @@ -279,6 +280,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo) aLoadInfo->GetLoadType(&loadType); aLoadInfo->GetOwner(getter_AddRefs(owner)); aLoadInfo->GetInheritOwner(&inheritOwner); + aLoadInfo->GetStopActiveDocument(&stopActiveDoc); aLoadInfo->GetSHEntry(getter_AddRefs(shEntry)); } @@ -308,7 +310,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo) if (shEntry) { rv = LoadHistoryEntry(shEntry, loadType); } else { - rv = InternalLoad(aURI, referrer, owner, inheritOwner, nsnull, nsnull, + rv = InternalLoad(aURI, referrer, owner, inheritOwner, stopActiveDoc, nsnull, nsnull, nsnull, loadType, nsnull); } @@ -1332,7 +1334,7 @@ NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType) } else { //May be one of those charset reloads in a composer or Messenger - return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, nsnull, + return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull, nsnull, nsnull, type); } @@ -1342,7 +1344,7 @@ NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType) // If this really keeps the crash from re-occuring, may be this can stay. However // there is no major difference between this one and the one inside #if 0 - return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, nsnull, + return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull, nsnull, nsnull, type); #endif /* 0 */ @@ -1362,7 +1364,7 @@ NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType) UpdateCurrentSessionHistory(); - NS_ENSURE_SUCCESS(InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, + NS_ENSURE_SUCCESS(InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull, nsnull, nsnull, type), NS_ERROR_FAILURE); return NS_OK; @@ -2755,12 +2757,12 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) //***************************************************************************** #ifdef SH_IN_FRAMES NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, - nsISupports* aOwner, PRBool aInheritOwner, const char* aWindowTarget, + nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget, nsIInputStream* aPostData, nsIInputStream* aHeadersData, nsDocShellInfoLoadType aLoadType, nsISHEntry * aSHEntry) #else NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, - nsISupports* aOwner, PRBool aInheritOwner, const char* aWindowTarget, + nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget, nsIInputStream* aPostData, nsIInputStream* aHeadersData, nsDocShellInfoLoadType aLoadType) #endif @@ -2811,6 +2813,10 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, // Cancel any timers that were set for this loader. CancelRefreshURITimers(); + if (aStopActiveDoc && mContentViewer) { + mContentViewer->Stop(); + } + mLoadType = aLoadType; #ifdef SH_IN_FRAMES // XXX: I think that LSHE should *always* be set to the new Entry. @@ -3872,11 +3878,11 @@ NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry) #ifdef SH_IN_FRAMES - NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, PR_TRUE, nsnull, + NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, PR_TRUE, PR_FALSE, nsnull, postData, nsnull, aLoadType, aEntry), NS_ERROR_FAILURE); #else - NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, PR_TRUE, + NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, PR_TRUE, PR_FALSE, postData, nsnull, nsIDocShellLoadInfo::loadHistory), NS_ERROR_FAILURE); diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index ae66f881e8b1..dd9c0e8b0c2f 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -173,12 +173,12 @@ protected: #ifdef SH_IN_FRAMES NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI, - nsISupports* owner, PRBool inheritOwnerFromDocument, + nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc, const char* aWindowTarget=nsnull, nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal, nsISHEntry * aSHEntry = nsnull); #else NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI, - nsISupports* owner, PRBool inheritOwnerFromDocument, + nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc, const char* aWindowTarget=nsnull, nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal); #endif diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp index 72b2a638946a..8a089a7f3c76 100644 --- a/docshell/base/nsDocShellLoadInfo.cpp +++ b/docshell/base/nsDocShellLoadInfo.cpp @@ -98,6 +98,20 @@ NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(PRBool aInheritOwner) return NS_OK; } +NS_IMETHODIMP nsDocShellLoadInfo::GetStopActiveDocument(PRBool* aStopDocument) +{ + NS_ENSURE_ARG_POINTER(aStopDocument); + + *aStopDocument = mStopActiveDocument; + return NS_OK; +} + +NS_IMETHODIMP nsDocShellLoadInfo::SetStopActiveDocument(PRBool aStopDocument) +{ + mStopActiveDocument = aStopDocument; + return NS_OK; +} + NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType) { NS_ENSURE_ARG_POINTER(aLoadType); diff --git a/docshell/base/nsDocShellLoadInfo.h b/docshell/base/nsDocShellLoadInfo.h index 43a3b983a32a..9525db77907c 100644 --- a/docshell/base/nsDocShellLoadInfo.h +++ b/docshell/base/nsDocShellLoadInfo.h @@ -48,6 +48,7 @@ protected: nsCOMPtr mReferrer; nsCOMPtr mOwner; PRBool mInheritOwner; + PRBool mStopActiveDocument; nsDocShellInfoLoadType mLoadType; nsCOMPtr mSHEntry; }; diff --git a/docshell/base/nsIDocShellLoadInfo.idl b/docshell/base/nsIDocShellLoadInfo.idl index a05870aa4023..f73f5cb9a971 100644 --- a/docshell/base/nsIDocShellLoadInfo.idl +++ b/docshell/base/nsIDocShellLoadInfo.idl @@ -53,6 +53,8 @@ interface nsIDocShellLoadInfo : nsISupports */ attribute boolean inheritOwner; + attribute boolean stopActiveDocument; + /* these are load type enums... */ const long loadNormal = 0; // Normal Load const long loadNormalReplace = 1; // Normal Load but replaces current history slot diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 7b8a3898c4a6..8bab2288eaf2 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -848,10 +848,10 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent, NS_NewURI(getter_AddRefs(uri), nsLiteralString(aURLSpec), nsnull); #ifdef SH_IN_FRAMES - InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, target, aPostDataStream, + InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, PR_FALSE, target, aPostDataStream, aHeadersDataStream, nsIDocShellLoadInfo::loadLink, nsnull); #else - InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, target, + InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, PR_FALSE, target, aPostDataStream, aHeadersDataStream, nsIDocShellLoadInfo::loadLink); #endif /* SH_IN_FRAMES */