зеркало из https://github.com/mozilla/gecko-dev.git
OnLoadingSite now takes a nsIChannel instead of a nsIURI. This allows us to get information out of the channel we may need such as the referrer. We now make sure we set the referrer during OnLoadingSite. Fixed a bug where the nsIWebProgressListener was getting found on the treeOwner even for frames. This was causing the the treeOwner to get notified of all actions happening in the children. Now we make sure to only set the listener for the top level frame.
This commit is contained in:
Родитель
5811b87ebb
Коммит
59c2f71b03
|
@ -94,9 +94,7 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
|
|||
if(loadAttribs & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
||||
mDocShell->StopCurrentLoads();
|
||||
|
||||
nsCOMPtr<nsIURI> aURI;
|
||||
aOpenedChannel->GetURI(getter_AddRefs(aURI));
|
||||
mDocShell->OnLoadingSite(aURI);
|
||||
mDocShell->OnLoadingSite(aOpenedChannel);
|
||||
|
||||
NS_ENSURE_SUCCESS(mDocShell->CreateContentViewer(aContentType, aCommand,
|
||||
aOpenedChannel, aContentHandler), NS_ERROR_FAILURE);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
// Interfaces Needed
|
||||
#include "nsIGlobalHistory.h"
|
||||
#include "nsIHTTPChannel.h"
|
||||
|
||||
#ifdef XXX_NS_DEBUG // XXX: we'll need a logging facility for debugging
|
||||
#define WEB_TRACE(_bit,_args) \
|
||||
|
@ -715,8 +716,14 @@ NS_IMETHODIMP nsDocShell::GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner)
|
|||
NS_IMETHODIMP nsDocShell::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
||||
{
|
||||
mTreeOwner = aTreeOwner; // Weak reference per API
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener(do_QueryInterface(aTreeOwner));
|
||||
mOwnerProgressListener = progressListener; // Weak reference per API
|
||||
// Don't automatically set the progress based on the tree owner for frames
|
||||
if(!IsFrame())
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener(do_QueryInterface(aTreeOwner));
|
||||
mOwnerProgressListener = progressListener; // Weak reference per API
|
||||
}
|
||||
else
|
||||
mOwnerProgressListener = nsnull;
|
||||
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for(i = 0; i < n; i++)
|
||||
|
@ -2271,8 +2278,12 @@ NS_IMETHODIMP nsDocShell::ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::OnLoadingSite(nsIURI* aURI)
|
||||
NS_IMETHODIMP nsDocShell::OnLoadingSite(nsIChannel* aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
UpdateCurrentGlobalHistory();
|
||||
|
||||
|
@ -2280,17 +2291,25 @@ NS_IMETHODIMP nsDocShell::OnLoadingSite(nsIURI* aURI)
|
|||
{
|
||||
PRBool shouldAdd = PR_FALSE;
|
||||
|
||||
ShouldAddToSessionHistory(aURI, &shouldAdd);
|
||||
ShouldAddToSessionHistory(uri, &shouldAdd);
|
||||
if(shouldAdd)
|
||||
AddToSessionHistory(aURI);
|
||||
AddToSessionHistory(uri);
|
||||
|
||||
shouldAdd = PR_FALSE;
|
||||
ShouldAddToGlobalHistory(aURI, &shouldAdd);
|
||||
ShouldAddToGlobalHistory(uri, &shouldAdd);
|
||||
if(shouldAdd)
|
||||
AddToGlobalHistory(aURI);
|
||||
AddToGlobalHistory(uri);
|
||||
}
|
||||
|
||||
SetCurrentURI(uri);
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel(do_QueryInterface(aChannel));
|
||||
if(httpChannel)
|
||||
{
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
httpChannel->GetReferrer(getter_AddRefs(referrer));
|
||||
SetReferrerURI(referrer);
|
||||
}
|
||||
|
||||
SetCurrentURI(aURI);
|
||||
mInitialPageLoad = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ protected:
|
|||
NS_IMETHOD DoURILoad(nsIURI* aURI);
|
||||
NS_IMETHOD StopCurrentLoads();
|
||||
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
|
||||
NS_IMETHOD OnLoadingSite(nsIURI* aURI);
|
||||
NS_IMETHOD OnLoadingSite(nsIChannel* aChannel);
|
||||
virtual void SetCurrentURI(nsIURI* aURI);
|
||||
virtual void SetReferrerURI(nsIURI* aURI);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче