Fix for bug # 55055 r=adamlock sr=rpotts Save CacheKey in SH
git-svn-id: svn://10.0.0.236/trunk@92237 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -102,6 +102,7 @@ typedef unsigned long HMTX;
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIFileStream.h"
|
||||
|
||||
#include "nsIHTTPChannel.h" // add this to the ick include list...we need it to QI for post data interface
|
||||
#include "nsHTTPEnums.h"
|
||||
@@ -113,6 +114,7 @@ typedef unsigned long HMTX;
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsICachingChannel.h"
|
||||
|
||||
//XXX for nsIPostData; this is wrong; we shouldn't see the nsIDocument type
|
||||
#include "nsIDocument.h"
|
||||
@@ -1165,6 +1167,57 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
prompter->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
} // end NS_ERROR_NET_TIMEOUT
|
||||
else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) {
|
||||
/* A document that was requested to be fetched *only* from
|
||||
* the cache is not in cache. May be this is one of those
|
||||
* postdata results. Throw a dialog to the user,
|
||||
* saying that the page has expired from cache and ask if
|
||||
* they wish to refetch the page from the net.
|
||||
*/
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
PRBool repost;
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
GetPromptAndStringBundle(getter_AddRefs(prompter),
|
||||
getter_AddRefs(stringBundle));
|
||||
|
||||
if (stringBundle && prompter) {
|
||||
nsXPIDLString messageStr;
|
||||
nsresult rv = stringBundle->GetStringFromName(NS_ConvertASCIItoUCS2("repost").GetUnicode(),
|
||||
getter_Copies(messageStr));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && messageStr) {
|
||||
prompter->Confirm(nsnull, messageStr, &repost);
|
||||
/* If the user pressed cancel in the dialog,
|
||||
* return failure. Don't try to load the page with out
|
||||
* the post data.
|
||||
*/
|
||||
if (!repost)
|
||||
return NS_OK;
|
||||
/* The user does want to repost the data to the server.
|
||||
* Initiate a new load again.
|
||||
*/
|
||||
/* Get the postdata if any from the channel */
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
if (channel) {
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel(do_QueryInterface(channel));
|
||||
|
||||
if(httpChannel) {
|
||||
httpChannel->GetUploadStream(getter_AddRefs(inputStream));
|
||||
httpChannel->GetReferrer(getter_AddRefs(referrer));
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIRandomAccessStore> postDataRandomAccess(do_QueryInterface(inputStream));
|
||||
if (postDataRandomAccess)
|
||||
{
|
||||
postDataRandomAccess->Seek(PR_SEEK_SET, 0);
|
||||
}
|
||||
InternalLoad(url, referrer, nsnull, PR_TRUE, PR_FALSE, nsnull, inputStream,
|
||||
nsnull, LOAD_RELOAD_BYPASS_PROXY_AND_CACHE, nsnull);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if we have a host
|
||||
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user