From adc5d6c0109f8dd3644c55cbefe8950658102738 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Thu, 1 Nov 2001 22:21:31 +0000 Subject: [PATCH] Fix for bug # 103850. DocShell sets wrong cache key while loading pages with postdata. r=adamlock sr=darin CVS: ---------------------------------------------------------------------- git-svn-id: svn://10.0.0.236/trunk@106995 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 72d660c27a5..82352942a27 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4132,8 +4132,7 @@ nsresult nsDocShell::DoURILoad(nsIURI * aURI, // (ie. POST data, referer, ...) // if (httpChannel) { - nsCOMPtr - cacheChannel(do_QueryInterface(httpChannel)); + nsCOMPtr cacheChannel(do_QueryInterface(httpChannel)); /* Get the cache Key from SH */ nsCOMPtr cacheKey; if (mLSHE) { @@ -4161,16 +4160,17 @@ nsresult nsDocShell::DoURILoad(nsIURI * aURI, uploadChannel->SetUploadStream(aPostData,nsnull, -1); /* If there is a valid postdata *and* it is a History Load, * set up the cache key on the channel, to retrieve the - * data only from the cache. When there is a postdata - * on a history load, we do not want to go out to the net - * in our first attempt. + * data *only* from the cache. If it is a normal reload, the + * cache is free to go to the server for updated postdata. */ - PRBool cacheFlag = PR_FALSE; - if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_CHARSET_CHANGE) - cacheFlag = PR_TRUE; - if (cacheChannel && cacheKey) - cacheChannel->SetCacheKey(cacheKey, cacheFlag); - + if (cacheChannel && cacheKey) { + if (mLoadType == LOAD_HISTORY || mLoadType == LOAD_RELOAD_CHARSET_CHANGE) + cacheChannel->SetCacheKey(cacheKey, PR_TRUE); + else if (mLoadType == LOAD_RELOAD_NORMAL) + cacheChannel->SetCacheKey(cacheKey, PR_FALSE); + } + + } else { /* If there is no postdata, set the cache key on the channel