Bug 82244

backout old patch
r= radha sr=rpotts
This commit is contained in:
yokoyama%netscape.com 2001-06-29 22:12:14 +00:00
parent a108d9c59d
commit 85371e742c
5 changed files with 32 additions and 16 deletions

View File

@ -377,6 +377,9 @@ ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType)
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadCharsetChange:
loadType = LOAD_RELOAD_CHARSET_CHANGE;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
@ -414,6 +417,9 @@ nsDocShell::ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType)
case LOAD_RELOAD_NORMAL:
docShellLoadType = nsIDocShellLoadInfo::loadReloadNormal;
break;
case LOAD_RELOAD_CHARSET_CHANGE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadCharsetChange;
break;
case LOAD_RELOAD_BYPASS_CACHE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassCache;
break;
@ -473,6 +479,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadCharsetChange:
loadType = LOAD_RELOAD_CHARSET_CHANGE;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
@ -607,6 +616,9 @@ nsDocShell::LoadStream(nsIInputStream * aStream, nsIURI * aURI,
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadCharsetChange:
loadType = LOAD_RELOAD_CHARSET_CHANGE;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
@ -2184,19 +2196,16 @@ nsDocShell::LoadURI(const PRUnichar * aURI, PRUint32 aLoadFlags)
NS_IMETHODIMP
nsDocShell::Reload(PRUint32 aReloadFlags)
{
NS_ASSERTION(((aReloadFlags & 0xf) == 0),
"Reload command not updated to use load flags!");
// XXXTAB Convert reload type to our type
LoadType type;
LoadType type = LOAD_RELOAD_NORMAL;
if (aReloadFlags & LOAD_FLAGS_BYPASS_CACHE &&
aReloadFlags & LOAD_FLAGS_BYPASS_PROXY) {
aReloadFlags & LOAD_FLAGS_BYPASS_PROXY)
type = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
}
else if (aReloadFlags & LOAD_HISTORY) {
// XXX: LOAD_HISTORY really means load from cache...
type = LOAD_HISTORY;
}
else {
type = LOAD_RELOAD_NORMAL;
}
else if (aReloadFlags & LOAD_FLAGS_CHARSET_CHANGE)
type = LOAD_RELOAD_CHARSET_CHANGE;
nsresult rv;
/* If you change this part of code, make sure bug 45297 does not re-occur */
@ -4484,7 +4493,8 @@ nsresult nsDocShell::DoURILoad(nsIURI * aURI,
* post data result, *only* if it has expired from cache *and*
* the user has given us permission to do so.
*/
if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_NORMAL) {
if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_NORMAL
|| mLoadType == LOAD_RELOAD_CHARSET_CHANGE) {
if (cacheChannel && cacheKey)
cacheChannel->SetCacheKey(cacheKey, PR_TRUE);
}
@ -4496,7 +4506,8 @@ nsresult nsDocShell::DoURILoad(nsIURI * aURI,
* New cache may use it creatively on CGI pages with GET
* method and even on those that say "no-cache"
*/
if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_NORMAL) {
if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_NORMAL
|| mLoadType == LOAD_RELOAD_CHARSET_CHANGE) {
if (cacheChannel && cacheKey)
cacheChannel->SetCacheKey(cacheKey, PR_FALSE);
}
@ -4698,8 +4709,10 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel,
// Load attributes depend on load type...
switch (mLoadType) {
case LOAD_HISTORY:
case LOAD_RELOAD_CHARSET_CHANGE:
loadFlags |= nsIRequest::LOAD_FROM_CACHE;
break;
case LOAD_RELOAD_NORMAL:
loadFlags |= nsIRequest::VALIDATE_ALWAYS;

View File

@ -93,7 +93,8 @@ enum LoadType {
LOAD_RELOAD_BYPASS_PROXY = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
LOAD_RELOAD_BYPASS_PROXY_AND_CACHE = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
LOAD_LINK = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_LINK),
LOAD_REFRESH = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_REFRESH)
LOAD_REFRESH = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_REFRESH),
LOAD_RELOAD_CHARSET_CHANGE = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE)
};
/* internally used ViewMode types */

View File

@ -66,6 +66,7 @@ interface nsIDocShellLoadInfo : nsISupports
const long loadReloadBypassProxyAndCache = 6;
const long loadLink = 7;
const long loadRefresh = 8;
const long loadReloadCharsetChange = 9;
attribute nsDocShellInfoLoadType loadType;

View File

@ -92,7 +92,7 @@ interface nsIWebNavigation : nsISupports
/* loadURI() & reload() specific flags */
const unsigned long LOAD_FLAGS_BYPASS_CACHE = 0x0100; // Bypass the cache
const unsigned long LOAD_FLAGS_BYPASS_PROXY = 0x0200; // Bypass the proxy
const unsigned long LOAD_FLAGS_CHARSET_CHANGE = 0x0400; // Reload because of charset change,
/*
Loads a given URI. This will give priority to loading the requested URI
in the object implementing this interface. If it can't be loaded here

View File

@ -609,6 +609,8 @@ nsWebShell::LoadDocument(const char* aURL,
return NS_OK;
}
//This functions is only called when a new charset is detected in loading a document.
//Its name should be changed to "CharsetReloadDocument"
NS_IMETHODIMP
nsWebShell::ReloadDocument(const char* aCharset,
nsCharsetSource aSource)
@ -629,8 +631,7 @@ nsWebShell::ReloadDocument(const char* aCharset,
muDV->SetHintCharacterSet(NS_ConvertASCIItoUCS2(aCharset).GetUnicode());
muDV->SetHintCharacterSetSource((PRInt32)aSource);
mCharsetReloadState = eCharsetReloadRequested;
// XXX: LOAD_HISTORY really means load from cache...
return Reload(LOAD_HISTORY);
return Reload(LOAD_FLAGS_CHARSET_CHANGE);
}
}
}