From 9efc745de928572cee44782cb12dd43613c40f93 Mon Sep 17 00:00:00 2001 From: "davidm%netscape.com" Date: Wed, 10 May 2000 22:45:24 +0000 Subject: [PATCH] 21137 Hook up reload/shift-reload/back/forward buttons to load att r = rpotts --- docshell/base/nsDocShell.cpp | 44 +++++++++++++++++++++++++++++++++++- docshell/base/nsDocShell.h | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 4124087ed33..24d8e0e8c11 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1062,6 +1062,8 @@ NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType) // XXXTAB Convert reload type to our type loadType type = loadReloadNormal; + if ( aReloadType == nsIWebNavigation::reloadBypassProxyAndCache ) + type = loadReloadBypassProxyAndCache; NS_ENSURE_SUCCESS(InternalLoad(mCurrentURI, mReferrerURI, nsnull, nsnull, type), NS_ERROR_FAILURE); @@ -1629,6 +1631,7 @@ NS_IMETHODIMP nsDocShell::SetTitle(const PRUnichar* aTitle) mGlobalHistory->SetPageTitle(url, aTitle); } + // Update SessionHistory too with Title. Otherwise entry for current page // has previous page's title. if(mSessionHistory) @@ -1641,6 +1644,7 @@ NS_IMETHODIMP nsDocShell::SetTitle(const PRUnichar* aTitle) shEntry->SetTitle(mTitle.GetUnicode()); } + return NS_OK; } @@ -2530,6 +2534,44 @@ NS_IMETHODIMP nsDocShell::DoURILoad(nsIURI* aURI, nsIURI* aReferrerURI, nsLoadFlags loadAttribs = 0; channel->GetLoadAttributes(&loadAttribs); loadAttribs |= nsIChannel::LOAD_DOCUMENT_URI; + + switch ( mLoadType ) + { + case loadHistory: + loadAttribs |= nsIChannel::VALIDATE_NEVER; + break; + + case loadReloadNormal: + loadAttribs |= nsIChannel::FORCE_VALIDATION; + break; + + case loadReloadBypassProxyAndCache: + loadAttribs |= nsIChannel::FORCE_RELOAD; + break; + case loadNormal: + // Set cache checking flags + if ( mPrefs ) + { + PRInt32 prefSetting; + if ( NS_SUCCEEDED( mPrefs->GetIntPref( "browser.cache.check_doc_frequency" , &prefSetting) ) ) + { + switch ( prefSetting ) + { + case 0: + loadAttribs |= nsIChannel::VALIDATE_ONCE_PER_SESSION; + break; + case 1: + loadAttribs |= nsIChannel::VALIDATE_ALWAYS; + break; + case 2: + loadAttribs |= nsIChannel::VALIDATE_NEVER; + break; + } + } + } + break; + } + channel->SetLoadAttributes(loadAttribs); nsCOMPtr httpChannel(do_QueryInterface(channel)); @@ -2587,7 +2629,7 @@ NS_IMETHODIMP nsDocShell::OnLoadingSite(nsIChannel* aChannel) case loadReloadNormal: case loadReloadBypassCache: case loadReloadBypassProxy: - case loadRelaodBypassProxyAndCache: + case loadReloadBypassProxyAndCache: updateHistory = PR_FALSE; break; diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 4ac1711066d..206a059e95f 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -179,7 +179,7 @@ protected: loadReloadNormal, // Reload loadReloadBypassCache, loadReloadBypassProxy, - loadRelaodBypassProxyAndCache, + loadReloadBypassProxyAndCache, loadLink } loadType;