bug #37434. Added an attribute to nsIDocShellLoadInfo to indicate whether the active document should be stopped immediately...

This commit is contained in:
rpotts%netscape.com 2000-09-10 06:00:46 +00:00
Родитель f7a6f320c1
Коммит 7215069dbb
6 изменённых файлов: 35 добавлений и 12 удалений

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

@ -268,6 +268,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo)
nsCOMPtr<nsIURI> referrer;
nsCOMPtr<nsISupports> owner;
PRBool inheritOwner = PR_FALSE;
PRBool stopActiveDoc = PR_FALSE;
nsCOMPtr<nsISHEntry> 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 <META> 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);

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

@ -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

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

@ -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);

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

@ -48,6 +48,7 @@ protected:
nsCOMPtr<nsIURI> mReferrer;
nsCOMPtr<nsISupports> mOwner;
PRBool mInheritOwner;
PRBool mStopActiveDocument;
nsDocShellInfoLoadType mLoadType;
nsCOMPtr<nsISHEntry> mSHEntry;
};

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

@ -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

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

@ -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 */