Bug 70595 - making nsIPrompt accessible to PSM. r=darin, sr=mscott.

This commit is contained in:
bryner%uiuc.edu 2001-03-06 05:10:33 +00:00
Родитель 8aeb50199f
Коммит 3f9323934e
38 изменённых файлов: 267 добавлений и 313 удалений

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

@ -173,11 +173,8 @@ nsDateTimeChannel::Open(nsIInputStream **_retval)
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
transport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
return transport->OpenInputStream(0, -1, 0, _retval);
}
@ -194,11 +191,8 @@ nsDateTimeChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
transport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
mListener = aListener;

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

@ -213,11 +213,8 @@ nsFingerChannel::Open(nsIInputStream **_retval)
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
mTransport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
return mTransport->OpenInputStream(0, -1, 0, _retval);
}
@ -234,11 +231,8 @@ nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
mTransport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
mListener = aListener;
mResponseContext = ctxt;

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

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
*/
#include "nsIChannelSecurityInfo.idl"
%{C++
#include "cmtcmn.h"
#include "nsPSMShimLayer.h"
%}
[ptr] native psmtControlStar(CMT_CONTROL);
[ptr] native cmSocketStar(CMSocket);
[ptr] native nsFileDescStar(PRFileDesc);
[noscript, uuid(deeb8dfc-fb7a-11d3-ac84-00c04fa0d26b)]
interface nsIPSMSocketInfo : nsIChannelSecurityInfo {
readonly attribute psmtControlStar controlPtr;
readonly attribute cmSocketStar socketPtr;
readonly attribute nsFileDescStar fileDescPtr;
void getPickledStatus(out charPtr pickledStatus);
};

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

@ -45,7 +45,6 @@
#include "nsIScriptGlobalObject.h"
#include "nsIURL.h"
#include "nsIXULWindow.h"
#include "nsIChannel.h"
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
@ -346,15 +345,13 @@ char * PromptUserCallback(void *arg, char *prompt, void* clientContext, int isPa
PRBool value;
nsCOMPtr<nsIPrompt> proxyPrompt;
nsIChannelSecurityInfo* csi = NS_STATIC_CAST(nsIChannelSecurityInfo*, clientContext);
nsCOMPtr<nsIChannel> channel;
nsITransportSecurityInfo* csi = NS_STATIC_CAST(nsITransportSecurityInfo*, clientContext);
nsCOMPtr<nsIInterfaceRequestor> callbacks;
if (csi) {
csi->GetChannel(getter_AddRefs(channel));
if (!channel) return nsnull;
csi->GetNotificationCallbacks(getter_AddRefs(callbacks));
}
nsCOMPtr<nsIInterfaceRequestor> callbacks;
channel->GetNotificationCallbacks(getter_AddRefs(callbacks));
if (!callbacks) return nsnull;
if (csi && callbacks) {
// The notification callbacks object may not be safe, so
// proxy the call to get the nsIPrompt.

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

@ -31,7 +31,7 @@
#include "nsSSLIOLayer.h"
#include "nsIWebProgressListener.h"
#include "nsISSLSocketControl.h"
#include "nsIChannel.h"
#include "nsIInterfaceRequestor.h"
static PRDescIdentity nsSSLIOLayerIdentity;
static PRIOMethods nsSSLIOLayerMethods;
@ -48,7 +48,7 @@ public:
virtual ~nsPSMSocketInfo();
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNELSECURITYINFO
NS_DECL_NSITRANSPORTSECURITYINFO
NS_DECL_NSIPSMSOCKETINFO
NS_DECL_NSISSLSOCKETCONTROL
@ -70,7 +70,7 @@ protected:
CMT_CONTROL* mControl;
CMSocket* mSocket;
PRFileDesc* mFd;
nsIChannel* mChannel;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsString mHostName;
PRInt32 mHostPort;
@ -355,7 +355,7 @@ nsPSMSocketInfo::~nsPSMSocketInfo()
PR_FREEIF(mPickledStatus);
}
NS_IMPL_THREADSAFE_ISUPPORTS3(nsPSMSocketInfo, nsIChannelSecurityInfo,
NS_IMPL_THREADSAFE_ISUPPORTS3(nsPSMSocketInfo, nsITransportSecurityInfo,
nsIPSMSocketInfo, nsISSLSocketControl);
// if the connection was via a proxy, we need to have the
@ -577,17 +577,17 @@ nsPSMSocketInfo::GetSecurityState(PRInt32 *aSecurityState)
}
NS_IMETHODIMP
nsPSMSocketInfo::GetChannel(nsIChannel** aChannel)
nsPSMSocketInfo::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
{
*aChannel = mChannel;
NS_IF_ADDREF(*aChannel);
*aCallbacks = mCallbacks;
NS_IF_ADDREF(*aCallbacks);
return NS_OK;
}
NS_IMETHODIMP
nsPSMSocketInfo::SetChannel(nsIChannel* aChannel)
nsPSMSocketInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)
{
mChannel = aChannel;
mCallbacks = aCallbacks;
return NS_OK;
}

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

