From b40312d02fbb6073c6d9840f2d868e5e04266914 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Fri, 23 Feb 2001 00:05:54 +0000 Subject: [PATCH] Fix for bug # 69713. Get rid of unused SH_IN_FRAMES #defines. r=timeless, adamlock git-svn-id: svn://10.0.0.236/trunk@87722 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 119 +-------------------------- mozilla/docshell/base/nsDocShell.h | 14 +--- mozilla/docshell/base/nsWebShell.cpp | 16 +--- 3 files changed, 4 insertions(+), 145 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 35a0c583664..daf5783b1f1 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1494,7 +1494,7 @@ NS_IMETHODIMP nsDocShell::Reload(PRUint32 aReloadFlags) { NS_ASSERTION(((aReloadFlags & 0xf) == 0), "Reload command not updated to use load flags!"); -#ifdef SH_IN_FRAMES + // XXX Honor the reload type //NS_ENSURE_STATE(mCurrentURI); @@ -1503,28 +1503,7 @@ NS_IMETHODIMP nsDocShell::Reload(PRUint32 aReloadFlags) if ( aReloadFlags & LOAD_FLAGS_BYPASS_CACHE && aReloadFlags & LOAD_FLAGS_BYPASS_PROXY ) type = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE; -#if 0 - nsCOMPtr entry; - if (OSHE) { - /* We should fall here in most cases including subframes & refreshes */ - entry = OSHE; - } else if (mSessionHistory) { - /* In case we fail above, as a last ditch effort, we - * reload the whole page. - */ - PRInt32 index = -1; - NS_ENSURE_SUCCESS(mSessionHistory->GetIndex(&index), NS_ERROR_FAILURE); - NS_ENSURE_SUCCESS(mSessionHistory->GetEntryAtIndex(index, PR_FALSE, - getter_AddRefs(entry)), NS_ERROR_FAILURE); - NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE); - } - else { - //May be one of those charset reloads in a composer or Messenger - return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull, - nsnull, nsnull, type); - } -#else // OK. Atleast for the heck of it, pollmann says that he doesn't crash // in bug 45297 if he just did the following, instead of the one in #if 0. // If this really keeps the crash from re-occuring, may be this can stay. However @@ -1532,30 +1511,6 @@ NS_IMETHODIMP nsDocShell::Reload(PRUint32 aReloadFlags) return InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull, nsnull, nsnull, type); -#endif /* 0 */ - - - // return LoadHistoryEntry(entry, type); - - -#else - - // XXX Honor the reload type - NS_ENSURE_STATE(mCurrentURI); - - // XXXTAB Convert reload type to our type - LoadType type = LOAD_RELOAD_NORMAL; - if ( aReloadFlags & LOAD_FLAGS_BYPASS_CACHE && - aReloadFlags & LOAD_FLAGS_BYPASS_PROXY ) - type = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE; - - UpdateCurrentSessionHistory(); - - NS_ENSURE_SUCCESS(InternalLoad(mCurrentURI, mReferrerURI, nsnull, PR_TRUE, PR_FALSE, - nsnull, nsnull, nsnull, type), - NS_ERROR_FAILURE); - return NS_OK; -#endif /* SH_IN_FRAMES */ } @@ -2525,7 +2480,6 @@ NS_IMETHODIMP nsDocShell::Embed(nsIContentViewer* aContentViewer, const char * aCommand, nsISupports * aExtraInfo) { -#ifdef SH_IN_FRAMES // Save the LayoutHistoryState of the previous document, before // setting up new document PersistLayoutHistoryState(); @@ -2565,9 +2519,6 @@ NS_IMETHODIMP nsDocShell::Embed(nsIContentViewer* aContentViewer, } } return NS_OK; -#else - return SetupNewViewer(aContentViewer); -#endif /* SH_IN_FRAMES */ } //***************************************************************************** @@ -2808,11 +2759,8 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType, currentLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull); } -#ifdef SH_IN_FRAMES + NS_ENSURE_SUCCESS(Embed(viewer, "", (nsISupports *) nsnull), NS_ERROR_FAILURE); -#else - NS_ENSURE_SUCCESS(SetupNewViewer(viewer), NS_ERROR_FAILURE); -#endif /* SH_IN_FRAMES */ mEODForCurrentDocument = PR_FALSE; // clear the current flag return NS_OK; @@ -2994,48 +2942,6 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) // XXX: It looks like the LayoutState gets restored again in Embed() // right after the call to SetupNewViewer(...) -#ifndef SH_IN_FRAMES - // Restore up any HistoryLayoutState this page might have. - nsresult rv = NS_OK; - PRBool updateHistory = PR_TRUE; - - // Determine if this type of load should update history - switch(mLoadType) - { - case LOAD_HISTORY: - case LOAD_RELOAD_NORMAL: - case LOAD_RELOAD_BYPASS_CACHE: - case LOAD_RELOAD_BYPASS_PROXY: - case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE: - updateHistory = PR_FALSE; - break; - default: - break; - } - if (mSessionHistory && !updateHistory) { - PRInt32 index = 0; - mSessionHistory->GetIndex(&index); - if (-1 < index) { - - nsCOMPtr entry; - rv = mSessionHistory->GetEntryAtIndex(index, PR_FALSE, getter_AddRefs(entry)); - if (NS_SUCCEEDED(rv) && entry) { - - nsCOMPtr layoutState; - rv = entry->GetLayoutHistoryState(getter_AddRefs(layoutState)); - if (NS_SUCCEEDED(rv) && layoutState) { - - nsCOMPtr presShell; - rv = GetPresShell(getter_AddRefs(presShell)); - if (NS_SUCCEEDED(rv) && presShell) { - - rv = presShell->SetHistoryState(layoutState); - } - } - } - } - } -#endif /* SH_IN_FRAMES */ mContentViewer->Show(); @@ -3048,17 +2954,10 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) //***************************************************************************** // nsDocShell: Site Loading //***************************************************************************** -#ifdef SH_IN_FRAMES NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget, nsIInputStream* aPostData, nsIInputStream* aHeadersData, PRUint32 aLoadType, nsISHEntry * aSHEntry) -#else -NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, - nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget, - nsIInputStream* aPostData, nsIInputStream* aHeadersData, - PRUint32 aLoadType) -#endif { if (mDisallowPopupWindows && aWindowTarget && aWindowTarget[0] != '\0') { @@ -3137,12 +3036,10 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, } mLoadType = aLoadType; -#ifdef SH_IN_FRAMES // XXX: I think that LSHE should *always* be set to the new Entry. // Even if it is null... // if (aSHEntry) LSHE = aSHEntry; -#endif nsDocShellInfoLoadType loadCmd = ConvertLoadTypeToDocShellLoadInfo(mLoadType); NS_ENSURE_SUCCESS(DoURILoad(aURI, aReferrer, aOwner, aInheritOwner, @@ -4093,11 +3990,7 @@ NS_IMETHODIMP nsDocShell::UpdateCurrentSessionHistory() } -#ifdef SH_IN_FRAMES NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, PRUint32 aLoadType) -#else -NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry) -#endif { nsCOMPtr uri; nsCOMPtr postData; @@ -4134,17 +4027,9 @@ NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry) } -#ifdef SH_IN_FRAMES 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, PR_FALSE, - postData, nsnull, - LOAD_HISTORY), - NS_ERROR_FAILURE); -#endif - return NS_OK; } diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index b9b0b8ab958..de4e16c602b 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -51,7 +51,6 @@ #include "nsPoint.h" // mCurrent/mDefaultScrollbarPreferences #include "nsString.h" -#define SH_IN_FRAMES 1 // Threshold value in ms for META refresh based redirects #define REFRESH_REDIRECT_TIMER 15000 @@ -200,18 +199,10 @@ protected: nsIStreamListener** aContentHandler, nsIContentViewer** aViewer); NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer); -#ifdef SH_IN_FRAMES NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI, nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc, const char* aWindowTarget=nsnull, nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, PRUint32 aLoadType=LOAD_NORMAL, nsISHEntry * aSHEntry = nsnull); -#else - NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI, - nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc, - const char* aWindowTarget=nsnull, - nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, PRUint32 aLoadType=LOAD_NORMAL); -#endif - NS_IMETHOD CreateFixupURI(const PRUnichar* aStringURI, nsIURI** aURI); NS_IMETHOD GetCurrentDocumentOwner(nsISupports** aOwner); NS_IMETHOD DoURILoad(nsIURI* aURI, nsIURI* aReferrer, nsISupports *aOwner, @@ -236,11 +227,8 @@ protected: nsISHEntry **aNewEntry); NS_IMETHOD UpdateCurrentSessionHistory(); -#ifdef SH_IN_FRAMES + NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry, PRUint32 aLoadType); -#else - NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry); -#endif // NS_IMETHOD GetCurrentSHE(PRInt32 aChildOffset, nsISHEntry ** aResult); NS_IMETHOD PersistLayoutHistoryState(); NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, PRUint32 aCloneID, diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index e1ad70b4d50..302b7e85d08 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -117,8 +117,6 @@ typedef unsigned long HMTX; //XXX for nsIPostData; this is wrong; we shouldn't see the nsIDocument type #include "nsIDocument.h" -#define SH_IN_FRAMES 1 - #ifdef NS_DEBUG /** * Note: the log module is created during initialization which @@ -377,11 +375,7 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer, const char* aCommand, nsISupports* aExtraInfo) { -#ifdef SH_IN_FRAMES return nsDocShell::Embed(aContentViewer, aCommand, aExtraInfo); -#else - return SetupNewViewer(aContentViewer); -#endif /* SH_IN_FRAMES */ } NS_IMETHODIMP @@ -522,11 +516,8 @@ NS_IMETHODIMP nsWebShell::GoTo(PRInt32 aIndex) NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE); UpdateCurrentSessionHistory(); -#ifdef SH_IN_FRAMES + NS_ENSURE_SUCCESS(LoadHistoryEntry(entry, LOAD_HISTORY), NS_ERROR_FAILURE); -#else - NS_ENSURE_SUCCESS(LoadHistoryEntry(entry), NS_ERROR_FAILURE); -#endif return NS_OK; } @@ -830,13 +821,8 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent, return; } -#ifdef SH_IN_FRAMES InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, PR_FALSE, target, aPostDataStream, aHeadersDataStream, LOAD_LINK, nsnull); -#else - InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, target, - aPostDataStream, aHeadersDataStream, LOAD_LINK); -#endif /* SH_IN_FRAMES */ } break; case eLinkVerb_Embed: