зеркало из https://github.com/mozilla/gecko-dev.git
landing additional patch for bug 257308 "Visual indicators of site security appear for the wrong site" r=biesi sr=bz
This commit is contained in:
Родитель
dbede69b00
Коммит
bb70f70378
|
@ -166,7 +166,7 @@ interface nsIChannel : nsIRequest
|
|||
/**************************************************************************
|
||||
* Channel specific load flags:
|
||||
*
|
||||
* Bits 20-31 are reserved for future use by this interface or one of its
|
||||
* Bits 21-31 are reserved for future use by this interface or one of its
|
||||
* derivatives (e.g., see nsICachingChannel).
|
||||
*/
|
||||
|
||||
|
@ -187,11 +187,17 @@ interface nsIChannel : nsIRequest
|
|||
* another onStartRequest/onStopRequest pair. This flag is, for example,
|
||||
* used by the multipart/replace stream converter.
|
||||
*/
|
||||
const unsigned long LOAD_REPLACE = 1 << 18;
|
||||
const unsigned long LOAD_REPLACE = 1 << 18;
|
||||
|
||||
/**
|
||||
* Set (e.g., by the docshell) to indicate whether or not the channel
|
||||
* corresponds to an initial document URI load (e.g., link click).
|
||||
*/
|
||||
const unsigned long LOAD_INITIAL_DOCUMENT_URI = 1 << 19;
|
||||
|
||||
/**
|
||||
* Set (e.g., by the URILoader) to indicate whether or not the end consumer
|
||||
* for this load has been determined.
|
||||
*/
|
||||
const unsigned long LOAD_TARGETED = 1 << 20;
|
||||
};
|
||||
|
|
|
@ -500,7 +500,7 @@ nsDocLoaderImpl::OnStartRequest(nsIRequest *request, nsISupports *aCtxt)
|
|||
#endif /* PR_LOGGING */
|
||||
PRBool bJustStartedLoading = PR_FALSE;
|
||||
|
||||
PRUint32 loadFlags = 0;
|
||||
nsLoadFlags loadFlags = 0;
|
||||
request->GetLoadFlags(&loadFlags);
|
||||
|
||||
if (!mIsLoadingDocument && (loadFlags & nsIChannel::LOAD_DOCUMENT_URI)) {
|
||||
|
@ -1012,6 +1012,20 @@ NS_IMETHODIMP nsDocLoaderImpl::OnProgress(nsIRequest *aRequest, nsISupports* ctx
|
|||
if (info) {
|
||||
// suppress sending STATE_TRANSFERRING if this is upload progress (see bug 240053)
|
||||
if (!info->mUploading && (0 == info->mCurrentProgress) && (0 == info->mMaxProgress)) {
|
||||
//
|
||||
// If we receive an OnProgress event from a toplevel channel that the URI Loader
|
||||
// has not yet targeted, then we must suppress the event. This is necessary to
|
||||
// ensure that webprogresslisteners do not get confused when the channel is
|
||||
// finally targeted. See bug 257308.
|
||||
//
|
||||
nsLoadFlags lf = 0;
|
||||
aRequest->GetLoadFlags(&lf);
|
||||
if ((lf & nsIChannel::LOAD_DOCUMENT_URI) && !(lf & nsIChannel::LOAD_TARGETED)) {
|
||||
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
|
||||
("DocLoader:%p Ignoring OnProgress while load is not targeted\n", this));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// This is the first progress notification for the entry. If
|
||||
// (aMaxProgress > 0) then the content-length of the data is known,
|
||||
|
|
|
@ -568,11 +568,20 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
|
|||
do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &rv);
|
||||
if (helperAppService) {
|
||||
LOG((" Passing load off to helper app service"));
|
||||
|
||||
// Set these flags to indicate that the channel has been targeted and that
|
||||
// we are not using the original consumer.
|
||||
nsLoadFlags loadFlags = 0;
|
||||
request->GetLoadFlags(&loadFlags);
|
||||
request->SetLoadFlags(loadFlags | nsIChannel::LOAD_RETARGETED_DOCUMENT_URI
|
||||
| nsIChannel::LOAD_TARGETED);
|
||||
|
||||
rv = helperAppService->DoContent(mContentType,
|
||||
request,
|
||||
m_originalContext,
|
||||
getter_AddRefs(m_targetStreamListener));
|
||||
if (NS_FAILED(rv)) {
|
||||
request->SetLoadFlags(loadFlags);
|
||||
m_targetStreamListener = nsnull;
|
||||
}
|
||||
}
|
||||
|
@ -691,11 +700,16 @@ nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener,
|
|||
nsLoadFlags loadFlags = 0;
|
||||
aChannel->GetLoadFlags(&loadFlags);
|
||||
|
||||
// Set this flag to indicate that the channel has been targeted at a final
|
||||
// consumer. This load flag is tested in nsDocLoader::OnProgress.
|
||||
nsLoadFlags newLoadFlags = nsIChannel::LOAD_TARGETED;
|
||||
|
||||
nsCOMPtr<nsIURIContentListener> originalListener =
|
||||
do_GetInterface(m_originalContext);
|
||||
if (originalListener != aListener) {
|
||||
aChannel->SetLoadFlags(loadFlags | nsIChannel::LOAD_RETARGETED_DOCUMENT_URI);
|
||||
newLoadFlags |= nsIChannel::LOAD_RETARGETED_DOCUMENT_URI;
|
||||
}
|
||||
aChannel->SetLoadFlags(loadFlags | newLoadFlags);
|
||||
|
||||
PRBool abort = PR_FALSE;
|
||||
nsresult rv = aListener->DoContent(mContentType.get(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче