Merge mozilla-central and mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2011-06-13 23:34:45 -04:00
Родитель fc981395e8 dea1dade04
Коммит e493b6cc17
13 изменённых файлов: 25 добавлений и 169 удалений

Просмотреть файл

@ -4366,10 +4366,6 @@ var XULBrowserWindow = {
}
},
onLocationChange2: function (aWebProgress, aRequest, aLocationURI, aFlags) {
onLocationChange(aWebProgress, aRequest, aLocationURI);
},
onLocationChange: function (aWebProgress, aRequest, aLocationURI) {
var location = aLocationURI ? aLocationURI.spec : "";
this._hostChanged = true;

Просмотреть файл

@ -1726,20 +1726,17 @@ nsDocShell::GetChromeEventHandler(nsIDOMEventTarget** aChromeEventHandler)
return NS_OK;
}
/* void setCurrentURI (in nsIURI uri); */
/* [noscript] void setCurrentURI (in nsIURI uri); */
NS_IMETHODIMP
nsDocShell::SetCurrentURI(nsIURI *aURI)
{
// Note that securityUI will set STATE_IS_INSECURE, even if
// the scheme of |aURI| is "https".
SetCurrentURI(aURI, nsnull, PR_TRUE,
nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
SetCurrentURI(aURI, nsnull, PR_TRUE);
return NS_OK;
}
PRBool
nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
PRBool aFireOnLocationChange, PRUint32 aLocationFlags)
PRBool aFireOnLocationChange)
{
#ifdef PR_LOGGING
if (gDocShellLeakLog && PR_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) {
@ -1783,7 +1780,7 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
}
if (aFireOnLocationChange) {
FireOnLocationChange(this, aRequest, aURI, aLocationFlags);
FireOnLocationChange(this, aRequest, aURI);
}
return !aFireOnLocationChange;
}
@ -5877,8 +5874,7 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
// a new DOM here.
rv = AddToSessionHistory(uri, wcwgChannel, nsnull, PR_FALSE,
getter_AddRefs(mLSHE));
SetCurrentURI(uri, aRequest, PR_TRUE,
nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
SetCurrentURI(uri, aRequest, PR_TRUE);
// Save history state of the previous page
rv = PersistLayoutHistoryState();
// We'll never get an Embed() for this load, so just go ahead
@ -6532,8 +6528,7 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
viewer->SetContainer(static_cast<nsIContentViewerContainer *>(this));
Embed(viewer, "", 0);
SetCurrentURI(blankDoc->GetDocumentURI(), nsnull, PR_TRUE,
nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
SetCurrentURI(blankDoc->GetDocumentURI(), nsnull, PR_TRUE);
rv = mIsBeingDestroyed ? NS_ERROR_NOT_AVAILABLE : NS_OK;
}
}
@ -7184,8 +7179,7 @@ nsDocShell::RestoreFromHistory()
// is still mLSHE or whether it's now mOSHE.
nsCOMPtr<nsIURI> uri;
origLSHE->GetURI(getter_AddRefs(uri));
SetCurrentURI(uri, document->GetChannel(), PR_TRUE,
nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
SetCurrentURI(uri, document->GetChannel(), PR_TRUE);
}
// This is the end of our CreateContentViewer() replacement.
@ -7524,8 +7518,7 @@ nsDocShell::CreateContentViewer(const char *aContentType,
}
if (onLocationChangeNeeded) {
FireOnLocationChange(this, request, mCurrentURI,
nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
FireOnLocationChange(this, request, mCurrentURI);
}
return NS_OK;
@ -8392,11 +8385,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// Pass true for aCloneSHChildren, since we're not
// changing documents here, so all of our subframes are
// still relevant to the new session history entry.
//
// It also makes OnNewURI(...) set LOCATION_CHANGE_SAME_DOCUMENT
// flag on firing onLocationChange(...).
// Anyway, aCloneSHChildren param is simply reflecting
// doShortCircuitedLoad in this scope.
OnNewURI(aURI, nsnull, owner, mLoadType, PR_TRUE, PR_TRUE, PR_TRUE);
nsCOMPtr<nsIInputStream> postData;
@ -9476,14 +9464,8 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel, nsISupports* aOwner,
#endif
}
}
// aCloneSHChildren exactly means "we are not loading a new document".
PRUint32 locationFlags = aCloneSHChildren?
PRUint32(nsIWebProgressListener2::LOCATION_CHANGE_SAME_DOCUMENT) :
PRUint32(nsIWebProgressListener2::LOCATION_CHANGE_NORMAL);
PRBool onLocationChangeNeeded = SetCurrentURI(aURI, aChannel,
aFireOnLocationChange,
locationFlags);
aFireOnLocationChange);
// Make sure to store the referrer from the channel, if any
SetupReferrerFromChannel(aChannel);
return onLocationChangeNeeded;
@ -9787,15 +9769,8 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
// gets updated and the back button is enabled, but we only need to
// explicitly call FireOnLocationChange if we're not calling SetCurrentURI,
// since SetCurrentURI will call FireOnLocationChange for us.
//
// Both SetCurrentURI(...) and FireDummyOnLocationChange() pass
// nsnull for aRequest param to FireOnLocationChange(...). Such an update
// notification is allowed only when we know docshell is not loading a new
// document and it requires LOCATION_CHANGE_SAME_DOCUMENT flag. Otherwise,
// FireOnLocationChange(...) breaks security UI.
if (!equalURIs) {
SetCurrentURI(newURI, nsnull, PR_TRUE,
nsIWebProgressListener2::LOCATION_CHANGE_SAME_DOCUMENT);
SetCurrentURI(newURI, nsnull, PR_TRUE);
document->SetDocumentURI(newURI);
AddURIVisit(newURI, oldURI, oldURI, 0);

Просмотреть файл

@ -94,7 +94,7 @@
#include "nsISupportsArray.h"
#include "nsIWebNavigation.h"
#include "nsIWebPageDescriptor.h"
#include "nsIWebProgressListener2.h"
#include "nsIWebProgressListener.h"
#include "nsISHContainer.h"
#include "nsIDocShellLoadInfo.h"
#include "nsIDocShellHistory.h"
@ -268,13 +268,10 @@ public:
friend class OnLinkClickEvent;
// We need dummy OnLocationChange in some cases to update the UI without
// updating security info.
// We need dummy OnLocationChange in some cases to update the UI.
void FireDummyOnLocationChange()
{
FireOnLocationChange
(this, nsnull, mCurrentURI,
nsIWebProgressListener2::LOCATION_CHANGE_SAME_DOCUMENT);
FireOnLocationChange(this, nsnull, mCurrentURI);
}
nsresult HistoryTransactionRemoved(PRInt32 aIndex);
@ -595,8 +592,7 @@ protected:
// FireOnLocationChange is called.
// In all other cases PR_FALSE is returned.
PRBool SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
PRBool aFireOnLocationChange,
PRUint32 aLocationFlags);
PRBool aFireOnLocationChange);
// The following methods deal with saving and restoring content viewers
// in session history.

Просмотреть файл

@ -192,10 +192,9 @@ nsSecureBrowserUIImpl::~nsSecureBrowserUIImpl()
}
}
NS_IMPL_THREADSAFE_ISUPPORTS7(nsSecureBrowserUIImpl,
NS_IMPL_THREADSAFE_ISUPPORTS6(nsSecureBrowserUIImpl,
nsISecureBrowserUI,
nsIWebProgressListener,
nsIWebProgressListener2,
nsIFormSubmitObserver,
nsIObserver,
nsISupportsWeakReference,
@ -1517,39 +1516,6 @@ NS_IMETHODIMP
nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI* aLocation)
{
NS_NOTREACHED("onLocationChange2(...) should be called instead.");
return NS_OK;
}
// nsIWebProgressListener2
NS_IMETHODIMP
nsSecureBrowserUIImpl::OnProgressChange64(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
PRInt64 aCurSelfProgress,
PRInt64 aMaxSelfProgress,
PRInt64 aCurTotalProgress,
PRInt64 aMaxTotalProgress)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsSecureBrowserUIImpl::OnRefreshAttempted(nsIWebProgress* aWebProgress,
nsIURI* aRefreshURI, PRInt32 aMillis,
PRBool aSameURI, PRBool* aResult)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
*aResult = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsSecureBrowserUIImpl::OnLocationChange2(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI* aLocation,
PRUint32 aFlags)
{
#ifdef DEBUG
nsAutoAtomic atomic(mOnStateLocationChangeReentranceDetection);
@ -1589,10 +1555,9 @@ nsSecureBrowserUIImpl::OnLocationChange2(nsIWebProgress* aWebProgress,
NS_ASSERTION(window, "Window has gone away?!");
}
// When |aRequest| is null, basically we don't trust that document. But if
// docshell insists that the document has not changed at all, we will reuse
// the previous security state, no matter what |aRequest| may be.
if (aFlags & LOCATION_CHANGE_SAME_DOCUMENT)
// If the location change does not have a corresponding request, then we
// assume that it does not impact the security state.
if (!aRequest)
return NS_OK;
// The location bar has changed, so we must update the security state. The

Просмотреть файл

@ -53,7 +53,7 @@
#include "nsIStringBundle.h"
#include "nsISecureBrowserUI.h"
#include "nsIDocShell.h"
#include "nsIWebProgressListener2.h"
#include "nsIWebProgressListener.h"
#include "nsIFormSubmitObserver.h"
#include "nsIURI.h"
#include "nsISecurityEventSink.h"
@ -72,7 +72,7 @@ class nsIChannel;
class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
public nsIWebProgressListener2,
public nsIWebProgressListener,
public nsIFormSubmitObserver,
public nsIObserver,
public nsSupportsWeakReference,
@ -85,7 +85,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIWEBPROGRESSLISTENER2
NS_DECL_NSISECUREBROWSERUI
// nsIObserver

Просмотреть файл

@ -2439,14 +2439,6 @@ nsDownload::OnRefreshAttempted(nsIWebProgress *aWebProgress,
return NS_OK;
}
NS_IMETHODIMP
nsDownload::OnLocationChange2(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, nsIURI *aLocation,
PRUint32 aFlags)
{
return OnLocationChange(aWebProgress, aRequest, aLocation);
}
////////////////////////////////////////////////////////////////////////////////
//// nsIWebProgressListener

Просмотреть файл

@ -128,13 +128,6 @@ public:
NS_ENSURE_TRUE(mInner, NS_ERROR_NOT_INITIALIZED);
return mInner->OnLocationChange(aWebProgress, aRequest, aLocation);
}
NS_IMETHODIMP OnLocationChange2(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, nsIURI *aLocation,
PRUint32 aFlags)
{
return OnLocationChange(aWebProgress, aRequest, aLocation);
}
NS_IMETHODIMP OnProgressChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,

Просмотреть файл

@ -309,15 +309,6 @@ nsBrowserStatusFilter::OnRefreshAttempted(nsIWebProgress *aWebProgress,
allowRefresh);
}
NS_IMETHODIMP
nsBrowserStatusFilter::OnLocationChange2(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsIURI *aLocation,
PRUint32 aFlags)
{
return OnLocationChange(aWebProgress, aRequest, aLocation);
}
//-----------------------------------------------------------------------------
// nsBrowserStatusFilter <private>
//-----------------------------------------------------------------------------

Просмотреть файл

@ -88,7 +88,6 @@ MockTransferForContinuing.prototype = {
aMaxTotalProgress) { },
onRefreshAttempted: function(aWebProgress, aRefreshURI, aMillis,
aSameURI) { },
onLocationChange2: function(aWebProgress, aRequest, aLocation, aFlags) { },
//////////////////////////////////////////////////////////////////////////////
//// nsITransfer

Просмотреть файл

@ -116,9 +116,6 @@ nsUnkownContentTypeDialogProgressListener.prototype = {
onRefreshAttempted: function( aWebProgress, aURI, aDelay, aSameURI ) {
return true;
},
onLocationChange2: function( aWebProgress, aRequest, aLocation, aFlags ) {
}
};

Просмотреть файл

@ -1352,8 +1352,7 @@ void nsDocLoader::FireOnStateChange(nsIWebProgress *aProgress,
void
nsDocLoader::FireOnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI *aUri,
PRUint32 aFlags)
nsIURI *aUri)
{
/*
* First notify any listeners of the new state info...
@ -1380,21 +1379,14 @@ nsDocLoader::FireOnLocationChange(nsIWebProgress* aWebProgress,
continue;
}
nsCOMPtr<nsIWebProgressListener2>
listener2(do_QueryReferent(info->mWeakListener));
if (listener2) {
listener2->OnLocationChange2(aWebProgress, aRequest, aUri, aFlags);
} else {
listener->OnLocationChange(aWebProgress, aRequest, aUri);
}
listener->OnLocationChange(aWebProgress, aRequest, aUri);
}
mListenerInfoList.Compact();
// Pass the notification up to the parent...
if (mParent) {
mParent->FireOnLocationChange(aWebProgress, aRequest, aUri, aFlags);
mParent->FireOnLocationChange(aWebProgress, aRequest, aUri);
}
}

Просмотреть файл

@ -165,8 +165,7 @@ protected:
void FireOnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI *aUri,
PRUint32 aFlags);
nsIURI *aUri);
PRBool RefreshAttempted(nsIWebProgress* aWebProgress,
nsIURI *aURI,

Просмотреть файл

@ -40,7 +40,7 @@
/**
* An extended version of nsIWebProgressListener.
*/
[scriptable, uuid(9fad5966-62ea-11e0-966c-001320257da5)]
[scriptable, uuid(dde39de0-e4e0-11da-8ad9-0800200c9a66)]
interface nsIWebProgressListener2 : nsIWebProgressListener {
/**
* Notification that the progress has changed for one of the requests
@ -99,42 +99,4 @@ interface nsIWebProgressListener2 : nsIWebProgressListener {
in nsIURI aRefreshURI,
in long aMillis,
in boolean aSameURI);
/**
* Flags for onLocationChange2
*
* LOCATION_CHANGE_NORMAL
* Nothing special.
*
* LOCATION_CHANGE_SAME_DOCUMENT
* This flag is on when |aWebProgress| did not load a new document.
* For example,
* 1. The user clicks that anchor in a document which is linking to
* [1.a.] the document itself.
* [1.b.] a location only <#hash> portion changed.
* 2. The user inputs [1.b.]'s URI in the location bar.
* 3. Session history navigation.
* [3.a.] history.pushState(...), history.replaceState(...) or
* history.popState(...) is called and |aWebProgress| wants to
* update the UI.
* [3.b.] Back/Forward/Go to URI of [1.a.], [1.b.] or [3.a.].
* [3.c.] After session history is cleared.
*/
const unsigned long LOCATION_CHANGE_NORMAL = 0x00000001;
const unsigned long LOCATION_CHANGE_SAME_DOCUMENT = 0x00000002;
/**
* This function is identical to nsIWebProgressListener::onLocationChange,
* except for aFlags argument.
*
* @param aFlags
* This is a value which explains the situation or the reason why
* the location has changed.
*/
void onLocationChange2(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in nsIURI aLocation,
in unsigned long aFlags);
};