Fix for bug # 82236. r=valeski sr=alecf a=blizzard(drivers@mozilla.org)

This commit is contained in:
radha%netscape.com 2001-05-29 22:45:57 +00:00
parent 97e6dee485
commit 553a99a133
2 changed files with 42 additions and 6 deletions

View File

@ -258,7 +258,7 @@ NS_INTERFACE_MAP_END_THREADSAFE
//*****************************************************************************
NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
{
NS_ENSURE_ARG_POINTER(aSink);
NS_ENSURE_ARG_POINTER(aSink);
if (aIID.Equals(NS_GET_IID(nsIURIContentListener)) &&
NS_SUCCEEDED(EnsureContentListener())) {
@ -5115,12 +5115,44 @@ void
nsDocShell::SetCurrentURI(nsIURI * aURI)
{
mCurrentURI = aURI; //This assignment addrefs
PRBool isRoot = PR_FALSE; // Is this the root docshell
PRBool isSubFrame=PR_FALSE; // Is this a subframe navigation?
nsCOMPtr<nsIDocumentLoader> loader(do_GetInterface(mLoadCookie));
if (!mLoadCookie)
return;
nsCOMPtr<nsIDocumentLoader> loader(do_GetInterface(mLoadCookie));
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(mLoadCookie));
nsCOMPtr<nsIDocShellTreeItem> root;
GetSameTypeRootTreeItem(getter_AddRefs(root));
if (root.get() == NS_STATIC_CAST(nsIDocShellTreeItem *, this))
{
// This is the root docshell
isRoot = PR_TRUE;
}
if (LSHE) {
nsCOMPtr<nsIHistoryEntry> historyEntry(do_QueryInterface(LSHE));
// Check if this is a subframe navigation
if (historyEntry) {
historyEntry->GetIsSubFrame(&isSubFrame);
}
}
if (!isSubFrame && !isRoot) {
/*
* We don't want to send OnLocationChange notifications when
* a subframe is being loaded for the first time, while
* visiting a frameset page
*/
return;
}
NS_ASSERTION(loader, "No document loader");
if (loader) {
loader->FireOnLocationChange(nsnull, nsnull, aURI);
loader->FireOnLocationChange(webProgress, nsnull, aURI);
}
}

View File

@ -232,6 +232,7 @@ nsBrowserStatusHandler.prototype =
onLocationChange : function(aWebProgress, aRequest, aLocation)
{
var location = aLocation.spec;
domWindow = aWebProgress.DOMWindow;
if (this.hideAboutBlank) {
this.hideAboutBlank = false;
@ -241,9 +242,12 @@ nsBrowserStatusHandler.prototype =
// We should probably not do this if the value has changed since the user
// searched
this.urlBar.value = location;
SetPageProxyState("valid");
// Update urlbar only if a new page was loaded on the primary content area
// Do not update urlbar if there was a subframe navigation
if (domWindow == domWindow.top) {
this.urlBar.value = location;
SetPageProxyState("valid");
}
UpdateBackForwardButtons();
},