@ -78,7 +78,11 @@ nsresult nsMsgProtocol::InitFromURI(nsIURI *aUrl)
nsMsgProtocol::~nsMsgProtocol()
{}
nsresult nsMsgProtocol::OpenNetworkSocketWithInfo(const char * aHostName, PRInt32 aGetPort, const char *connectionType)
nsresult
nsMsgProtocol::OpenNetworkSocketWithInfo(const char * aHostName,
PRInt32 aGetPort,
const char *connectionType,
nsIInterfaceRequestor* callbacks)
{
NS_ENSURE_ARG(aHostName);
@ -86,27 +90,34 @@ nsresult nsMsgProtocol::OpenNetworkSocketWithInfo(const char * aHostName, PRInt3
nsCOMPtr<nsISocketTransportService> socketService (do_GetService(kSocketTransportServiceCID));
NS_ENSURE_TRUE(socketService, NS_ERROR_FAILURE);
m_readCount = -1; // with socket connections we want to read as much data as arrives
m_startPosition = 0;
// with socket connections we want to read as much data as arrives
m_readCount = -1;
m_startPosition = 0;
rv = socketService->CreateTransportOfType(connectionType, aHostName, aGetPort, nsnull, -1, 0, 0, getter_AddRefs(m_transport));
rv = socketService->CreateTransportOfType(connectionType, aHostName,
aGetPort, nsnull, -1, 0, 0,
getter_AddRefs(m_transport));
if (NS_FAILED(rv)) return rv;
m_transport->SetNotificationCallbacks(callbacks, PR_FALSE);
m_socketIsOpen = PR_FALSE;
return SetupTransportState();
return SetupTransportState();
}
nsresult nsMsgProtocol::OpenNetworkSocket(nsIURI * aURL, const char *connectionType) // open a connection on this url
// open a connection on this url
nsresult
nsMsgProtocol::OpenNetworkSocket(nsIURI * aURL, const char *connectionType,
nsIInterfaceRequestor* callbacks)
{
NS_ENSURE_ARG(aURL);
nsXPIDLCString hostName;
PRInt32 port = 0;
PRInt32 port = 0;
aURL->GetPort(&port);
aURL->GetHost(getter_Copies(hostName));
aURL->GetPort(&port);
aURL->GetHost(getter_Copies(hostName));
return OpenNetworkSocketWithInfo(hostName, port, connectionType);
return OpenNetworkSocketWithInfo(hostName, port, connectionType, callbacks);
}
nsresult nsMsgProtocol::OpenFileSocket(nsIURI * aURL, const nsFileSpec * aFileSpec, PRUint32 aStartPosition, PRInt32 aReadCount)

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

@ -75,8 +75,18 @@ protected:
// methods for opening and closing a socket with core netlib....
// mscott -okay this is lame. I should break this up into a file protocol and a socket based
// protocool class instead of cheating and putting both methods here...
virtual nsresult OpenNetworkSocket(nsIURI * aURL, const char *connectionType); // open a connection on this url
virtual nsresult OpenNetworkSocketWithInfo(const char * aHostName, PRInt32 aGetPort, const char *connectionType); // open a connection with a specific host and port
// open a connection on this url
virtual nsresult OpenNetworkSocket(nsIURI * aURL,
const char *connectionType,
nsIInterfaceRequestor* callbacks);
// open a connection with a specific host and port
virtual nsresult OpenNetworkSocketWithInfo(const char * aHostName,
PRInt32 aGetPort,
const char *connectionType,
nsIInterfaceRequestor* callbacks);
virtual nsresult OpenFileSocket(nsIURI * aURL, const nsFileSpec * aFileSpec, PRUint32 aStartPosition, PRInt32 aReadCount); // used to open a file socket connection
// a Protocol typically overrides this method. They free any of their own connection state and then

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

@ -352,27 +352,23 @@ void nsSmtpProtocol::Initialize(nsIURI * aURL)
aURL->GetHost(getter_Copies(hostName));
PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Connecting to: %s", (const char *) hostName));
nsCOMPtr<nsIInterfaceRequestor> callbacks;
nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(aURL));
if (smtpUrl)
smtpUrl->GetNotificationCallbacks(getter_AddRefs(callbacks));
if (m_prefTrySSL != PREF_SSL_NEVER) {
rv = OpenNetworkSocket(aURL, "tls");
rv = OpenNetworkSocket(aURL, "tls", callbacks);
if (NS_FAILED(rv) && m_prefTrySSL == PREF_SSL_TRY) {
m_prefTrySSL = PREF_SSL_NEVER;
rv = OpenNetworkSocket(aURL, nsnull);
rv = OpenNetworkSocket(aURL, nsnull, callbacks);
}
} else {
rv = OpenNetworkSocket(aURL, nsnull);
rv = OpenNetworkSocket(aURL, nsnull, callbacks);
}
if (NS_FAILED(rv))
return;
nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(aURL));
if (smtpUrl) {
nsCOMPtr<nsIInterfaceRequestor> callbacks;
smtpUrl->GetNotificationCallbacks(getter_AddRefs(callbacks));
nsCOMPtr<nsIChannel> channel(do_QueryInterface(m_request));
if (channel)
channel->SetNotificationCallbacks(callbacks);
}
}
const char * nsSmtpProtocol::GetUserDomainName()
@ -1778,11 +1774,13 @@ NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionReply(const PRUnichar * aHost, u
// now that we have a host and port to connect to,
// open up the channel...
// pass in "ssl" for the last arg if you want this to be over SSL
{
nsCAutoString hostCStr; hostCStr.AssignWithConversion(aHost);
PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Connecting to: %s on port %d.", (const char *) hostCStr, aPort));
rv = OpenNetworkSocketWithInfo(hostCStr, aPort, nsnull);
}
nsCAutoString hostCStr; hostCStr.AssignWithConversion(aHost);
PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Connecting to: %s on port %d.", (const char *) hostCStr, aPort));
nsCOMPtr<nsIInterfaceRequestor> callbacks;
nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(m_runningURL));
if (smtpUrl)
smtpUrl->GetNotificationCallbacks(getter_AddRefs(callbacks));
rv = OpenNetworkSocketWithInfo(hostCStr, aPort, nsnull, callbacks);
// we are no longer waiting for a logon redirection reply
ClearFlag(SMTP_WAIT_FOR_REDIRECTION);

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

@ -606,6 +606,11 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
else
rv = socketService->CreateTransportOfType(connectionType, hostName, port, nsnull, -1, 0, 0, getter_AddRefs(m_channel));
// Ensure that the socket can get the notification callbacks
nsCOMPtr<nsIInterfaceRequestor> callbacks;
m_mockChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
m_channel->SetNotificationCallbacks(callbacks, PR_FALSE);
if (NS_SUCCEEDED(rv))
rv = m_channel->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream));
}
@ -618,16 +623,6 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
m_channel->GetSecurityInfo(getter_AddRefs(securityInfo));
m_mockChannel->SetSecurityInfo(securityInfo);
// Copy over the notification callbacks object from the mock channel
nsCOMPtr<nsIInterfaceRequestor> callbacks;
m_mockChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
if (callbacks) {
nsCOMPtr<nsIProgressEventSink> progressSink;
(void)callbacks->GetInterface(NS_GET_IID(nsIProgressEventSink),
getter_AddRefs(progressSink));
m_channel->SetProgressEventSink(progressSink);
}
// and if we have a cache entry that we are saving the message to, set the security info on it too.
// since imap only uses the memory cache, passing this on is the right thing to do.
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningUrl);

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

@ -51,6 +51,7 @@
#include "nsIPref.h"
#include "nsIMsgWindow.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
#include "nsIDocShell.h"
#define EXTRA_SAFETY_SPACE 3096
@ -423,8 +424,18 @@ nsresult nsPop3Protocol::Initialize(nsIURI * aURL)
}
m_url = do_QueryInterface(aURL);
nsCOMPtr<nsIInterfaceRequestor> ir;
nsCOMPtr<nsIMsgWindow> msgwin;
mailnewsUrl->GetMsgWindow(getter_AddRefs(msgwin));
if (msgwin) {
nsCOMPtr<nsIDocShell> docshell;
msgwin->GetRootDocShell(getter_AddRefs(docshell));
ir = do_QueryInterface(docshell);
}
// if the server is secure, pass in "ssl" for the last arg
rv = OpenNetworkSocket(aURL, nsnull);
rv = OpenNetworkSocket(aURL, nsnull, ir);
if(NS_FAILED(rv))
return rv;
} // if we got a url...

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

@ -74,6 +74,7 @@
#include "nsIMsgFolder.h"
#include "nsIMsgNewsFolder.h"
#include "nsIDocShell.h"
// for the memory cache...
#include "nsICachedNetData.h"
@ -588,12 +589,16 @@ NS_IMETHODIMP nsNNTPProtocol::Initialize(nsIURI * aURL, nsIMsgWindow *aMsgWindow
if (!m_socketIsOpen)
{
// call base class to set up the transport
nsCOMPtr<nsIDocShell> docShell;
aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIInterfaceRequestor> ir(do_QueryInterface(docShell));
// call base class to set up the transport
if (isSecure) {
rv = OpenNetworkSocket(m_url, "ssl-forcehandshake");
rv = OpenNetworkSocket(m_url, "ssl-forcehandshake", ir);
}
else {
rv = OpenNetworkSocket(m_url, nsnull);
rv = OpenNetworkSocket(m_url, nsnull, ir);
}
m_nextState = NNTP_LOGIN_RESPONSE;
}

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

@ -27,7 +27,7 @@ interface nsIStreamListener;
interface nsIStreamProvider;
interface nsIInputStream;
interface nsIOutputStream;
interface nsIProgressEventSink;
interface nsIInterfaceRequestor;
[scriptable, uuid(fd01f9a4-d492-4cf8-b76e-160ffc8c01e8)]
interface nsITransport : nsISupports
@ -38,9 +38,11 @@ interface nsITransport : nsISupports
readonly attribute nsISupports securityInfo;
/**
* Get/set the progress event sink for this transport.
* Get/set notificationCallbacks for this transport.
*/
attribute nsIProgressEventSink progressEventSink;
readonly attribute nsIInterfaceRequestor notificationCallbacks;
void setNotificationCallbacks(in nsIInterfaceRequestor callbacks,
in boolean isBackground);
/**
* Open an input stream on this transport.

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

@ -978,34 +978,34 @@ nsFileTransport::GetSecurityInfo(nsISupports * *aSecurityInfo)
return NS_OK;
}
NS_IMETHODIMP
nsFileTransport::GetProgressEventSink(nsIProgressEventSink **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_IF_ADDREF(*aResult = mProgress);
nsFileTransport::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks) {
NS_ENSURE_ARG_POINTER(aCallbacks);
*aCallbacks = mNotificationCallbacks;
NS_IF_ADDREF(*aCallbacks);
return NS_OK;
}
NS_IMETHODIMP
nsFileTransport::SetProgressEventSink(nsIProgressEventSink *aProgress)
{
mProgress = nsnull;
nsFileTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks,
PRBool isBackground) {
mNotificationCallbacks = aCallbacks;
mProgress = 0;
if (!mNotificationCallbacks || isBackground) return NS_OK;
if (aProgress) {
// Now generate a proxied event sink
nsresult rv;
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIProgressEventSink> sink(do_GetInterface(mNotificationCallbacks));
if (!sink) return NS_ERROR_FAILURE;
rv = proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
aProgress,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mProgress));
}
return NS_OK;
nsresult rv;
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
return proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
sink,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mProgress));
}
////////////////////////////////////////////////////////////////////////////////

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

@ -103,6 +103,7 @@ public:
protected:
nsCOMPtr<nsIProgressEventSink> mProgress;
nsCOMPtr<nsIInterfaceRequestor> mNotificationCallbacks;
nsCOMPtr<nsIStreamIO> mStreamIO;
char *mContentType;
PRUint32 mBufferSegmentSize;

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

@ -41,7 +41,7 @@
#include "nsXPIDLString.h"
#include "nsNetUtil.h"
#include "nsISSLSocketControl.h"
#include "nsIChannelSecurityInfo.h"
#include "nsITransportSecurityInfo.h"
#include "nsMemory.h"
#if defined(PR_LOGGING)
@ -133,6 +133,8 @@ nsSocketTransport::nsSocketTransport():
mProxyHost(nsnull),
mProxyTransparent(PR_FALSE),
mSSLProxy(PR_FALSE),
mCloseConnectionOnceDone(PR_FALSE),
mWasConnected(PR_FALSE),
mService(nsnull),
mReadWriteState(0),
mSelectFlags(0),
@ -149,9 +151,7 @@ nsSocketTransport::nsSocketTransport():
mBIS(nsnull),
mBOS(nsnull),
mReadRequest(nsnull),
mWriteRequest(nsnull),
mCloseConnectionOnceDone(PR_FALSE),
mWasConnected(PR_FALSE)
mWriteRequest(nsnull)
{
NS_INIT_REFCNT();
@ -711,12 +711,17 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags)
if (nsCRT::strcmp(mSocketTypes[type], "ssl") == 0 ||
nsCRT::strcmp(mSocketTypes[type], "tls") == 0) {
mSecurityInfo = socketInfo;
nsCOMPtr<nsITransportSecurityInfo> secInfo(do_QueryInterface(mSecurityInfo));
if (secInfo)
secInfo->SetNotificationCallbacks(mNotificationCallbacks);
}
else if (nsCRT::strcmp(mSocketTypes[type], "ssl-forcehandshake") == 0) {
mSecurityInfo = socketInfo;
nsCOMPtr<nsIChannelSecurityInfo> securityInfo = do_QueryInterface(mSecurityInfo, &rv);
if (NS_SUCCEEDED(rv) && securityInfo)
nsCOMPtr<nsITransportSecurityInfo> securityInfo = do_QueryInterface(mSecurityInfo, &rv);
if (NS_SUCCEEDED(rv) && securityInfo) {
securityInfo->SetForceHandshake(PR_TRUE);
securityInfo->SetNotificationCallbacks(mNotificationCallbacks);
}
}
else if (nsCRT::strcmp(mSocketTypes[type], "socks") == 0) {
// since socks is transparent, any layers above
@ -1164,33 +1169,36 @@ nsSocketTransport::GetSecurityInfo(nsISupports **info)
}
NS_IMETHODIMP
nsSocketTransport::GetProgressEventSink(nsIProgressEventSink **aResult)
nsSocketTransport::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mNonProxiedEventSink;
NS_IF_ADDREF(*aResult);
NS_ENSURE_ARG_POINTER(aCallbacks);
*aCallbacks = mNotificationCallbacks;
NS_IF_ADDREF(*aCallbacks);
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::SetProgressEventSink(nsIProgressEventSink *aEventSink)
nsSocketTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks,
PRBool isBackground)
{
mEventSink = mNonProxiedEventSink = 0;
if (aEventSink) {
mNonProxiedEventSink = aEventSink;
nsresult rv;
// Now generate a proxied event sink-
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
aEventSink,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mEventSink));
}
}
return NS_OK;
mNotificationCallbacks = aCallbacks;
mEventSink = 0;
if (!mNotificationCallbacks || isBackground) return NS_OK;
nsCOMPtr<nsIProgressEventSink> sink(do_GetInterface(mNotificationCallbacks));
if (!sink) return NS_ERROR_FAILURE;
// Now generate a proxied event sink-
nsresult rv;
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
return proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
sink,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mEventSink));
}

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

@ -38,6 +38,7 @@
#include "nsIDNSService.h"
#include "nsIPipe.h"
#include "nsIProgressEventSink.h"
#include "nsIInterfaceRequestor.h"
#define NS_SOCKET_TRANSPORT_SEGMENT_SIZE (2*1024)
#define NS_SOCKET_TRANSPORT_BUFFER_SIZE (8*1024)
@ -216,7 +217,7 @@ protected:
nsSocketState mCurrentState;
nsCOMPtr<nsIRequest> mDNSRequest;
nsCOMPtr<nsIProgressEventSink> mEventSink;
nsCOMPtr<nsIProgressEventSink> mNonProxiedEventSink;
nsCOMPtr<nsIInterfaceRequestor> mNotificationCallbacks;
char* mHostName;
PRInt32 mPort;
PRIntervalTime mLastActiveTime;
@ -231,6 +232,10 @@ protected:
PRPackedBool mProxyTransparent;
PRPackedBool mSSLProxy;
/* put all the packed bools together so we save space */
PRPackedBool mCloseConnectionOnceDone;
PRPackedBool mWasConnected;
nsSocketTransportService* mService;
PRUint32 mReadWriteState;
@ -241,7 +246,7 @@ protected:
PRUint32 mSocketTypeCount;
char* *mSocketTypes;
PRInt32 mBytesExpected;
PRInt32 mBytesExpected;
PRUint32 mReuseCount;
PRUint32 mLastReuseCount;
@ -254,9 +259,6 @@ protected:
nsSocketBOS *mBOS;
nsSocketReadRequest *mReadRequest;
nsSocketWriteRequest *mWriteRequest;
PRPackedBool mCloseConnectionOnceDone;
PRPackedBool mWasConnected;
};
/**

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

@ -619,6 +619,15 @@ nsDiskCacheRecordChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotif
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks,
PRBool isBackground)
{
// Not required to be implemented, since it is implemented by cache manager
NS_NOTREACHED("nsDiskCacheRecordChannel::SetNotificationCallbacks");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
@ -626,18 +635,6 @@ nsDiskCacheRecordChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
return NS_OK;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetProgressEventSink(nsIProgressEventSink **aSink)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetProgressEventSink(nsIProgressEventSink *aSink)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// nsIStreamListener methods:
////////////////////////////////////////////////////////////////////////////////

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

@ -53,12 +53,11 @@ class nsDiskCacheRecordChannel : public nsIChannel,
NS_DECL_NSICHANNEL
// Declare nsITransport methods
NS_IMETHOD GetProgressEventSink(nsIProgressEventSink **);
NS_IMETHOD SetProgressEventSink(nsIProgressEventSink *);
NS_IMETHOD OpenInputStream(PRUint32, PRUint32, PRUint32, nsIInputStream **);
NS_IMETHOD OpenOutputStream(PRUint32, PRUint32, PRUint32, nsIOutputStream **);
NS_IMETHOD AsyncRead(nsIStreamListener *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD AsyncWrite(nsIStreamProvider *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor*, PRBool);
// Declare nsIStreamObserver methods
NS_DECL_NSISTREAMOBSERVER

20
netwerk/cache/memcache/nsMemCacheChannel.cpp поставляемый
Просмотреть файл

@ -657,6 +657,15 @@ nsMemCacheChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMemCacheChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks,
PRBool isBackground)
{
// Not required to be implemented, since it is implemented by cache manager
NS_NOTREACHED("nsMemCacheChannel::SetNotificationCallbacks");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMemCacheChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
@ -664,14 +673,3 @@ nsMemCacheChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
return NS_OK;
}
NS_IMETHODIMP
nsMemCacheChannel::GetProgressEventSink(nsIProgressEventSink **aSink)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMemCacheChannel::SetProgressEventSink(nsIProgressEventSink *aSink)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

3
netwerk/cache/memcache/nsMemCacheChannel.h поставляемый
Просмотреть файл

@ -48,12 +48,11 @@ public:
NS_DECL_NSICHANNEL
// Declare nsITransport methods
NS_IMETHOD GetProgressEventSink(nsIProgressEventSink **);
NS_IMETHOD SetProgressEventSink(nsIProgressEventSink *);
NS_IMETHOD OpenInputStream(PRUint32, PRUint32, PRUint32, nsIInputStream **);
NS_IMETHOD OpenOutputStream(PRUint32, PRUint32, PRUint32, nsIOutputStream **);
NS_IMETHOD AsyncRead(nsIStreamListener *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD AsyncWrite(nsIStreamProvider *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor*, PRBool);
protected:
void NotifyStorageInUse(PRInt32 aBytesUsed);

11
netwerk/cache/mgr/nsCacheEntryChannel.cpp поставляемый
Просмотреть файл

@ -216,13 +216,20 @@ nsCacheEntryChannel::GetSecurityInfo(nsISupports **aResult)
}
NS_IMETHODIMP
nsCacheEntryChannel::GetProgressEventSink(nsIProgressEventSink **aSink)
nsCacheEntryChannel::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCacheEntryChannel::SetProgressEventSink(nsIProgressEventSink *aSink)
nsCacheEntryChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsCacheEntryChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks,
PRBool isBackground)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

5
netwerk/cache/mgr/nsCacheEntryChannel.h поставляемый
Просмотреть файл

@ -61,15 +61,16 @@ public:
NS_IMETHOD GetLoadGroup(nsILoadGroup* *aLoadGroup);
NS_IMETHOD GetURI(nsIURI * *aURI);
NS_IMETHOD GetOriginalURI(nsIURI * *aURI);
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor*);
// nsITransport methods
NS_IMETHOD GetSecurityInfo(nsISupports **);
NS_IMETHOD GetProgressEventSink(nsIProgressEventSink **);
NS_IMETHOD SetProgressEventSink(nsIProgressEventSink *);
NS_IMETHOD OpenInputStream(PRUint32, PRUint32, PRUint32, nsIInputStream **);
NS_IMETHOD OpenOutputStream(PRUint32, PRUint32, PRUint32, nsIOutputStream **);
NS_IMETHOD AsyncRead(nsIStreamListener *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD AsyncWrite(nsIStreamProvider *, nsISupports *, PRUint32, PRUint32, PRUint32, nsIRequest **);
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor**);
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor*, PRBool);
protected:
nsCacheEntryChannel(nsCachedNetData* aCacheEntry, nsIChannel* aChannel, nsILoadGroup* aLoadGroup);

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

@ -173,11 +173,8 @@ nsDateTimeChannel::Open(nsIInputStream **_retval)
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
transport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
return transport->OpenInputStream(0, -1, 0, _retval);
}
@ -194,11 +191,8 @@ nsDateTimeChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
transport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
mListener = aListener;

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

@ -230,8 +230,8 @@ nsFileChannel::EnsureTransport()
getter_AddRefs(mFileTransport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks && !(mLoadAttributes & LOAD_BACKGROUND))
(void)mFileTransport->SetProgressEventSink(this);
mFileTransport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
return rv;
}

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

@ -213,11 +213,8 @@ nsFingerChannel::Open(nsIInputStream **_retval)
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
mTransport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
return mTransport->OpenInputStream(0, -1, 0, _retval);
}
@ -234,11 +231,8 @@ nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
mTransport->SetNotificationCallbacks(mCallbacks,
(mLoadAttributes & LOAD_BACKGROUND));
mListener = aListener;
mResponseContext = ctxt;

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

@ -1702,12 +1702,9 @@ nsFtpState::R_pasv() {
if (NS_FAILED(sTrans->SetReuseConnection(PR_FALSE))) return FTP_ERROR;
// hook ourself up as a proxy for progress notifications
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mChannel));
if (requestor) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(requestor);
if (sink)
mDPipe->SetProgressEventSink(sink);
}
nsCOMPtr<nsIInterfaceRequestor> callbacks;
mChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
mDPipe->SetNotificationCallbacks(callbacks, PR_FALSE);
// we're connected figure out what type of transfer we're doing (ascii or binary)
nsXPIDLCString type;
@ -2050,7 +2047,7 @@ nsFtpState::KillControlConnnection() {
// if the control goes away, the data socket goes away...
if (mDPipe) {
mDPipe->SetProgressEventSink(nsnull);
mDPipe->SetNotificationCallbacks(nsnull, PR_FALSE);
mDPipe = 0;
mDPipeRequest = 0;
}

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

@ -1028,6 +1028,14 @@ nsresult nsHTTPHandler::RequestTransport(nsIURI* i_Uri,
if (NS_FAILED(rv)) return rv;
nsLoadFlags flags = nsIChannel::LOAD_NORMAL;
i_Channel->GetLoadAttributes(&flags);
nsCOMPtr<nsIInterfaceRequestor> callbacks;
i_Channel->GetNotificationCallbacks(getter_AddRefs(callbacks));
trans->SetNotificationCallbacks(callbacks,
(flags & nsIChannel::LOAD_BACKGROUND));
nsCOMPtr<nsISocketTransport> socketTrans = do_QueryInterface(trans, &rv);
if (NS_SUCCEEDED(rv)) {
socketTrans->SetSocketTimeout(mRequestTimeout);
@ -1217,7 +1225,7 @@ nsHTTPHandler::ReleaseTransport (nsITransport* i_pTrans ,
// to the transport and the transport which references the HTTPChannel
// through the event sink...
//
rv = i_pTrans->SetProgressEventSink(nsnull);
rv = i_pTrans->SetNotificationCallbacks(nsnull, PR_FALSE);
rv = mTransportList->RemoveElement(i_pTrans);
NS_ASSERTION(NS_SUCCEEDED(rv), "Transport not in table...");

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

@ -733,17 +733,10 @@ nsHTTPPipelinedRequest::WriteRequest(nsIInputStream* iRequestStream)
nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL;
req->mConnection->GetLoadAttributes(&loadAttributes);
if (loadAttributes & nsIChannel::LOAD_BACKGROUND)
mTransport->SetProgressEventSink(nsnull);
else {
//
// configure transport with the progress event sink from the first request.
//
nsCOMPtr<nsIProgressEventSink> sink =
do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor*, req->mConnection));
if (sink)
mTransport->SetProgressEventSink(sink);
}
nsCOMPtr<nsIInterfaceRequestor> callbacks;
req->mConnection->GetNotificationCallbacks(getter_AddRefs(callbacks));
mTransport->SetNotificationCallbacks(callbacks,
(loadAttributes & nsIChannel::LOAD_BACKGROUND));
}
mOnStopDone = PR_FALSE;
@ -1230,12 +1223,13 @@ nsHTTPPipelinedRequest::AdvanceToNextRequest()
// on some machines, but not on others. Check for null to avoid
// topcrash, although we really shouldn't need this.
NS_ASSERTION(mTransport, "mTransport null in AdvanceToNextRequest");
if (mTransport) {
nsCOMPtr<nsIProgressEventSink> sink =
do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor*, req->mConnection));
if (sink)
mTransport->SetProgressEventSink(sink);
}
nsLoadFlags flags = nsIChannel::LOAD_NORMAL;
req->mConnection->GetLoadAttributes(&flags);
nsCOMPtr<nsIInterfaceRequestor> callbacks;
mTransport->GetNotificationCallbacks(getter_AddRefs(callbacks));
mTransport->SetNotificationCallbacks(callbacks,
(flags & nsIChannel::LOAD_BACKGROUND));
NS_RELEASE(req);
}

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

@ -1,10 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist:idl directory
#
nsISocketProvider.idl
nsISocketProviderService.idl
nsISSLSocketProvider.idl
nsIChannelSecurityInfo.idl
nsISSLSocketControl.idl

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

@ -39,7 +39,7 @@ XPIDLSRCS = \
nsISOCKSSocketProvider.idl \
nsISOCKSSocketInfo.idl \
nsISSLSocketProvider.idl \
nsIChannelSecurityInfo.idl \
nsITransportSecurityInfo.idl \
nsISSLSocketControl.idl \
$(NULL)

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

@ -55,7 +55,7 @@ XPIDLSRCS= \
.\nsISOCKSSocketProvider.idl \
.\nsISOCKSSocketInfo.idl \
.\nsISSLSocketProvider.idl \
.\nsIChannelSecurityInfo.idl \
.\nsITransportSecurityInfo.idl \
.\nsISSLSocketControl.idl \
$(NULL)

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

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

@ -262,10 +262,10 @@ nsNSSDialogs::SetPassword(nsIInterfaceRequestor *ctx,
return rv;
}
/* boolean unknownIssuer (in nsIChannelSecurityInfo socketInfo,
/* boolean unknownIssuer (in nsITransportSecurityInfo socketInfo,
in nsIX509Cert cert, out addType); */
NS_IMETHODIMP
nsNSSDialogs::UnknownIssuer(nsIChannelSecurityInfo *socketInfo,
nsNSSDialogs::UnknownIssuer(nsITransportSecurityInfo *socketInfo,
nsIX509Cert *cert, PRInt16 *outAddType,
PRBool *_retval)
{
@ -325,12 +325,12 @@ nsNSSDialogs::UnknownIssuer(nsIChannelSecurityInfo *socketInfo,
return NS_OK;
}
/* boolean mismatchDomain (in nsIChannelSecurityInfo socketInfo,
/* boolean mismatchDomain (in nsITransportSecurityInfo socketInfo,
in wstring targetURL,
in nsIX509Cert cert); */
NS_IMETHODIMP
nsNSSDialogs::MismatchDomain(nsIChannelSecurityInfo *socketInfo,
nsNSSDialogs::MismatchDomain(nsITransportSecurityInfo *socketInfo,
const PRUnichar *targetURL,
nsIX509Cert *cert, PRBool *_retval)
{
@ -372,10 +372,10 @@ nsNSSDialogs::MismatchDomain(nsIChannelSecurityInfo *socketInfo,
return NS_OK;
}
/* boolean certExpired (in nsIChannelSecurityInfo socketInfo,
/* boolean certExpired (in nsITransportSecurityInfo socketInfo,
in nsIX509Cert cert); */
NS_IMETHODIMP
nsNSSDialogs::CertExpired(nsIChannelSecurityInfo *socketInfo,
nsNSSDialogs::CertExpired(nsITransportSecurityInfo *socketInfo,
nsIX509Cert *cert, PRBool *_retval)
{
nsresult rv;

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

@ -36,7 +36,7 @@
#include "nsISupports.idl"
interface nsIX509Cert;
interface nsIChannelSecurityInfo;
interface nsITransportSecurityInfo;
[scriptable, uuid(86960956-edb0-11d4-998b-00b0d02354a0)]
interface nsIBadCertListener : nsISupports {
@ -44,15 +44,15 @@ interface nsIBadCertListener : nsISupports {
const short UNINIT_ADD_FLAG = -1;
const short ADD_TRUSTED_FOR_SESSION =1;
const short ADD_TRUSTED_PERMANENTLY = 2;
boolean unknownIssuer(in nsIChannelSecurityInfo socketInfo,
boolean unknownIssuer(in nsITransportSecurityInfo socketInfo,
in nsIX509Cert cert,
out short certAddType);
boolean mismatchDomain(in nsIChannelSecurityInfo socketInfo,
boolean mismatchDomain(in nsITransportSecurityInfo socketInfo,
in wstring targetURL,
in nsIX509Cert cert);
boolean certExpired(in nsIChannelSecurityInfo socketInfo,
boolean certExpired(in nsITransportSecurityInfo socketInfo,
in nsIX509Cert cert);
};

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

@ -32,7 +32,6 @@
#include "nsINetSupportDialogService.h"
#include "nsIPrompt.h"
#include "nsProxiedService.h"
#include "nsIChannel.h"
#include "nsIInterfaceRequestor.h"
#include "ssl.h"
@ -74,7 +73,10 @@ char* PK11PasswordPrompt(PK11SlotInfo* slot, PRBool retry, void* arg) {
// Get the desired interface
nsCOMPtr<nsIPrompt> prompt(do_GetInterface(proxiedCallbacks));
if (!prompt) return nsnull;
if (!prompt) {
NS_ASSERTION(PR_FALSE, "callbacks does not implement nsIPrompt");
return nsnull;
}
// Finally, get a proxy for the nsIPrompt
proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ,
@ -83,10 +85,6 @@ char* PK11PasswordPrompt(PK11SlotInfo* slot, PRBool retry, void* arg) {
PROXY_SYNC,
getter_AddRefs(proxyPrompt));
if (!proxyPrompt) {
NS_ASSERTION(PR_FALSE, "callbacks does not implement nsIPrompt");
return nsnull;
}
nsString promptString;
nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));

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

@ -100,8 +100,7 @@ void MyLogFunction(const char *fmt, ...)
#endif
nsNSSSocketInfo::nsNSSSocketInfo()
: mChannel(nsnull),
mFd(nsnull),
: mFd(nsnull),
mSecurityState(nsIWebProgressListener::STATE_IS_INSECURE),
mForceHandshake(PR_FALSE),
mUseTLS(PR_FALSE)
@ -114,7 +113,7 @@ nsNSSSocketInfo::~nsNSSSocketInfo()
}
NS_IMPL_THREADSAFE_ISUPPORTS3(nsNSSSocketInfo,
nsIChannelSecurityInfo,
nsITransportSecurityInfo,
nsISSLSocketControl,
nsIInterfaceRequestor)
@ -185,17 +184,17 @@ nsNSSSocketInfo::SetProxyPort(PRInt32 aPort)
}
NS_IMETHODIMP
nsNSSSocketInfo::GetChannel(nsIChannel** aChannel)
nsNSSSocketInfo::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
{
*aChannel = mChannel;
NS_IF_ADDREF(*aChannel);
*aCallbacks = mCallbacks;
NS_IF_ADDREF(*aCallbacks);
return NS_OK;
}
NS_IMETHODIMP
nsNSSSocketInfo::SetChannel(nsIChannel* aChannel)
nsNSSSocketInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)
{
mChannel = aChannel;
mCallbacks = aCallbacks;
return NS_OK;
}
@ -231,16 +230,12 @@ nsNSSSocketInfo::SetShortSecurityDescription(const PRUnichar* aText) {
/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
NS_IMETHODIMP nsNSSSocketInfo::GetInterface(const nsIID & uuid, void * *result)
{
if (!mChannel) return NS_ERROR_FAILURE;
nsCOMPtr<nsIInterfaceRequestor> callbacks;
mChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
if (!callbacks) return NS_ERROR_FAILURE;
if (!mCallbacks) return NS_ERROR_FAILURE;
// Proxy of the channel callbacks should probably go here, rather
// than in the password callback code
return callbacks->GetInterface(uuid, result);
return mCallbacks->GetInterface(uuid, result);
}
NS_IMETHODIMP
@ -641,8 +636,8 @@ nsContinueDespiteCertError(nsNSSSocketInfo *infoObject,
NS_GET_IID(nsIBadCertListener));
if (NS_FAILED(rv))
return PR_FALSE;
nsIChannelSecurityInfo *csi = NS_STATIC_CAST(nsIChannelSecurityInfo*,
infoObject);
nsITransportSecurityInfo *csi = NS_STATIC_CAST(nsITransportSecurityInfo*,
infoObject);
NS_ADDREF(nssCert);
nsIX509Cert *callBackCert = NS_STATIC_CAST(nsIX509Cert*, nssCert);
CERTCertificate *peerCert = nssCert->GetCert();

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

@ -28,21 +28,21 @@
#include "prio.h"
#include "nsString.h"
#include "nsIInterfaceRequestor.h"
#include "nsIChannelSecurityInfo.h"
#include "nsITransportSecurityInfo.h"
#include "nsISSLSocketControl.h"
class nsIChannel;
class nsNSSSocketInfo : public nsIChannelSecurityInfo,
class nsNSSSocketInfo : public nsITransportSecurityInfo,
public nsISSLSocketControl,
public nsIInterfaceRequestor
public nsIInterfaceRequestor
{
public:
nsNSSSocketInfo();
virtual ~nsNSSSocketInfo();
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNELSECURITYINFO
NS_DECL_NSITRANSPORTSECURITYINFO
NS_DECL_NSISSLSOCKETCONTROL
NS_DECL_NSIINTERFACEREQUESTOR
@ -68,8 +68,7 @@ protected:
nsString mProxyName;
PRInt32 mProxyPort;
nsIChannel* mChannel; // note, don't use an owning reference
// to avoid circular references
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
PRFileDesc* mFd;
PRInt32 mSecurityState;
nsString mShortDesc;

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

@ -55,7 +55,7 @@
#include "nsIContent.h"
#include "nsIWebProgress.h"
#include "nsIChannel.h"
#include "nsIChannelSecurityInfo.h"
#include "nsITransportSecurityInfo.h"
#include "nsIURI.h"
#include "nsISecurityEventSink.h"
#include "nsIPrompt.h"
@ -204,9 +204,9 @@ static PRInt16 GetSecurityStateFromChannel(nsIChannel* aChannel)
// qi for the psm information about this channel load.
nsCOMPtr<nsISupports> info;
aChannel->GetSecurityInfo(getter_AddRefs(info));
nsCOMPtr<nsIChannelSecurityInfo> psmInfo(do_QueryInterface(info));
nsCOMPtr<nsITransportSecurityInfo> psmInfo(do_QueryInterface(info));
if (!psmInfo) {
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - no nsIChannelSecurityInfo for %p\n",
PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - no nsITransportSecurityInfo for %p\n",
aChannel, (nsISupports *)info));
return nsIWebProgressListener::STATE_IS_INSECURE;
}
@ -348,7 +348,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
nsCOMPtr<nsISupports> info;
channel->GetSecurityInfo(getter_AddRefs(info));
if (info) {
nsCOMPtr<nsIChannelSecurityInfo> secInfo(do_QueryInterface(info));
nsCOMPtr<nsITransportSecurityInfo> secInfo(do_QueryInterface(info));
if (secInfo &&
NS_SUCCEEDED(secInfo->GetShortSecurityDescription(&tooltip)) &&
tooltip) {