mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-08 07:53:54 +00:00
Fix for bug # 135289. META http-equiv="cache-control" directives are ignored by back forward buttons. r=rpotts sr=darin.
This commit is contained in:
parent
ba98c296d5
commit
a89a95f087
@ -3957,6 +3957,22 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
|
|||||||
|
|
||||||
mEODForCurrentDocument = PR_TRUE;
|
mEODForCurrentDocument = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
/* Check if the httpChannel has any cache-control related response headers,
|
||||||
|
* like no-store, no-cache. If so, update SHEntry so that
|
||||||
|
* when a user goes back/forward to this page, we appropriately do
|
||||||
|
* form value restoration or load from server.
|
||||||
|
*/
|
||||||
|
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel));
|
||||||
|
if (!httpChannel) // HttpChannel could be hiding underneath a Multipart channel.
|
||||||
|
GetHttpChannel(aChannel, getter_AddRefs(httpChannel));
|
||||||
|
|
||||||
|
if (httpChannel) {
|
||||||
|
// figure out if SH should be saving layout state.
|
||||||
|
PRBool discardLayoutState = ShouldDiscardLayoutState(httpChannel);
|
||||||
|
if (mLSHE && discardLayoutState && (mLoadType & LOAD_CMD_NORMAL) && (mLoadType != LOAD_BYPASS_HISTORY))
|
||||||
|
mLSHE->SetSaveLayoutStateFlag(PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// Clear mLSHE after calling the onLoadHandlers. This way, if the
|
// Clear mLSHE after calling the onLoadHandlers. This way, if the
|
||||||
// onLoadHandler tries to load something different in
|
// onLoadHandler tries to load something different in
|
||||||
// itself or one of its children, we can deal with it appropriately.
|
// itself or one of its children, we can deal with it appropriately.
|
||||||
@ -5601,15 +5617,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
|||||||
httpChannel->GetUploadStream(getter_AddRefs(inputStream));
|
httpChannel->GetUploadStream(getter_AddRefs(inputStream));
|
||||||
httpChannel->GetReferrer(getter_AddRefs(referrerURI));
|
httpChannel->GetReferrer(getter_AddRefs(referrerURI));
|
||||||
|
|
||||||
// figure out if SH should be saving layout state (see bug 112564)
|
discardLayoutState = ShouldDiscardLayoutState(httpChannel);
|
||||||
nsCOMPtr<nsISupports> securityInfo;
|
|
||||||
PRBool noStore = PR_FALSE, noCache = PR_FALSE;
|
|
||||||
|
|
||||||
httpChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
|
||||||
httpChannel->IsNoStoreResponse(&noStore);
|
|
||||||
httpChannel->IsNoCacheResponse(&noCache);
|
|
||||||
|
|
||||||
discardLayoutState = noStore || (noCache && securityInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5876,6 +5884,23 @@ nsDocShell::GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
nsDocShell::ShouldDiscardLayoutState(nsIHttpChannel * aChannel)
|
||||||
|
{
|
||||||
|
// By default layout State will be saved.
|
||||||
|
if (!aChannel)
|
||||||
|
return PR_FALSE;
|
||||||
|
|
||||||
|
// figure out if SH should be saving layout state
|
||||||
|
nsCOMPtr<nsISupports> securityInfo;
|
||||||
|
PRBool noStore = PR_FALSE, noCache = PR_FALSE;
|
||||||
|
aChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||||
|
aChannel->IsNoStoreResponse(&noStore);
|
||||||
|
aChannel->IsNoCacheResponse(&noCache);
|
||||||
|
|
||||||
|
return (noStore || (noCache && securityInfo));
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// nsDocShell: Global History
|
// nsDocShell: Global History
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
@ -233,6 +233,7 @@ protected:
|
|||||||
nsISHEntry * areplaceEntry, nsISHEntry ** destEntry);
|
nsISHEntry * areplaceEntry, nsISHEntry ** destEntry);
|
||||||
nsresult GetRootSessionHistory(nsISHistory ** aReturn);
|
nsresult GetRootSessionHistory(nsISHistory ** aReturn);
|
||||||
nsresult GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn);
|
nsresult GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn);
|
||||||
|
PRBool ShouldDiscardLayoutState(nsIHttpChannel * aChannel);
|
||||||
|
|
||||||
// Global History
|
// Global History
|
||||||
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd);
|
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user