Fix for bug # 148794. Check if the load is to a iframe and if so, do not add

it to session history.


git-svn-id: svn://10.0.0.236/trunk@138976 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
radha%netscape.com
2003-03-05 21:37:20 +00:00
parent 1e207fc688
commit 9ad867a793
2 changed files with 25 additions and 6 deletions

View File

@@ -89,6 +89,7 @@
#include "nsIHistoryEntry.h"
#include "nsISHistoryListener.h"
#include "nsIDirectoryListing.h"
#include "nsIDOMHTMLIFrameElement.h"
// Pull in various NS_ERROR_* definitions
#include "nsIDNSService.h"
@@ -4172,8 +4173,10 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest));
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(mLoadCookie));
// Was the wyciwyg document loaded on this docshell?
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
// Was the wyciwyg document loaded on this docshell?
// if the wyciwyg content is added to a iframe, we don't
// want it to get into session history.
if (!IsIFrame() && wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
nsCOMPtr<nsIURI> uri;
wcwgChannel->GetURI(getter_AddRefs(uri));
@@ -5841,13 +5844,14 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel,
if (!rootSH)
shAvailable = PR_FALSE;
} // rootSH
// Determine if this type of load should update history.
// Determine if this type of load should update history.
// Loads to iframes also don't get into session history.
if (aLoadType == LOAD_BYPASS_HISTORY ||
aLoadType & LOAD_CMD_HISTORY ||
aLoadType == LOAD_RELOAD_NORMAL ||
aLoadType == LOAD_RELOAD_CHARSET_CHANGE)
aLoadType == LOAD_RELOAD_CHARSET_CHANGE ||
IsIFrame())
updateHistory = PR_FALSE;
// Check if the url to be loaded is the same as the one already loaded.
@@ -6731,6 +6735,20 @@ nsDocShell::IsFrame()
return PR_FALSE;
}
PRBool
nsDocShell::IsIFrame()
{
nsCOMPtr<nsIDOMElement> frame_element;
nsCOMPtr<nsPIDOMWindow> win_private(do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor *, this)));
if (win_private) {
win_private->GetFrameElementInternal(getter_AddRefs(frame_element));
nsCOMPtr<nsIDOMHTMLIFrameElement> iframe(do_QueryInterface(frame_element));
if (iframe)
return PR_TRUE;
}
return PR_FALSE;
}
NS_IMETHODIMP
nsDocShell::GetHasFocus(PRBool *aHasFocus)
{