зеркало из https://github.com/mozilla/gecko-dev.git
Relanding Necko Changes.
Revising nsIChannel to allow for overlapped i/o. This consists of three parts: 1. Factoring nsIChannel into a protocol specific part, the nsIChannel, and a socket specific, the nsITransport. 2. Derive the nsIChannel from a nsIRequest. 2. Changes the notification system from necko and the URILoader to pass the nsIRequest interface instead of nsIChannel interface. This goal stems from wanting to be able to have active AsyncRead and AsyncWrite operations on nsSocketTransport. This is desired because it would greatly simplify the task of maintaining persistent/reusable socket connections for FTP, HTTP, and Imap (and potentially other protocols). The problem with the existing nsIChannel interface is that it does not allow one to selectively suspend just one of the read or write operations while keeping the other active. r=darin@netscape.com sr=rpotts@netscape.com
This commit is contained in:
Родитель
6e2d9268f5
Коммит
128f95aa9b
|
@ -116,27 +116,25 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest
|
||||
NS_IMETHOD GetName(PRUnichar* *result) {
|
||||
NS_NOTREACHED("nsCachedChromeChannel::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD GetName(PRUnichar* *result) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD IsPending(PRBool *_retval) { *_retval = PR_TRUE; return NS_OK; }
|
||||
NS_IMETHOD GetStatus(nsresult *status) { *status = mStatus; return NS_OK; }
|
||||
NS_IMETHOD Cancel(nsresult status) { mStatus = status; return NS_OK; }
|
||||
NS_IMETHOD Suspend(void) { return NS_OK; }
|
||||
NS_IMETHOD Resume(void) { return NS_OK; }
|
||||
|
||||
// nsIChannel
|
||||
|
||||
// nsIChannel
|
||||
NS_DECL_NSICHANNEL
|
||||
|
||||
};
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* nsCachedChromeChannel::gLog;
|
||||
#endif
|
||||
|
||||
NS_IMPL_ADDREF(nsCachedChromeChannel);
|
||||
NS_IMPL_RELEASE(nsCachedChromeChannel);
|
||||
NS_IMPL_QUERY_INTERFACE2(nsCachedChromeChannel, nsIRequest, nsIChannel);
|
||||
NS_IMPL_ISUPPORTS2(nsCachedChromeChannel,
|
||||
nsIChannel,
|
||||
nsIRequest);
|
||||
|
||||
nsresult
|
||||
nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
|
||||
|
@ -211,7 +209,7 @@ nsCachedChromeChannel::SetURI(nsIURI* aURI)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
nsCachedChromeChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
// NS_NOTREACHED("don't do that");
|
||||
*_retval = nsnull;
|
||||
|
@ -219,15 +217,7 @@ nsCachedChromeChannel::OpenInputStream(nsIInputStream **_retval)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("don't do that");
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
nsCachedChromeChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
if (listener) {
|
||||
nsresult rv;
|
||||
|
@ -237,7 +227,7 @@ nsCachedChromeChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
("nsCachedChromeChannel[%p]: adding self to load group %p",
|
||||
this, mLoadGroup.get()));
|
||||
|
||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
||||
rv = mLoadGroup->AddRequest(this, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -257,7 +247,7 @@ nsCachedChromeChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
("nsCachedChromeChannel[%p]: removing self from load group %p",
|
||||
this, mLoadGroup.get()));
|
||||
|
||||
(void) mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
||||
(void) mLoadGroup->RemoveRequest(this, nsnull, nsnull, nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -271,10 +261,9 @@ nsCachedChromeChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
|
||||
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
NS_NOTREACHED("don't do that");
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -291,113 +280,6 @@ nsCachedChromeChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetContentType(char * *aContentType)
|
||||
{
|
||||
*aContentType = nsXPIDLCString::Copy("text/cached-xul");
|
||||
return *aContentType ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
// Do not allow the content-type to be changed.
|
||||
NS_NOTREACHED("don't do that");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("don't do that");
|
||||
*aContentLength = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
*file = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetOwner(nsISupports * *aOwner)
|
||||
{
|
||||
|
@ -441,12 +323,34 @@ nsCachedChromeChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotific
|
|||
return NS_OK; // ignored
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
nsCachedChromeChannel::GetContentType(char * *aContentType)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
*aContentType = nsXPIDLCString::Copy("text/cached-xul");
|
||||
return *aContentType ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
// Do not allow the content-type to be changed.
|
||||
NS_NOTREACHED("don't do that");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("don't do that");
|
||||
*aContentLength = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsCachedChromeChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -523,12 +427,14 @@ nsCachedChromeChannel::HandleStopLoadEvent(PLEvent* aEvent)
|
|||
// remove it from the load group.
|
||||
LoadEvent* event = NS_REINTERPRET_CAST(LoadEvent*, aEvent);
|
||||
nsCachedChromeChannel* channel = event->mChannel;
|
||||
nsIRequest* request = NS_REINTERPRET_CAST(nsIRequest*, channel);
|
||||
|
||||
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsCachedChromeChannel[%p]: firing OnStopRequest for %p",
|
||||
channel, channel->mListener.get()));
|
||||
|
||||
(void) channel->mListener->OnStopRequest(channel, channel->mContext,
|
||||
(void) channel->mListener->OnStopRequest(request, channel->mContext,
|
||||
channel->mStatus, nsnull);
|
||||
|
||||
if (channel->mLoadGroup) {
|
||||
|
@ -536,7 +442,7 @@ nsCachedChromeChannel::HandleStopLoadEvent(PLEvent* aEvent)
|
|||
("nsCachedChromeChannel[%p]: removing self from load group %p",
|
||||
channel, channel->mLoadGroup.get()));
|
||||
|
||||
(void) channel->mLoadGroup->RemoveChannel(channel, nsnull, nsnull, nsnull);
|
||||
(void) channel->mLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull);
|
||||
}
|
||||
|
||||
channel->mListener = nsnull;
|
||||
|
|
|
@ -298,7 +298,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
|
|||
}
|
||||
|
||||
// Start reading from the channel
|
||||
rv = channel->AsyncRead(listener, nsnull);
|
||||
rv = channel->AsyncOpen(listener, nsnull);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (modalEventQueue) {
|
||||
|
|
|
@ -4715,8 +4715,12 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
nsCOMPtr<nsIHTTPChannel> httpChannel;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = aLoader->GetChannel(getter_AddRefs(channel));
|
||||
NS_ASSERTION(channel, "StreamLoader's channel went away prematurely");
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
rv = aLoader->GetRequest(getter_AddRefs(request));
|
||||
NS_ASSERTION(request, "StreamLoader's request went away prematurely");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
channel = do_QueryInterface(request);
|
||||
|
||||
if (channel) {
|
||||
httpChannel = do_QueryInterface(channel);
|
||||
|
|
|
@ -596,33 +596,35 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
rv = fileChannel->GetFile(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
// if we failed to get a last modification date, then we don't want to necessarily
|
||||
// fail to create a document for this file. Just don't set the last modified date on it...
|
||||
rv = file->GetLastModificationDate(&modDate);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRExplodedTime prtime;
|
||||
char buf[100];
|
||||
PRInt64 intermediateValue;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// if we failed to get a last modification date, then we don't want to necessarily
|
||||
// fail to create a document for this file. Just don't set the last modified date on it...
|
||||
rv = file->GetLastModificationDate(&modDate);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRExplodedTime prtime;
|
||||
char buf[100];
|
||||
PRInt64 intermediateValue;
|
||||
|
||||
LL_I2L(intermediateValue, PR_USEC_PER_MSEC);
|
||||
LL_MUL(usecs, modDate, intermediateValue);
|
||||
PR_ExplodeTime(usecs, PR_LocalTimeParameters, &prtime);
|
||||
LL_I2L(intermediateValue, PR_USEC_PER_MSEC);
|
||||
LL_MUL(usecs, modDate, intermediateValue);
|
||||
PR_ExplodeTime(usecs, PR_LocalTimeParameters, &prtime);
|
||||
|
||||
// Use '%#c' for windows, because '%c' is backward-compatible and
|
||||
// non-y2k with msvc; '%#c' requests that a full year be used in the
|
||||
// result string. Other OSes just use "%c".
|
||||
PR_FormatTime(buf, sizeof buf,
|
||||
#if defined(XP_PC) && !defined(XP_OS2)
|
||||
"%#c",
|
||||
#else
|
||||
"%c",
|
||||
#endif
|
||||
&prtime);
|
||||
lastModified.AssignWithConversion(buf);
|
||||
SetLastModified(lastModified);
|
||||
}
|
||||
// Use '%#c' for windows, because '%c' is backward-compatible and
|
||||
// non-y2k with msvc; '%#c' requests that a full year be used in the
|
||||
// result string. Other OSes just use "%c".
|
||||
PR_FormatTime(buf, sizeof buf,
|
||||
#if defined(XP_PC) && !defined(XP_OS2)
|
||||
"%#c",
|
||||
#else
|
||||
"%c",
|
||||
#endif
|
||||
&prtime);
|
||||
lastModified.AssignWithConversion(buf);
|
||||
SetLastModified(lastModified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
|
||||
|
|
|
@ -121,10 +121,14 @@ ImageListener::~ImageListener()
|
|||
NS_IMPL_THREADSAFE_ISUPPORTS1(ImageListener, nsIStreamListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageListener::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
||||
ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIURI* uri;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (!channel) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
rv = channel->GetURI(&uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -133,11 +137,11 @@ ImageListener::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
if (nsnull == mNextStream) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mNextStream->OnStartRequest(channel, ctxt);
|
||||
return mNextStream->OnStartRequest(request, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||
ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
{
|
||||
if(mDocument){
|
||||
|
@ -147,17 +151,17 @@ ImageListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
|||
if (nsnull == mNextStream) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mNextStream->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
return mNextStream->OnStopRequest(request, ctxt, status, errorMsg);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageListener::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt,
|
||||
ImageListener::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
|
||||
nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
if (nsnull == mNextStream) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mNextStream->OnDataAvailable(channel, ctxt, inStr, sourceOffset, count);
|
||||
return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -260,38 +260,37 @@ nsXBLStreamListener::~nsXBLStreamListener()
|
|||
}
|
||||
}
|
||||
|
||||
/* void onDataAvailable (in nsIChannel channel, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
|
||||
NS_IMETHODIMP
|
||||
nsXBLStreamListener::OnDataAvailable(nsIChannel* aChannel, nsISupports* aCtxt, nsIInputStream* aInStr,
|
||||
nsXBLStreamListener::OnDataAvailable(nsIRequest *request, nsISupports* aCtxt, nsIInputStream* aInStr,
|
||||
PRUint32 aSourceOffset, PRUint32 aCount)
|
||||
{
|
||||
if (mInner)
|
||||
return mInner->OnDataAvailable(aChannel, aCtxt, aInStr, aSourceOffset, aCount);
|
||||
return mInner->OnDataAvailable(request, aCtxt, aInStr, aSourceOffset, aCount);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP
|
||||
nsXBLStreamListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aCtxt)
|
||||
nsXBLStreamListener::OnStartRequest(nsIRequest* request, nsISupports* aCtxt)
|
||||
{
|
||||
if (mInner)
|
||||
return mInner->OnStartRequest(aChannel, aCtxt);
|
||||
return mInner->OnStartRequest(request, aCtxt);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
|
||||
NS_IMETHODIMP
|
||||
nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
nsXBLStreamListener::OnStopRequest(nsIRequest* request, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mInner) {
|
||||
rv = mInner->OnStopRequest(aChannel, aCtxt, aStatus, aStatusArg);
|
||||
rv = mInner->OnStopRequest(request, aCtxt, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || NS_FAILED(aStatus))
|
||||
{
|
||||
if (aChannel)
|
||||
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIURI> channelURI;
|
||||
aChannel->GetURI(getter_AddRefs(channelURI));
|
||||
|
@ -1191,7 +1190,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
if (aBoundDocument)
|
||||
aBoundDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
|
||||
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), aURI, nsnull, loadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1233,18 +1232,22 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||
xblListener->AddRequest(req);
|
||||
|
||||
// Now kick off the async read.
|
||||
channel->AsyncRead(xblListener, nsnull);
|
||||
channel->AsyncOpen(xblListener, nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Now do a blocking synchronous parse of the file.
|
||||
nsCOMPtr<nsIInputStream> in;
|
||||
PRUint32 sourceOffset = 0;
|
||||
rv = channel->OpenInputStream(getter_AddRefs(in));
|
||||
rv = channel->Open(getter_AddRefs(in));
|
||||
|
||||
// If we couldn't open the channel, then just return.
|
||||
if (NS_FAILED(rv)) return NS_OK;
|
||||
|
||||
|
||||
request = do_QueryInterface(channel);
|
||||
|
||||
NS_ASSERTION(request != nsnull, "no request info");
|
||||
|
||||
NS_ASSERTION(in != nsnull, "no input stream");
|
||||
if (! in) return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -1253,7 +1256,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||
if (! proxy)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
listener->OnStartRequest(channel, nsnull);
|
||||
listener->OnStartRequest(request, nsnull);
|
||||
while (PR_TRUE) {
|
||||
char buf[1024];
|
||||
PRUint32 readCount;
|
||||
|
@ -1266,12 +1269,12 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||
|
||||
proxy->SetBuffer(buf, readCount);
|
||||
|
||||
rv = listener->OnDataAvailable(channel, nsnull, proxy, sourceOffset, readCount);
|
||||
rv = listener->OnDataAvailable(request, nsnull, proxy, sourceOffset, readCount);
|
||||
sourceOffset += readCount;
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
}
|
||||
listener->OnStopRequest(channel, nsnull, NS_OK, nsnull);
|
||||
listener->OnStopRequest(request, nsnull, NS_OK, nsnull);
|
||||
|
||||
// don't leak proxy!
|
||||
proxy->Close();
|
||||
|
|
|
@ -1664,7 +1664,11 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
if (NS_OK == aStatus) {
|
||||
{ // scope in block so nsCOMPtr released at one point
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
aLoader->GetChannel(getter_AddRefs(channel));
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
aLoader->GetRequest(getter_AddRefs(request));
|
||||
if (request)
|
||||
channel = do_QueryInterface(request);
|
||||
|
||||
nsCOMPtr<nsIURI> url;
|
||||
if (channel) {
|
||||
channel->GetURI(getter_AddRefs(url));
|
||||
|
|
|
@ -77,6 +77,12 @@
|
|||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_CID(kHTMLStyleSheetCID,NS_HTMLSTYLESHEET_CID);
|
||||
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
|
@ -350,7 +356,7 @@ nsXMLDocument::Load(const nsAReadableString& aUrl)
|
|||
}
|
||||
|
||||
// Start an asynchronous read of the XML document
|
||||
rv = channel->AsyncRead(listener, nsnull);
|
||||
rv = channel->AsyncOpen(listener, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -380,8 +386,10 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
rv = aChannel->GetURI(getter_AddRefs(aUrl));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = aChannel->GetContentType(&aContentType);
|
||||
|
||||
nsCOMPtr<nsIMIMEService> MIMEService (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = MIMEService->GetTypeFromURI(aUrl, &aContentType);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if ( 0 == PL_strcmp(aContentType, "text/html")) {
|
||||
bIsHTML = PR_TRUE;
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
NS_IMETHOD GetContentType(nsAWritableString& aContentType) const;
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsIChannel* channel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
|
|
|
@ -54,7 +54,9 @@ static NS_DEFINE_IID(kILDAPMessageListenerIID, NS_ILDAPMESSAGELISTENER_IID);
|
|||
static NS_DEFINE_IID(kILoadGroupIID, NS_ILOADGROUP_IID);
|
||||
static NS_DEFINE_IID(kIProgressEventSink, NS_IPROGRESSEVENTSINK_IID);
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsLDAPChannel, nsIChannel, nsIRequest,
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsLDAPChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsILDAPMessageListener);
|
||||
|
||||
nsLDAPChannel::nsLDAPChannel()
|
||||
|
@ -212,7 +214,7 @@ nsLDAPChannel::Cancel(nsresult aStatus)
|
|||
// remove self from loadgroup to stop the throbber
|
||||
//
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, mResponseContext, aStatus,
|
||||
rv = mLoadGroup->RemoveRequest(this, mResponseContext, aStatus,
|
||||
nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -283,55 +285,6 @@ nsLDAPChannel::GetURI(nsIURI* *aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// getter and setter for transferOffset attribute:
|
||||
//
|
||||
// The start offset from the beginning of the data from/to which
|
||||
// reads/writes will occur. Users may set the transferOffset before making
|
||||
// any of the following requests: asyncOpen, asyncRead, asyncWrite,
|
||||
// openInputStream, openOutputstream.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::SetTransferOffset(PRUint32 newOffset)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetTransferOffset(PRUint32 *offset)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// getter and setter for transferCount attribute
|
||||
//
|
||||
// Accesses the count of bytes to be transfered. For openInputStream and
|
||||
// asyncRead, this specifies the amount to read, for asyncWrite, this
|
||||
// specifies the amount to write (note that for openOutputStream, the
|
||||
// end of the data can be signified simply by closing the stream).
|
||||
// If the transferCount is set after reading has been initiated, the
|
||||
// amount specified will become the current remaining amount to read
|
||||
// before the channel is closed (this can be useful if the content
|
||||
// length is encoded at the start of the stream).
|
||||
//
|
||||
// A transferCount value of -1 means the amount is unspecified, i.e.
|
||||
// read or write all the data that is available.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::SetTransferCount(PRInt32 newCount)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetTransferCount(PRInt32 *count)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// getter and setter for loadAttributes attribute:
|
||||
//
|
||||
// The load attributes for the channel. E.g. setting the load
|
||||
|
@ -563,86 +516,6 @@ nsLDAPChannel::GetSecurityInfo(nsISupports* *aSecurityInfo)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// getter and setter for bufferSegmentSize attribute
|
||||
//
|
||||
// The buffer segment size is used as the initial size for any
|
||||
// transfer buffers, and the increment size for whenever the buffer
|
||||
// space needs to be grown. (Note this parameter is passed along to
|
||||
// any underlying nsIPipe objects.) If unspecified, the channel
|
||||
// implementation picks a default.
|
||||
//
|
||||
// attribute unsigned long bufferSegmentSize;
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// getter and setter for the bufferMaxSize attribute
|
||||
//
|
||||
// Accesses the buffer maximum size. The buffer maximum size is the limit
|
||||
// size that buffer will be grown to before suspending the channel.
|
||||
// (Note this parameter is passed along to any underlying nsIPipe objects.)
|
||||
// If unspecified, the channel implementation picks a default.
|
||||
//
|
||||
// attribute unsigned long bufferMaxSize;
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Returns a local file to the channel's data if one exists, null otherwise.
|
||||
//
|
||||
// readonly attribute nsIFile localFile;
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetLocalFile(nsIFile* *aFile)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
// getter and setter for pipeliningAllowed attribute
|
||||
//
|
||||
// Setting pipeliningAllowed causes the load of a URL (issued via asyncOpen,
|
||||
// asyncRead or asyncWrite) to be deferred in order to allow the request to
|
||||
// be pipelined for greater throughput efficiency. Pipelined requests will
|
||||
// be forced to load when the first non-pipelined request is issued.
|
||||
//
|
||||
// attribute boolean pipeliningAllowed;
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::GetPipeLiningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIChannel operations
|
||||
|
||||
// Opens a blocking input stream to the URL's specified source.
|
||||
|
@ -653,35 +526,14 @@ nsLDAPChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
|||
// the data, the amount available is returned in the stream.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::OpenInputStream(nsIInputStream* *result)
|
||||
nsLDAPChannel::Open(nsIInputStream* *result)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::OpenInputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Opens a blocking output stream to the URL's specified destination.
|
||||
// @param startPosition - The offset from the start of the data
|
||||
// from which to begin writing.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::OpenOutputStream(nsIOutputStream* *result)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Reads asynchronously from the URL's specified source. Notifications
|
||||
// are provided to the stream listener on the thread of the specified
|
||||
// event queue.
|
||||
// The startPosition argument designates the offset in the source where
|
||||
// the data will be read.
|
||||
// If the readCount == -1 then all the available data is delivered to
|
||||
// the stream listener.
|
||||
//
|
||||
// void asyncRead(in nsIStreamListener listener,
|
||||
// in nsISupports ctxt);
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::AsyncRead(nsIStreamListener* aListener,
|
||||
nsLDAPChannel::AsyncOpen(nsIStreamListener* aListener,
|
||||
nsISupports* aCtxt)
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -696,7 +548,7 @@ nsLDAPChannel::AsyncRead(nsIStreamListener* aListener,
|
|||
// add ourselves to the appropriate loadgroup
|
||||
//
|
||||
if (mLoadGroup) {
|
||||
mLoadGroup->AddChannel(this, mResponseContext);
|
||||
mLoadGroup->AddRequest(this, mResponseContext);
|
||||
}
|
||||
|
||||
// slurp out relevant pieces of the URL
|
||||
|
@ -812,24 +664,6 @@ nsLDAPChannel::AsyncRead(nsIStreamListener* aListener,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Writes asynchronously to the URL's specified destination. Notifications
|
||||
// are provided to the stream observer on the thread of the specified
|
||||
// event queue.
|
||||
// The startPosition argument designates the offset in the destination where
|
||||
// the data will be written.
|
||||
// If the writeCount == -1, then all the available data in the input
|
||||
// stream is written.
|
||||
//
|
||||
// void asyncWrite(in nsIStreamProvider provider,
|
||||
// in nsISupports ctxt);
|
||||
NS_IMETHODIMP
|
||||
nsLDAPChannel::AsyncWrite(nsIStreamProvider* provider,
|
||||
nsISupports* ctxt)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsLDAPChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Messages received are passed back via this function.
|
||||
*
|
||||
|
@ -1004,7 +838,7 @@ nsLDAPChannel::OnLDAPSearchResult(nsILDAPMessage *aMessage)
|
|||
// remove self from loadgroup to stop the throbber
|
||||
//
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, mResponseContext, NS_OK, nsnull);
|
||||
rv = mLoadGroup->RemoveRequest(this, mResponseContext, NS_OK, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsLDAPChannel::OnSearchResult(): "
|
||||
"mLoadGroup->RemoveChannel() failed");
|
||||
|
|
|
@ -80,7 +80,7 @@ NS_IMETHODIMP nsDSURIContentListener::GetProtocolHandler(nsIURI* aURI,
|
|||
|
||||
NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
|
||||
nsURILoadCommand aCommand, const char* aWindowTarget,
|
||||
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler,
|
||||
nsIRequest* request, nsIStreamListener** aContentHandler,
|
||||
PRBool* aAbortProcess)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentHandler);
|
||||
|
@ -89,6 +89,8 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
|
|||
|
||||
// determine if the channel has just been retargeted to us...
|
||||
nsLoadFlags loadAttribs = 0;
|
||||
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
|
||||
|
||||
aOpenedChannel->GetLoadAttributes(&loadAttribs);
|
||||
|
||||
PRUint32 loadType = mDocShell->ConvertDocShellLoadInfoToLoadType((nsDocShellInfoLoadType) aCommand);
|
||||
|
@ -100,7 +102,7 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
|
|||
}
|
||||
|
||||
nsresult rv = mDocShell->CreateContentViewer(aContentType,
|
||||
aOpenedChannel, aContentHandler);
|
||||
request, aContentHandler);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // it's okay if we don't know how to handle the content
|
||||
|
||||
if(loadAttribs & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
||||
|
|
|
@ -2752,7 +2752,7 @@ NS_IMETHODIMP nsDocShell::CreateAboutBlankContentViewer()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler)
|
||||
nsIRequest *request, nsIStreamListener** aContentHandler)
|
||||
{
|
||||
// Can we check the content type of the current content viewer
|
||||
// and reuse it without destroying it and re-creating it?
|
||||
|
@ -2762,12 +2762,17 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
|||
|
||||
// Instantiate the content viewer object
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
if(NS_FAILED(NewContentViewerObj(aContentType, aOpenedChannel, loadGroup,
|
||||
aContentHandler, getter_AddRefs(viewer))))
|
||||
nsresult rv = NewContentViewerObj(aContentType, request, loadGroup,
|
||||
aContentHandler, getter_AddRefs(viewer));
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// we've created a new document so go ahead and call OnLoadingSite
|
||||
mURIResultedInDocument = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
|
||||
|
||||
OnLoadingSite(aOpenedChannel);
|
||||
|
||||
// let's try resetting the load group if we need to...
|
||||
|
@ -2798,9 +2803,9 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
|||
|
||||
aOpenedChannel->SetLoadAttributes(loadAttribs);
|
||||
|
||||
loadGroup->AddChannel(aOpenedChannel, nsnull);
|
||||
loadGroup->AddRequest(request, nsnull);
|
||||
if(currentLoadGroup)
|
||||
currentLoadGroup->RemoveChannel(aOpenedChannel, nsnull, nsnull, nsnull);
|
||||
currentLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull);
|
||||
|
||||
}
|
||||
#ifdef SH_IN_FRAMES
|
||||
|
@ -2814,7 +2819,7 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
|||
}
|
||||
|
||||
nsresult nsDocShell::NewContentViewerObj(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
|
||||
nsIRequest *request, nsILoadGroup* aLoadGroup,
|
||||
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer)
|
||||
{
|
||||
//XXX This should probably be some category thing....
|
||||
|
@ -2841,6 +2846,8 @@ nsresult nsDocShell::NewContentViewerObj(const char* aContentType,
|
|||
if(!docLoaderFactory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
|
||||
|
||||
// Now create an instance of the content viewer
|
||||
NS_ENSURE_SUCCESS(docLoaderFactory->CreateInstance(
|
||||
|
|
|
@ -194,9 +194,9 @@ protected:
|
|||
NS_IMETHOD EnsureDeviceContext();
|
||||
NS_IMETHOD CreateAboutBlankContentViewer();
|
||||
NS_IMETHOD CreateContentViewer(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
||||
nsIRequest *request, nsIStreamListener** aContentHandler);
|
||||
NS_IMETHOD NewContentViewerObj(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
|
||||
nsIRequest *request, nsILoadGroup* aLoadGroup,
|
||||
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer);
|
||||
NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer);
|
||||
|
||||
|
|
|
@ -891,10 +891,10 @@ nsWebShell::GetLinkState(const char* aLinkURI, nsLinkState& aState)
|
|||
// are cleaned up.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
||||
nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *request,
|
||||
PRInt32 aStateFlags, nsresult aStatus)
|
||||
{
|
||||
if (!aRequest) {
|
||||
if (!request) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -903,7 +903,8 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
|
||||
if (aProgress == webProgress.get()) {
|
||||
nsCOMPtr<nsIURI> url;
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
nsCOMPtr<nsIDocumentLoaderObserver> dlObserver;
|
||||
|
||||
(void) channel->GetURI(getter_AddRefs(url));
|
||||
|
@ -936,21 +937,21 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
* Fire the OnEndDocumentLoad of the DocLoaderobserver
|
||||
*/
|
||||
if(dlObserver && url) {
|
||||
dlObserver->OnEndDocumentLoad(mDocLoader, channel, aStatus);
|
||||
dlObserver->OnEndDocumentLoad(mDocLoader, request, aStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aStateFlags & STATE_IS_REQUEST) {
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
|
||||
if (aStateFlags & STATE_START) {
|
||||
/*
|
||||
*Fire the OnStartDocumentLoad of the webshell observer
|
||||
*/
|
||||
if ((nsnull != mContainer) && (nsnull != mDocLoaderObserver)) {
|
||||
mDocLoaderObserver->OnStartURLLoad(mDocLoader, channel);
|
||||
mDocLoaderObserver->OnStartURLLoad(mDocLoader, request);
|
||||
}
|
||||
}
|
||||
else if (aStateFlags & STATE_STOP) {
|
||||
|
@ -958,27 +959,26 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
*Fire the OnEndDocumentLoad of the webshell observer
|
||||
*/
|
||||
if ((nsnull != mContainer) && (nsnull != mDocLoaderObserver)) {
|
||||
mDocLoaderObserver->OnEndURLLoad(mDocLoader, channel, aStatus);
|
||||
mDocLoaderObserver->OnEndURLLoad(mDocLoader, request, aStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nsDocShell::OnStateChange(aProgress, aRequest, aStateFlags, aStatus);
|
||||
return nsDocShell::OnStateChange(aProgress, request, aStateFlags, aStatus);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
nsIChannel *aChannel,
|
||||
nsIChannel* channel,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if(!aChannel)
|
||||
if(!channel)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
nsCOMPtr<nsIURI> url;
|
||||
|
||||
rv = aChannel->GetURI(getter_AddRefs(url));
|
||||
rv = channel->GetURI(getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// clean up reload state for meta charset
|
||||
|
@ -993,7 +993,7 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
|||
// during this load handler.
|
||||
//
|
||||
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
|
||||
nsDocShell::EndPageLoad(aProgress, aChannel, aStatus);
|
||||
nsDocShell::EndPageLoad(aProgress, channel, aStatus);
|
||||
|
||||
//
|
||||
// If the page load failed, then deal with the error condition...
|
||||
|
|
|
@ -138,7 +138,7 @@ protected:
|
|||
// sub-documents - ie. frames) has been completely loaded.
|
||||
//
|
||||
virtual nsresult EndPageLoad(nsIWebProgress *aProgress,
|
||||
nsIChannel *aChannel,
|
||||
nsIChannel* channel,
|
||||
nsresult aStatus);
|
||||
|
||||
nsIEventQueue* mThreadEventQueue;
|
||||
|
@ -156,7 +156,7 @@ protected:
|
|||
|
||||
nsresult FireUnloadForChildren();
|
||||
|
||||
nsresult CreateViewer(nsIChannel* aChannel,
|
||||
nsresult CreateViewer(nsIRequest* request,
|
||||
const char* aContentType,
|
||||
const char* aCommand,
|
||||
nsIStreamListener** aResult);
|
||||
|
|
|
@ -4904,7 +4904,7 @@ NS_IMETHODIMP nsEditorShell::GetProtocolHandler(nsIURI *aURI, nsIProtocolHandler
|
|||
}
|
||||
|
||||
/* void doContent (in string aContentType, in nsURILoadCommand aCommand, in string aWindowTarget, in nsIChannel aOpenedChannel, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */
|
||||
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIChannel *aOpenedChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIRequest* request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentHandler);
|
||||
NS_ENSURE_ARG_POINTER(aAbortProcess);
|
||||
|
|
|
@ -4904,7 +4904,7 @@ NS_IMETHODIMP nsEditorShell::GetProtocolHandler(nsIURI *aURI, nsIProtocolHandler
|
|||
}
|
||||
|
||||
/* void doContent (in string aContentType, in nsURILoadCommand aCommand, in string aWindowTarget, in nsIChannel aOpenedChannel, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */
|
||||
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIChannel *aOpenedChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIRequest* request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentHandler);
|
||||
NS_ENSURE_ARG_POINTER(aAbortProcess);
|
||||
|
|
|
@ -35,4 +35,5 @@ ifdef MOZ_ENABLE_PHOTON
|
|||
DIRS += photon
|
||||
endif
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -388,8 +388,8 @@ NS_IMETHODIMP CWebBrowserContainer::GetProtocolHandler(nsIURI *aURI, nsIProtocol
|
|||
}
|
||||
|
||||
|
||||
/* void doContent (in string aContentType, in nsURILoadCommand aCommand, in string aWindowTarget, in nsIChannel aOpenedChannel, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIChannel *aOpenedChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
/* void doContent (in string aContentType, in nsURILoadCommand aCommand, in string aWindowTarget, in nsIRequest request, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ CWebBrowserContainer::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext)
|
||||
CWebBrowserContainer::OnStartRequest(nsIRequest *request, nsISupports* aContext)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStartRequest(...)\n"));
|
||||
|
@ -724,7 +724,7 @@ CWebBrowserContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
CWebBrowserContainer::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStopRequest(..., %d, \"%s\")\n"), (int) aStatus, W2T((PRUnichar *) aMsg));
|
||||
|
@ -758,7 +758,7 @@ CWebBrowserContainer::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* pUR
|
|||
|
||||
// we need this to fire the document complete
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aChannel, nsresult aStatus)
|
||||
CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnEndDocumentLoad(..., \"\")\n"));
|
||||
|
||||
|
@ -776,6 +776,9 @@ CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *a
|
|||
char* aString = nsnull;
|
||||
nsIURI* pURI = nsnull;
|
||||
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
aChannel->GetURI(&pURI);
|
||||
if (pURI == nsnull)
|
||||
{
|
||||
|
@ -804,7 +807,7 @@ CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *a
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel)
|
||||
CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStartURLLoad(..., \"\")\n"));
|
||||
|
||||
|
@ -815,7 +818,7 @@ CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* aCha
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnProgress(..., \"%d\", \"%d\")\n"), (int) aProgress, (int) aProgressMax);
|
||||
|
@ -825,7 +828,7 @@ CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* a
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, nsString& aMsg)
|
||||
CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsString& aMsg)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStatusURLLoad(..., \"\")\n"));
|
||||
|
||||
|
@ -840,7 +843,7 @@ CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aCh
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
|
||||
CWebBrowserContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnEndURLLoad(..., \"\")\n"));
|
||||
|
||||
|
|
|
@ -264,7 +264,8 @@ NS_IMETHODIMP GtkMozEmbedChrome::OpenStream (const char *aBaseURI, const char *a
|
|||
return rv;
|
||||
|
||||
// start our request
|
||||
rv = mStreamListener->OnStartRequest(mChannel, NULL);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
rv = mStreamListener->OnStartRequest(request, NULL);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -281,7 +282,8 @@ NS_IMETHODIMP GtkMozEmbedChrome::AppendToStream (const char *aData, gint32 aLen)
|
|||
rv = embedStream->Append(aData, aLen);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = mStreamListener->OnDataAvailable(mChannel,
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
rv = mStreamListener->OnDataAvailable(request,
|
||||
NULL,
|
||||
mStream,
|
||||
mOffset, /* offset */
|
||||
|
@ -297,7 +299,8 @@ NS_IMETHODIMP GtkMozEmbedChrome::CloseStream (void)
|
|||
nsresult rv;
|
||||
NS_ENSURE_STATE(mDoingStream);
|
||||
mDoingStream = PR_FALSE;
|
||||
rv = mStreamListener->OnStopRequest(mChannel,
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
rv = mStreamListener->OnStopRequest(request,
|
||||
NULL,
|
||||
NS_OK,
|
||||
NULL);
|
||||
|
@ -531,7 +534,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetProtocolHandler(nsIURI *aURI, nsIProtocolHan
|
|||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::DoContent(const char *aContentType, nsURILoadCommand aCommand,
|
||||
const char *aWindowTarget, nsIChannel *aOpenedChannel,
|
||||
const char *aWindowTarget, nsIRequest *request,
|
||||
nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::DoContent\n"));
|
||||
|
|
|
@ -93,7 +93,7 @@ NS_IMETHODIMP nsWBURIContentListener::GetProtocolHandler(nsIURI* aURI,
|
|||
|
||||
NS_IMETHODIMP nsWBURIContentListener::DoContent(const char* aContentType,
|
||||
nsURILoadCommand aCommand, const char* aWindowTarget,
|
||||
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler,
|
||||
nsIRequest* request, nsIStreamListener** aContentHandler,
|
||||
PRBool* aAbortProcess)
|
||||
{
|
||||
NS_ERROR("Hmmmm, why is this getting called on this object?");
|
||||
|
|
|
@ -86,7 +86,7 @@ void nsWebBrowserPersist::CleanUp()
|
|||
mOutputStream->Close();
|
||||
mOutputStream = nsnull;
|
||||
}
|
||||
mOutputChannel = nsnull;
|
||||
mOutputTransport = nsnull;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsWebBrowserPersist)
|
||||
|
@ -162,10 +162,6 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
}
|
||||
}
|
||||
|
||||
// Query the content type
|
||||
nsXPIDLCString contentType;
|
||||
inputChannel->GetContentType(getter_Copies(contentType));
|
||||
|
||||
NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
|
||||
|
@ -188,7 +184,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
}
|
||||
|
||||
// Open a channel on the local file
|
||||
nsCOMPtr<nsIChannel> outputChannel;
|
||||
nsCOMPtr<nsITransport> outputChannel;
|
||||
rv = fts->CreateTransport(file, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
0664, getter_AddRefs(outputChannel));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -197,10 +193,12 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mOutputChannel = outputChannel;
|
||||
mOutputTransport = outputChannel;
|
||||
|
||||
//dougt wtf?! why both a async and sync read?
|
||||
|
||||
// Read from the input channel
|
||||
rv = inputChannel->AsyncRead(this, nsnull);
|
||||
rv = inputChannel->AsyncOpen(this, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
OnEndDownload();
|
||||
|
@ -208,7 +206,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
rv = inputChannel->OpenInputStream(getter_AddRefs(inStream));
|
||||
rv = inputChannel->Open(getter_AddRefs(inStream));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
OnEndDownload();
|
||||
|
@ -219,7 +217,10 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
mInputStream = inStream;
|
||||
|
||||
// Get the output channel ready for writing
|
||||
rv = NS_AsyncWriteFromStream(outputChannel, inStream, NS_STATIC_CAST(nsIStreamObserver *, this), nsnull);
|
||||
nsCOMPtr<nsIRequest> writeRequest;
|
||||
rv = NS_AsyncWriteFromStream(getter_AddRefs(writeRequest),
|
||||
outputChannel, inStream, 0, 0, 0,
|
||||
NS_STATIC_CAST(nsIStreamObserver*, this), nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
OnEndDownload();
|
||||
|
@ -394,15 +395,13 @@ NS_IMETHODIMP nsWebBrowserPersist::OnProgress(PRUint32 aStatus, nsIURI *aURI, PR
|
|||
//*****************************************************************************
|
||||
|
||||
|
||||
/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = mOutputChannel->OpenOutputStream(getter_AddRefs(mOutputStream));
|
||||
nsresult rv = mOutputTransport->OpenOutputStream(0, -1, 0, getter_AddRefs(mOutputStream));
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg)
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg)
|
||||
{
|
||||
OnEndDownload();
|
||||
CleanUp();
|
||||
|
@ -415,7 +414,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(nsIChannel *channel, nsISupport
|
|||
//*****************************************************************************
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIChannel *aChannel, nsISupports *aContext, nsIInputStream *aIStream, PRUint32 aOffset, PRUint32 aLength)
|
||||
NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIRequest* request, nsISupports *aContext, nsIInputStream *aIStream, PRUint32 aOffset, PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
unsigned long bytesRemaining = aLength;
|
||||
|
@ -453,9 +452,9 @@ NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIChannel *aChannel, nsISupp
|
|||
// Cancel reading?
|
||||
if (cancel)
|
||||
{
|
||||
if (aChannel)
|
||||
if (request)
|
||||
{
|
||||
aChannel->Cancel(NS_BINDING_ABORTED);
|
||||
request->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
CleanUp();
|
||||
OnEndDownload();
|
||||
|
@ -544,8 +543,6 @@ nsWebBrowserPersist::CleanupURIMap(nsHashKey *aKey, void *aData, void* closure)
|
|||
nsresult
|
||||
nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Test the node to see if it's an image, frame, iframe, css, js
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> nodeAsImage = do_QueryInterface(aNode);
|
||||
if (nodeAsImage)
|
||||
|
@ -613,8 +610,6 @@ nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort)
|
|||
nsresult
|
||||
nsWebBrowserPersist::CloneNodeWithFixedUpURIAttributes(nsIDOMNode *aNodeIn, nsIDOMNode **aNodeOut)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*aNodeOut = nsnull;
|
||||
|
||||
// Test the node to see if it's an image, frame, iframe, css, js
|
||||
|
@ -892,30 +887,36 @@ nsWebBrowserPersist::MakeAndStoreLocalFilenameInURIMap(const char *aURI, nsStrin
|
|||
// Create a unique file name for the uri
|
||||
MakeFilenameFromURI(uri, inputChannel, filename);
|
||||
|
||||
// Query the content type
|
||||
nsXPIDLCString contentType;
|
||||
inputChannel->GetContentType(getter_Copies(contentType));
|
||||
|
||||
// Strap on the file extension using the mime lookup service
|
||||
if (mMIMEService)
|
||||
if (!mMIMEService)
|
||||
{
|
||||
nsCOMPtr<nsIMIMEInfo> mimeInfo;
|
||||
mMIMEService->GetFromMIMEType(contentType, getter_AddRefs(mimeInfo));
|
||||
if (mimeInfo)
|
||||
{
|
||||
// Append the mime file extension
|
||||
nsXPIDLCString fileExtension;
|
||||
if (NS_SUCCEEDED(mimeInfo->FirstExtension(getter_Copies(fileExtension))))
|
||||
{
|
||||
nsString newExt;
|
||||
newExt.AssignWithConversion(".");
|
||||
newExt.AppendWithConversion(fileExtension);
|
||||
// TODO no need to append if an extension for the mime type is already there
|
||||
filename.Append(newExt);
|
||||
}
|
||||
}
|
||||
mMIMEService = do_GetService(NS_MIMESERVICE_CONTRACTID);
|
||||
if (!mMIMEService)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Strap on the file extension using the mime lookup service
|
||||
|
||||
nsXPIDLCString contentType;
|
||||
rv = mMIMEService->GetTypeFromURI(uri, getter_Copies(contentType));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIMIMEInfo> mimeInfo;
|
||||
mMIMEService->GetFromMIMEType(contentType, getter_AddRefs(mimeInfo));
|
||||
if (mimeInfo)
|
||||
{
|
||||
// Append the mime file extension
|
||||
nsXPIDLCString fileExtension;
|
||||
if (NS_SUCCEEDED(mimeInfo->FirstExtension(getter_Copies(fileExtension))))
|
||||
{
|
||||
nsString newExt;
|
||||
newExt.AssignWithConversion(".");
|
||||
newExt.AppendWithConversion(fileExtension);
|
||||
// TODO no need to append if an extension for the mime type is already there
|
||||
filename.Append(newExt);
|
||||
}
|
||||
}
|
||||
|
||||
// Store the file name
|
||||
URIData *data = new URIData;
|
||||
if (!data)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "nsIChannel.h"
|
||||
#include "nsIStyleSheet.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
|
||||
#include "nsITransport.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
#include "nsIWebBrowserPersist.h"
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
nsCOMPtr<nsIMIMEService> mMIMEService;
|
||||
nsCOMPtr<nsIChannel> mInputChannel;
|
||||
nsCOMPtr<nsIInputStream> mInputStream;
|
||||
nsCOMPtr<nsIChannel> mOutputChannel;
|
||||
nsCOMPtr<nsITransport> mOutputTransport;
|
||||
nsCOMPtr<nsIOutputStream> mOutputStream;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
|
|
@ -162,8 +162,10 @@ nsCookieHTTPNotify::ModifyRequest(nsISupports *aContext)
|
|||
|
||||
nsCOMPtr<nsIChannel> pChannel;
|
||||
if (pLoadGroup) {
|
||||
rv = pLoadGroup->GetDefaultLoadChannel(getter_AddRefs(pChannel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIRequest> pRequest;
|
||||
rv = pLoadGroup->GetDefaultLoadRequest(getter_AddRefs(pRequest));
|
||||
if (pRequest)
|
||||
pChannel = do_QueryInterface(pRequest);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> pFirstURL;
|
||||
|
@ -222,8 +224,10 @@ nsCookieHTTPNotify::AsyncExamineResponse(nsISupports *aContext)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIChannel> pChannel;
|
||||
if (pLoadGroup) {
|
||||
rv = pLoadGroup->GetDefaultLoadChannel(getter_AddRefs(pChannel));
|
||||
nsCOMPtr<nsIRequest> pRequest;
|
||||
rv = pLoadGroup->GetDefaultLoadRequest(getter_AddRefs(pRequest));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
pChannel = do_QueryInterface(pRequest);
|
||||
}
|
||||
nsCOMPtr<nsIURI> pFirstURL;
|
||||
if (pChannel) {
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
|
||||
|
@ -41,7 +43,11 @@ nsDateTimeChannel::nsDateTimeChannel() {
|
|||
nsDateTimeChannel::~nsDateTimeChannel() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsDateTimeChannel, nsIChannel, nsIRequest, nsIStreamListener, nsIStreamObserver)
|
||||
NS_IMPL_ISUPPORTS4(nsDateTimeChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIStreamListener,
|
||||
nsIStreamObserver)
|
||||
|
||||
nsresult
|
||||
nsDateTimeChannel::Init(nsIURI* uri)
|
||||
|
@ -156,57 +162,48 @@ nsDateTimeChannel::SetURI(nsIURI* aURI)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
nsDateTimeChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(channel));
|
||||
nsCOMPtr<nsITransport> transport;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mCallbacks) {
|
||||
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
|
||||
if (sink)
|
||||
transport->SetProgressEventSink(sink);
|
||||
}
|
||||
|
||||
return channel->OpenInputStream(_retval);
|
||||
return transport->OpenInputStream(0, -1, 0, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::AsyncRead(nsIStreamListener *aListener,
|
||||
nsISupports *ctxt)
|
||||
nsDateTimeChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, 0, 32, 32, getter_AddRefs(channel));
|
||||
nsCOMPtr<nsITransport> transport;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mCallbacks) {
|
||||
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
|
||||
if (sink)
|
||||
transport->SetProgressEventSink(sink);
|
||||
}
|
||||
|
||||
mListener = aListener;
|
||||
|
||||
return channel->AsyncRead(this, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::AsyncWrite(nsIStreamProvider *provider,
|
||||
nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
return transport->AsyncRead(this, ctxt, 0, -1, 0, getter_AddRefs(request));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -256,83 +253,6 @@ nsDateTimeChannel::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
*file = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
|
@ -345,11 +265,11 @@ NS_IMETHODIMP
|
|||
nsDateTimeChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
if (mLoadGroup) // if we already had a load group remove ourselves...
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
(void)mLoadGroup->RemoveRequest(this, nsnull, NS_OK, nsnull);
|
||||
|
||||
mLoadGroup = aLoadGroup;
|
||||
if (mLoadGroup) {
|
||||
return mLoadGroup->AddChannel(this, nsnull);
|
||||
return mLoadGroup->AddRequest(this, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -384,25 +304,26 @@ nsDateTimeChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetSecurityInfo(nsISupports **sec)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(sec);
|
||||
*sec = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
||||
nsDateTimeChannel::OnStartRequest(nsIRequest *request, nsISupports *aContext) {
|
||||
return mListener->OnStartRequest(this, aContext);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsDateTimeChannel::OnStopRequest(nsIRequest *request, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
if (mLoadGroup) {
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
nsresult rv = mLoadGroup->RemoveRequest(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
|
@ -411,7 +332,7 @@ nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
|||
|
||||
// nsIStreamListener method
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsDateTimeChannel::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
|
||||
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
mContentLength = aLength;
|
||||
|
|
|
@ -39,7 +39,10 @@
|
|||
#include "nsIStreamListener.h"
|
||||
|
||||
|
||||
class nsDateTimeChannel : public nsIChannel, public nsIStreamListener {
|
||||
class nsDateTimeChannel
|
||||
: public nsIChannel,
|
||||
public nsIStreamListener {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
|
@ -67,8 +70,6 @@ protected:
|
|||
nsCString mContentType;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
|
||||
PRInt32 mPort;
|
||||
nsXPIDLCString mHost;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsMimeTypes.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsITXTToHTMLConv.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
|
@ -53,8 +54,11 @@ nsFingerChannel::nsFingerChannel()
|
|||
nsFingerChannel::~nsFingerChannel() {
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS4(nsFingerChannel, nsIChannel, nsIRequest,
|
||||
nsIStreamListener, nsIStreamObserver)
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS4(nsFingerChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIStreamListener,
|
||||
nsIStreamObserver)
|
||||
|
||||
nsresult
|
||||
nsFingerChannel::Init(nsIURI* uri)
|
||||
|
@ -144,8 +148,8 @@ nsFingerChannel::Cancel(nsresult status)
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
mStatus = status;
|
||||
if (mTransport) {
|
||||
rv = mTransport->Cancel(status);
|
||||
if (mTransportRequest) {
|
||||
rv = mTransportRequest->Cancel(status);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -198,60 +202,48 @@ nsFingerChannel::SetURI(nsIURI* aURI)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
nsFingerChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, BUFFER_SEG_SIZE,
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(channel));
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mCallbacks) {
|
||||
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
|
||||
if (sink)
|
||||
mTransport->SetProgressEventSink(sink);
|
||||
}
|
||||
|
||||
return channel->OpenInputStream(_retval);
|
||||
return mTransport->OpenInputStream(0, -1, 0, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::AsyncRead(nsIStreamListener *aListener, nsISupports *ctxt)
|
||||
nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, BUFFER_SEG_SIZE,
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(channel));
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mCallbacks) {
|
||||
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
|
||||
if (sink)
|
||||
mTransport->SetProgressEventSink(sink);
|
||||
}
|
||||
|
||||
mListener = aListener;
|
||||
mResponseContext = ctxt;
|
||||
mTransport = channel;
|
||||
|
||||
return SendRequest(channel);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::AsyncWrite(nsIStreamProvider *provider,
|
||||
nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return SendRequest(mTransport);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -301,83 +293,6 @@ nsFingerChannel::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
*file = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
|
@ -432,7 +347,7 @@ nsFingerChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
|||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
||||
nsFingerChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) {
|
||||
if (!mActAsObserver) {
|
||||
// acting as a listener
|
||||
return mListener->OnStartRequest(this, mResponseContext);
|
||||
|
@ -445,14 +360,14 @@ nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsFingerChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (NS_FAILED(aStatus) || !mActAsObserver) {
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
rv = mLoadGroup->RemoveRequest(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
rv = mListener->OnStopRequest(this, mResponseContext, aStatus, aStatusArg);
|
||||
|
@ -487,7 +402,8 @@ nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
|||
converter->PreFormatHTML(PR_TRUE);
|
||||
}
|
||||
|
||||
return aChannel->AsyncRead(converterListener, mResponseContext);
|
||||
return mTransport->AsyncRead(converterListener, mResponseContext, 0,-1, 0,
|
||||
getter_AddRefs(mTransportRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -495,7 +411,7 @@ nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
|||
|
||||
// nsIStreamListener method
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsFingerChannel::OnDataAvailable(nsIRequest *aRequest, nsISupports* aContext,
|
||||
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
mContentLength = aLength;
|
||||
|
@ -503,7 +419,7 @@ nsFingerChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsFingerChannel::SendRequest(nsIChannel* aChannel) {
|
||||
nsFingerChannel::SendRequest(nsITransport* aTransport) {
|
||||
// The text to send should already be in mUser
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -512,7 +428,7 @@ nsFingerChannel::SendRequest(nsIChannel* aChannel) {
|
|||
nsCString requestBuffer(mUser);
|
||||
|
||||
if (mLoadGroup) {
|
||||
mLoadGroup->AddChannel(this, nsnull);
|
||||
mLoadGroup->AddRequest(this, nsnull);
|
||||
}
|
||||
|
||||
requestBuffer.Append(CRLF);
|
||||
|
@ -525,9 +441,10 @@ nsFingerChannel::SendRequest(nsIChannel* aChannel) {
|
|||
charstream = do_QueryInterface(result, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = aChannel->SetTransferCount(requestBuffer.Length());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = NS_AsyncWriteFromStream(aChannel, charstream, this, nsnull);
|
||||
rv = NS_AsyncWriteFromStream(getter_AddRefs(mTransportRequest),
|
||||
aTransport, charstream,
|
||||
0, requestBuffer.Length(), 0,
|
||||
this, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsFingerHandler.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsITransport.h"
|
||||
|
||||
class nsFingerChannel
|
||||
: public nsIChannel,
|
||||
public nsIStreamListener {
|
||||
|
||||
class nsFingerChannel : public nsIChannel, public nsIStreamListener {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
|
@ -74,11 +77,12 @@ protected:
|
|||
nsXPIDLCString mRequest;
|
||||
|
||||
nsCOMPtr<nsISupports> mResponseContext;
|
||||
nsCOMPtr<nsIChannel> mTransport;
|
||||
nsCOMPtr<nsITransport> mTransport;
|
||||
nsCOMPtr<nsIRequest> mTransportRequest;
|
||||
nsresult mStatus;
|
||||
|
||||
protected:
|
||||
nsresult SendRequest(nsIChannel* aChannel);
|
||||
nsresult SendRequest(nsITransport* aTransport);
|
||||
};
|
||||
|
||||
#endif /* nsFingerChannel_h___ */
|
||||
|
|
|
@ -107,13 +107,14 @@ function (iid) {
|
|||
}
|
||||
|
||||
IRCContentHandler.prototype.handleContent =
|
||||
function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
|
||||
function (aContentType, aCommand, aWindowTarget, aSourceContext, aRequest)
|
||||
{
|
||||
var e;
|
||||
|
||||
var channel = aRequest.QueryInterface(nsIChannel);
|
||||
|
||||
dump ("ircLoader.handleContent (" + aContentType + ", " +
|
||||
aCommand + ", " + aWindowTarget + ", " + aSourceContext + ", " +
|
||||
aChannel.URI.spec + ")\n");
|
||||
channel.URI.spec + ")\n");
|
||||
|
||||
var windowManager =
|
||||
Components.classes[MEDIATOR_CONTRACTID].getService(nsIWindowMediator);
|
||||
|
@ -123,13 +124,13 @@ function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
|
|||
if (w)
|
||||
{
|
||||
w.focus();
|
||||
w.gotoIRCURL(aChannel.URI.spec);
|
||||
w.gotoIRCURL(channel.URI.spec);
|
||||
}
|
||||
else
|
||||
{
|
||||
var ass = Components.classes[ASS_CONTRACTID].getService(nsIAppShellService);
|
||||
w = ass.getHiddenDOMWindow();
|
||||
w.open("chrome://chatzilla/content/chatzilla.xul?" + aChannel.URI.spec,
|
||||
w.open("chrome://chatzilla/content/chatzilla.xul?" + channel.URI.spec,
|
||||
"_blank", "chrome,menubar,toolbar,resizable");
|
||||
}
|
||||
|
||||
|
@ -210,8 +211,6 @@ function (iid) {
|
|||
}
|
||||
|
||||
/* nsIChannel */
|
||||
BogusChannel.prototype.transferOffset = 0;
|
||||
BogusChannel.prototype.transferCount = 0;
|
||||
BogusChannel.prototype.loadAttributes = null;
|
||||
BogusChannel.prototype.contentType = "x-application-irc";
|
||||
BogusChannel.prototype.contentLength = 0;
|
||||
|
@ -219,14 +218,9 @@ BogusChannel.prototype.owner = null;
|
|||
BogusChannel.prototype.loadGroup = null;
|
||||
BogusChannel.prototype.notificationCallbacks = null;
|
||||
BogusChannel.prototype.securityInfo = null;
|
||||
BogusChannel.prototype.bufferSegmentSize = 0;
|
||||
BogusChannel.prototype.bufferMaxSize = 0;
|
||||
BogusChannel.prototype.shouldCache = false;
|
||||
BogusChannel.prototype.pipeliningAllowed = false;
|
||||
|
||||
BogusChannel.prototype.openInputStream =
|
||||
BogusChannel.prototype.openOutputStream =
|
||||
BogusChannel.prototype.asyncWrite =
|
||||
BogusChannel.prototype.open =
|
||||
BogusChannel.prototype.asyncOpen =
|
||||
function ()
|
||||
{
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -79,7 +79,7 @@ CBSConnection.prototype.connect = function(host, port, bind, tcp_flag)
|
|||
if (!this._channel)
|
||||
throw ("Error opening channel.");
|
||||
|
||||
this._outputStream = this._channel.openOutputStream(0);
|
||||
this._outputStream = this._channel.openOutputStream(0, -1, 0);
|
||||
if (!this._outputStream)
|
||||
throw ("Error getting output stream.");
|
||||
|
||||
|
@ -134,7 +134,7 @@ CBSConnection.prototype.readData = function(timeout)
|
|||
if (!this._inputStream)
|
||||
{
|
||||
this._inputStream =
|
||||
toScriptableInputStream(this._channel.openInputStream (0, 0));
|
||||
toScriptableInputStream(this._channel.openInputStream (0, -1, 0));
|
||||
if (!this._inputStream)
|
||||
throw ("Error getting input stream.");
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ if (jsenv.HAS_DOCUMENT)
|
|||
CBSConnection.prototype.startAsyncRead =
|
||||
function (server)
|
||||
{
|
||||
this._channel.asyncRead (new StreamListener (server), this);
|
||||
this._channel.asyncRead (new StreamListener (server), this, 0, -1, 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -179,20 +179,20 @@ function StreamListener(server)
|
|||
}
|
||||
|
||||
StreamListener.prototype.onStartRequest =
|
||||
function (channel, ctxt)
|
||||
function (request, ctxt)
|
||||
{
|
||||
dd ("onStartRequest: " + channel + ", " + ctxt);
|
||||
dd ("onStartRequest: " + request + ", " + ctxt);
|
||||
}
|
||||
|
||||
StreamListener.prototype.onStopRequest =
|
||||
function (channel, ctxt, status, errorMsg)
|
||||
function (request, ctxt, status, errorMsg)
|
||||
{
|
||||
dd ("onStopRequest: " + channel + ", " + ctxt + ", " + status + ", " +
|
||||
dd ("onStopRequest: " + request + ", " + ctxt + ", " + status + ", " +
|
||||
errorMsg);
|
||||
}
|
||||
|
||||
StreamListener.prototype.onDataAvailable =
|
||||
function (channel, ctxt, inStr, sourceOffset, count)
|
||||
function (request, ctxt, inStr, sourceOffset, count)
|
||||
{
|
||||
ctxt = ctxt.wrappedJSObject;
|
||||
if (!ctxt)
|
||||
|
|
|
@ -147,11 +147,11 @@ public:
|
|||
|
||||
// nsIDocumentLoaderObserver
|
||||
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand);
|
||||
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus);
|
||||
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel);
|
||||
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus);
|
||||
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus);
|
||||
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request);
|
||||
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus);
|
||||
// NS_IMETHOD OnConnectionsComplete();
|
||||
|
||||
|
||||
|
@ -696,7 +696,7 @@ nsPICS::OnStartDocumentLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsPICS::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -719,9 +719,13 @@ nsPICS::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel)
|
||||
nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (!channel)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
rv = channel->GetURI(getter_AddRefs(aURL));
|
||||
|
@ -798,7 +802,7 @@ nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsPICS::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
{
|
||||
|
@ -809,7 +813,7 @@ nsPICS::OnProgressURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsPICS::OnStatusURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsString& aMsg)
|
||||
{
|
||||
if(!mPICSRatingsEnabled)
|
||||
|
@ -819,11 +823,13 @@ nsPICS::OnStatusURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsPICS::OnEndURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
rv = channel->GetURI(getter_AddRefs(aURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -9,3 +9,5 @@ pref("security.warn_entering_secure", true);
|
|||
pref("security.warn_leaving_secure", true);
|
||||
pref("security.warn_viewing_mixed", true);
|
||||
pref("security.warn_submit_insecure", true);
|
||||
|
||||
pref("security.ui.enable", true);
|
|
@ -719,12 +719,15 @@ NS_IMPL_ISUPPORTS(CertDownloader,NS_GET_IID(nsIStreamListener));
|
|||
const PRInt32 kDefaultCertAllocLength = 2048;
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
||||
CertDownloader::OnStartRequest(nsIRequest *request, nsISupports* context)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = channel->GetContentLength(&mContentLength);
|
||||
if (rv != NS_OK || mContentLength == -1)
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (channel)
|
||||
rv = channel->GetContentLength(&mContentLength);
|
||||
|
||||
if (!channel || rv != NS_OK || mContentLength == -1)
|
||||
mContentLength = kDefaultCertAllocLength;
|
||||
|
||||
mBufferOffset = 0;
|
||||
|
@ -737,7 +740,7 @@ CertDownloader::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnDataAvailable(nsIChannel* channel,
|
||||
CertDownloader::OnDataAvailable(nsIRequest *request,
|
||||
nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
|
@ -776,7 +779,7 @@ CertDownloader::OnDataAvailable(nsIChannel* channel,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CertDownloader::OnStopRequest(nsIChannel* channel,
|
||||
CertDownloader::OnStopRequest(nsIRequest *request,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
|
@ -857,20 +860,23 @@ nsPSMComponent::HandleContent(const char * aContentType,
|
|||
const char * aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsISupports* aWindowContext,
|
||||
nsIChannel * aChannel)
|
||||
nsIRequest *request)
|
||||
{
|
||||
// We were called via CI. We better protect ourselves and addref.
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!aChannel) return NS_ERROR_NULL_POINTER;
|
||||
if (!request) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
CMUint32 type = getPSMCertType(aContentType);
|
||||
|
||||
if (type != -1)
|
||||
{
|
||||
// I can't directly open the passed channel cause it fails :-(
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aChannel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -879,10 +885,11 @@ nsPSMComponent::HandleContent(const char * aContentType,
|
|||
rv = NS_OpenURI(getter_AddRefs(channel), uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return channel->AsyncRead(new CertDownloader(type), NS_STATIC_CAST(nsIPSMComponent*,this));
|
||||
return channel->AsyncOpen(new CertDownloader(type), NS_STATIC_CAST(nsIPSMComponent*,this));
|
||||
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(CertContentListener, NS_GET_IID(nsIURIContentListener));
|
||||
|
@ -957,7 +964,7 @@ NS_IMETHODIMP
|
|||
CertContentListener::DoContent(const char * aContentType,
|
||||
nsURILoadCommand aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsIChannel * aOpenedChannel,
|
||||
nsIRequest * request,
|
||||
nsIStreamListener ** aContentHandler,
|
||||
PRBool * aAbortProcess)
|
||||
{
|
||||
|
|
|
@ -298,7 +298,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
|
|||
}
|
||||
|
||||
// Start reading from the channel
|
||||
rv = channel->AsyncRead(listener, nsnull);
|
||||
rv = channel->AsyncOpen(listener, nsnull);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (modalEventQueue) {
|
||||
|
|
|
@ -254,7 +254,7 @@ nsWalletlibService::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL
|
|||
#include "prmem.h"
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* channel, nsresult aStatus)
|
||||
nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIRequest *request, nsresult aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -374,6 +374,7 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
nsCOMPtr<nsIInterfaceRequestor> interfaces;
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (channel)
|
||||
channel->GetNotificationCallbacks(getter_AddRefs(interfaces));
|
||||
if (interfaces)
|
||||
|
@ -408,21 +409,21 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnStartURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel)
|
||||
(nsIDocumentLoader* loader, nsIRequest *request)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnProgressURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
(nsIDocumentLoader* loader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnStatusURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg)
|
||||
(nsIDocumentLoader* loader, nsIRequest *request, nsString& aMsg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -430,7 +431,7 @@ nsWalletlibService::OnStatusURLLoad
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnEndURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
|
||||
(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
/*
|
||||
* nsXmlRpcClient XPCOM component
|
||||
* Version: $Revision: 1.14 $
|
||||
* Version: $Revision: 1.15 $
|
||||
*
|
||||
* $Id: nsXmlRpcClient.js,v 1.14 2001/02/12 03:12:39 disttsc%bart.nl Exp $
|
||||
* $Id: nsXmlRpcClient.js,v 1.15 2001/02/21 20:36:32 dougt%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -125,7 +125,7 @@ nsXmlRpcClient.prototype = {
|
|||
|
||||
debug('Do the deed.');
|
||||
|
||||
var input = channel.openInputStream();
|
||||
var input = channel.open(0, 0, 0);
|
||||
input = toScriptableStream(input);
|
||||
|
||||
var now = new Date()
|
||||
|
@ -220,7 +220,7 @@ nsXmlRpcClient.prototype = {
|
|||
var chann = this._getChannel(requestBody);
|
||||
|
||||
// And...... call!
|
||||
chann.asyncRead(this, context);
|
||||
chann.asyncOpen(this, context);
|
||||
},
|
||||
|
||||
// Return a HTTP channel ready for POSTing.
|
||||
|
|
|
@ -82,7 +82,9 @@ nsDOMParserChannel::~nsDOMParserChannel()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsDOMParserChannel, nsIRequest, nsIChannel)
|
||||
NS_IMPL_ISUPPORTS2(nsDOMParserChannel,
|
||||
nsIChannel,
|
||||
nsIRequest)
|
||||
|
||||
/* boolean isPending (); */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetName(PRUnichar* *result)
|
||||
|
@ -159,38 +161,6 @@ NS_IMETHODIMP nsDOMParserChannel::SetURI(nsIURI * aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute unsigned long transferOffset; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute long transferCount; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_ENSURE_ARG(aTransferCount);
|
||||
*aTransferCount = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsLoadFlags loadAttributes; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute string contentType; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetContentType(char * *aContentType)
|
||||
{
|
||||
|
@ -232,6 +202,16 @@ NS_IMETHODIMP nsDOMParserChannel::SetOwner(nsISupports * aOwner)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsLoadFlags loadAttributes; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsILoadGroup loadGroup; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
|
||||
{
|
||||
|
@ -262,62 +242,12 @@ NS_IMETHODIMP nsDOMParserChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute unsigned long bufferSegmentSize; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
NS_IMETHODIMP nsDOMParserChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute unsigned long bufferMaxSize; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIFile localFile; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetLocalFile(nsIFile * *aLocalFile)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute boolean pipeliningAllowed; */
|
||||
NS_IMETHODIMP nsDOMParserChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDOMParserChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIInputStream openInputStream (); */
|
||||
NS_IMETHODIMP nsDOMParserChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIOutputStream openOutputStream (); */
|
||||
NS_IMETHODIMP nsDOMParserChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void asyncRead (in nsIStreamListener listener, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP nsDOMParserChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void asyncWrite (in nsIStreamProvider provider, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP nsDOMParserChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsDOMParserChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -509,6 +439,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
|
|||
if (principal) {
|
||||
channel->SetOwner(principal);
|
||||
}
|
||||
nsCOMPtr<nsIRequest> request = NS_STATIC_CAST(nsIRequest*, parserChannel);
|
||||
|
||||
// Tell the document to start loading
|
||||
nsCOMPtr<nsIStreamListener> listener;
|
||||
|
@ -525,15 +456,15 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
|
|||
// Now start pumping data to the listener
|
||||
nsresult status;
|
||||
|
||||
rv = listener->OnStartRequest(channel, nsnull);
|
||||
channel->GetStatus(&status);
|
||||
rv = listener->OnStartRequest(request, nsnull);
|
||||
request->GetStatus(&status);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(status)) {
|
||||
rv = listener->OnDataAvailable(channel, nsnull, stream, 0, contentLength);
|
||||
channel->GetStatus(&status);
|
||||
rv = listener->OnDataAvailable(request, nsnull, stream, 0, contentLength);
|
||||
request->GetStatus(&status);
|
||||
}
|
||||
|
||||
rv = listener->OnStopRequest(channel, nsnull, status, nsnull);
|
||||
rv = listener->OnStopRequest(request, nsnull, status, nsnull);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = domDocument;
|
||||
|
|
|
@ -603,8 +603,8 @@ nsXMLHttpRequest::GetStatusText(char * *aStatusText)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::Abort()
|
||||
{
|
||||
if (mChannel) {
|
||||
return mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
if (mReadRequest) {
|
||||
return mReadRequest->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1038,7 +1038,7 @@ nsXMLHttpRequest::Send(nsISupports *body)
|
|||
|
||||
// Start reading from the channel
|
||||
mStatus = XML_HTTP_REQUEST_SENT;
|
||||
rv = mChannel->AsyncRead(listener, nsnull);
|
||||
rv = mChannel->AsyncOpen(listener, nsnull);
|
||||
|
||||
#ifdef IMPLEMENT_SYNC_LOAD
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -89,6 +89,7 @@ protected:
|
|||
nsIInputStream** aStream);
|
||||
|
||||
nsCOMPtr<nsIHTTPChannel> mChannel;
|
||||
nsCOMPtr<nsIRequest> mReadRequest;
|
||||
nsCOMPtr<nsIDOMDocument> mDocument;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsCOMPtr<nsIDocument> mBaseDocument;
|
||||
|
|
|
@ -91,7 +91,7 @@ int main (int argc, char* argv[])
|
|||
nsnull );
|
||||
|
||||
if (NS_SUCCEEDED( rv )) {
|
||||
rv = pChannel->OpenInputStream( getter_AddRefs( pInputStream ) );
|
||||
rv = pChannel->Open( getter_AddRefs( pInputStream ) );
|
||||
|
||||
if (NS_SUCCEEDED( rv )) {
|
||||
rv = pInputStream->Available(&uiContentLength );
|
||||
|
|
|
@ -1059,7 +1059,7 @@ mozXMLTerminal::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel,
|
||||
mozXMLTerminal::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest* request,
|
||||
nsresult aStatus)
|
||||
{
|
||||
|
||||
|
@ -1068,7 +1068,7 @@ mozXMLTerminal::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel
|
|||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnStartURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel)
|
||||
nsIRequest* request)
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1076,7 +1076,7 @@ mozXMLTerminal::OnStartURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, PRUint32 aProgress,
|
||||
nsIRequest* request, PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -1084,14 +1084,14 @@ mozXMLTerminal::OnProgressURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnStatusURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, nsString& aMsg)
|
||||
nsIRequest* request, nsString& aMsg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnEndURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, nsresult aStatus)
|
||||
nsIRequest* request, nsresult aStatus)
|
||||
{
|
||||
XMLT_LOG(mozXMLTerminal::OnEndURLLoad,20,("\n"));
|
||||
|
||||
|
|
|
@ -114,10 +114,12 @@ function (iid) {
|
|||
}
|
||||
|
||||
TelnetContentHandler.prototype.handleContent =
|
||||
function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
|
||||
function (aContentType, aCommand, aWindowTarget, aSourceContext, aRequest)
|
||||
{
|
||||
var e;
|
||||
|
||||
var aChannel = aRequest.QueryInterface(Components.interfaces.nsIChannel);
|
||||
|
||||
dump ("telnetLoader.handleContent (" + aContentType + ", " +
|
||||
aCommand + ", " + aWindowTarget + ", " + aSourceContext + ", " +
|
||||
aChannel.URI.spec + ")\n");
|
||||
|
@ -218,8 +220,11 @@ function (aURI)
|
|||
//dump("gSystemPrincipal="+gSystemPrincipal+"\n");
|
||||
|
||||
// Cancel XUL request and release channel
|
||||
temChannel.cancel(Components.results.NS_BINDING_ABORTED);
|
||||
temChannel = null;
|
||||
|
||||
// why are you canceling here?! you have not even opened anything yet - dougt.
|
||||
// temChannel.cancel(Components.results.NS_BINDING_ABORTED);
|
||||
|
||||
temChannel = null;
|
||||
|
||||
// Get current process directory
|
||||
var dscontractid = "@mozilla.org/file/directory_service;1";
|
||||
|
@ -279,8 +284,6 @@ function (iid) {
|
|||
}
|
||||
|
||||
/* nsIChannel */
|
||||
BogusChannel.prototype.transferOffset = 0;
|
||||
BogusChannel.prototype.transferCount = 0;
|
||||
BogusChannel.prototype.loadAttributes = null;
|
||||
BogusChannel.prototype.contentType = "x-application-telnet";
|
||||
BogusChannel.prototype.contentLength = 0;
|
||||
|
@ -288,14 +291,10 @@ BogusChannel.prototype.owner = null;
|
|||
BogusChannel.prototype.loadGroup = null;
|
||||
BogusChannel.prototype.notificationCallbacks = null;
|
||||
BogusChannel.prototype.securityInfo = null;
|
||||
BogusChannel.prototype.bufferSegmentSize = 0;
|
||||
BogusChannel.prototype.bufferMaxSize = 0;
|
||||
BogusChannel.prototype.shouldCache = false;
|
||||
BogusChannel.prototype.pipeliningAllowed = false;
|
||||
|
||||
BogusChannel.prototype.openInputStream =
|
||||
BogusChannel.prototype.openOutputStream =
|
||||
BogusChannel.prototype.asyncWrite =
|
||||
BogusChannel.prototype.open =
|
||||
BogusChannel.prototype.asyncOpen =
|
||||
function ()
|
||||
{
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -307,12 +306,6 @@ function (observer, ctxt)
|
|||
observer.onStartRequest (this, ctxt);
|
||||
}
|
||||
|
||||
BogusChannel.prototype.asyncRead =
|
||||
function (listener, ctxt)
|
||||
{
|
||||
return listener.onStartRequest (this, ctxt);
|
||||
}
|
||||
|
||||
/* nsIRequest */
|
||||
BogusChannel.prototype.isPending =
|
||||
function ()
|
||||
|
@ -328,6 +321,7 @@ function (aStatus)
|
|||
this.status = aStatus;
|
||||
}
|
||||
|
||||
BogusChannel.prototype.parent =
|
||||
BogusChannel.prototype.suspend =
|
||||
BogusChannel.prototype.resume =
|
||||
function ()
|
||||
|
|
|
@ -98,8 +98,8 @@ public:
|
|||
virtual int GetContentLength(ilIURL * aURL);
|
||||
|
||||
nsresult RemoveRequest(ImageConsumer *aConsumer);
|
||||
nsresult RequestDone(ImageConsumer *aConsumer, nsIChannel* channel,
|
||||
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg);
|
||||
nsresult RequestDone(ImageConsumer *aConsumer, nsIRequest* request,
|
||||
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg);
|
||||
|
||||
nsVoidArray *mRequests; // WEAK references to |ImageConsumer|s
|
||||
ImgCachePolicy mReloadPolicy;
|
||||
|
@ -121,10 +121,10 @@ public:
|
|||
NS_DECL_NSIURICONTENTLISTENER
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
void SetKeepPumpingData(nsIChannel* channel, nsISupports* context) {
|
||||
NS_ADDREF(channel);
|
||||
NS_IF_RELEASE(mChannel);
|
||||
mChannel = channel;
|
||||
void SetKeepPumpingData(nsIRequest* request, nsISupports* context) {
|
||||
NS_ADDREF(request);
|
||||
NS_IF_RELEASE(mRequest);
|
||||
mRequest = request;
|
||||
|
||||
NS_IF_ADDREF(context);
|
||||
NS_IF_RELEASE(mUserContext);
|
||||
|
@ -145,7 +145,7 @@ protected:
|
|||
PRBool mFirstRead;
|
||||
char *mBuffer;
|
||||
PRInt32 mStatus;
|
||||
nsIChannel* mChannel;
|
||||
nsIRequest* mRequest;
|
||||
nsISupports* mUserContext;
|
||||
PRBool mIsMulti;
|
||||
};
|
||||
|
@ -162,7 +162,7 @@ ImageConsumer::ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext)
|
|||
mStream = nsnull;
|
||||
mBuffer = nsnull;
|
||||
mStatus = 0;
|
||||
mChannel = nsnull;
|
||||
mRequest = nsnull;
|
||||
mUserContext = nsnull;
|
||||
mIsMulti = PR_FALSE;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ NS_IMETHODIMP
|
|||
ImageConsumer::DoContent(const char * aContentType,
|
||||
nsURILoadCommand aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsIChannel * aOpenedChannel,
|
||||
nsIRequest * aOpenedChannel,
|
||||
nsIStreamListener ** aContentHandler,
|
||||
PRBool * aAbortProcess)
|
||||
{
|
||||
|
@ -294,8 +294,10 @@ ImageConsumer::DoContent(const char * aContentType,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageConsumer::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
ImageConsumer::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
|
||||
PRUint32 httpStatus;
|
||||
if (mInterrupted) {
|
||||
mStatus = MK_INTERRUPTED;
|
||||
|
@ -318,7 +320,7 @@ ImageConsumer::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
|||
}
|
||||
|
||||
ilINetReader *reader = mURL->GetReader(); //ptn test: nsCOMPtr??
|
||||
nsresult err= reader->FlushImgBuffer(); //flush current data in buffer before starting
|
||||
/*nsresult err=*/ reader->FlushImgBuffer(); //flush current data in buffer before starting
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
char* aContentType = NULL;
|
||||
|
@ -353,13 +355,15 @@ ImageConsumer::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageConsumer::OnDataAvailable(nsIChannel* channel, nsISupports* aContext, nsIInputStream *pIStream,
|
||||
PRUint32 offset, PRUint32 length)
|
||||
ImageConsumer::OnDataAvailable(nsIRequest* request, nsISupports* aContext,
|
||||
nsIInputStream *pIStream, PRUint32 offset, PRUint32 length)
|
||||
{
|
||||
PRUint32 max_read=0;
|
||||
PRUint32 bytes_read = 0;
|
||||
ilINetReader *reader = mURL->GetReader();
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
|
||||
if (mInterrupted || mStatus != 0) {
|
||||
mStatus = MK_INTERRUPTED;
|
||||
reader->StreamAbort(mStatus);
|
||||
|
@ -482,12 +486,12 @@ ImageConsumer::KeepPumpingStream(nsITimer *aTimer, void *aClosure)
|
|||
ImageConsumer *consumer = (ImageConsumer *)aClosure;
|
||||
nsAutoString status;
|
||||
|
||||
consumer->OnStopRequest(consumer->mChannel, consumer->mUserContext,
|
||||
consumer->OnStopRequest(consumer->mRequest, consumer->mUserContext,
|
||||
NS_BINDING_SUCCEEDED, status.GetUnicode());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
|
||||
ImageConsumer::OnStopRequest(nsIRequest* request, nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
|
@ -506,12 +510,12 @@ ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresul
|
|||
nsresult err = mStream->Available(&str_length);
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
NS_ASSERTION((str_length > 0), "No data left in the stream!");
|
||||
err = OnDataAvailable(channel, aContext, mStream, 0, str_length); // XXX fix offset
|
||||
err = OnDataAvailable(request, aContext, mStream, 0, str_length); // XXX fix offset
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
// If we still have the stream, there's still data to be
|
||||
// pumped, so we set a timer to call us back again.
|
||||
if (mStream) {
|
||||
SetKeepPumpingData(channel, aContext);
|
||||
SetKeepPumpingData(request, aContext);
|
||||
|
||||
nsresult rv;
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
|
@ -550,7 +554,7 @@ ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresul
|
|||
reader->NetRequestDone(mURL, mStatus);
|
||||
NS_RELEASE(reader);
|
||||
|
||||
return mContext->RequestDone(this, channel, aContext, status, aMsg);
|
||||
return mContext->RequestDone(this, request, aContext, status, aMsg);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -583,7 +587,7 @@ ImageConsumer::~ImageConsumer()
|
|||
if (mBuffer != nsnull) {
|
||||
PR_DELETE(mBuffer);
|
||||
}
|
||||
NS_IF_RELEASE(mChannel);
|
||||
NS_IF_RELEASE(mRequest);
|
||||
NS_IF_RELEASE(mUserContext);
|
||||
}
|
||||
|
||||
|
@ -708,24 +712,7 @@ ImageNetContextImpl::IsURLInDiskCache(ilIURL *aUrl)
|
|||
int
|
||||
ImageNetContextImpl::GetContentLength (ilIURL * aURL)
|
||||
{
|
||||
nsresult rv;
|
||||
int content_length=0;
|
||||
|
||||
nsCOMPtr<nsIURI> nsurl = do_QueryInterface(aURL, &rv);
|
||||
if (NS_FAILED(rv)) return 0;
|
||||
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsISupports> loadContext (do_QueryReferent(mLoadContext));
|
||||
nsCOMPtr<nsILoadGroup> group (do_GetInterface(loadContext));
|
||||
nsCOMPtr<nsIInterfaceRequestor> sink(do_QueryInterface(loadContext));
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), nsurl, nsnull, group, sink);
|
||||
if (NS_FAILED(rv)) return 0;
|
||||
|
||||
rv = channel->GetContentLength(&content_length);
|
||||
return content_length;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -785,14 +772,16 @@ ImageNetContextImpl::GetURL (ilIURL * aURL,
|
|||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
|
||||
if (httpChannel)
|
||||
{
|
||||
// Get the defloadchannel from the loadgroup-
|
||||
nsCOMPtr<nsIChannel> defLoadChannel;
|
||||
if (NS_SUCCEEDED(group->GetDefaultLoadChannel(
|
||||
getter_AddRefs(defLoadChannel))) && defLoadChannel)
|
||||
// Get the defloadRequest from the loadgroup-
|
||||
nsCOMPtr<nsIRequest> defLoadRequest;
|
||||
if (NS_SUCCEEDED(group->GetDefaultLoadRequest(
|
||||
getter_AddRefs(defLoadRequest))) && defLoadRequest)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> reqchannel = do_QueryInterface(defLoadRequest);
|
||||
|
||||
// Get the referrer from the loadchannel-
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
if (NS_SUCCEEDED(defLoadChannel->GetURI(getter_AddRefs(referrer))))
|
||||
if (NS_SUCCEEDED(reqchannel->GetURI(getter_AddRefs(referrer))))
|
||||
{
|
||||
// Set the referrer-
|
||||
httpChannel->SetReferrer(referrer,
|
||||
|
@ -826,7 +815,7 @@ ImageNetContextImpl::GetURL (ilIURL * aURL,
|
|||
rv = pURILoader->OpenURI(channel, loadCmd, nsnull /* window target */,
|
||||
window);
|
||||
}
|
||||
// rv = channel->AsyncRead(ic, nsnull);
|
||||
// rv = channel->AsyncOpen(ic, nsnull);
|
||||
if (NS_FAILED(rv)) goto error;
|
||||
}
|
||||
|
||||
|
@ -851,8 +840,8 @@ ImageNetContextImpl::RemoveRequest(ImageConsumer *aConsumer)
|
|||
}
|
||||
|
||||
nsresult
|
||||
ImageNetContextImpl::RequestDone(ImageConsumer *aConsumer, nsIChannel* channel,
|
||||
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg)
|
||||
ImageNetContextImpl::RequestDone(ImageConsumer *aConsumer, nsIRequest* request,
|
||||
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
RemoveRequest(aConsumer);
|
||||
/// if (mLoadGroup)
|
||||
|
@ -879,14 +868,18 @@ NS_NewImageNetContext(ilINetContext **aInstancePtrResult,
|
|||
|
||||
if(aLoadContext){
|
||||
nsCOMPtr<nsILoadGroup> group (do_GetInterface(aLoadContext));
|
||||
nsresult rv = group->GetDefaultLoadAttributes(&necko_attribs);
|
||||
/*nsresult rv = */group->GetDefaultLoadAttributes(&necko_attribs);
|
||||
/*
|
||||
Need code to check freshness of necko cache.
|
||||
*/
|
||||
nsCOMPtr<nsIChannel> defLoadChannel;
|
||||
if (NS_SUCCEEDED(group->GetDefaultLoadChannel(
|
||||
getter_AddRefs(defLoadChannel))) && defLoadChannel)
|
||||
defLoadChannel->GetLoadAttributes(&defchan_attribs);
|
||||
nsCOMPtr<nsIRequest> defLoadRequest;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
if (NS_SUCCEEDED(group->GetDefaultLoadRequest(
|
||||
getter_AddRefs(defLoadRequest))) && defLoadRequest)
|
||||
{
|
||||
channel = do_QueryInterface(defLoadRequest);
|
||||
if (channel) channel->GetLoadAttributes(&defchan_attribs);
|
||||
}
|
||||
|
||||
#if defined( DEBUG )
|
||||
if (image_net_context_async_log_module == NULL) {
|
||||
|
|
|
@ -218,6 +218,9 @@ ImageNetContextSyncImpl::GetURL(ilIURL* aURL,
|
|||
if(aContentType){
|
||||
nsCRT::free(aContentType);
|
||||
}
|
||||
}
|
||||
|
||||
if (!aContentType) {
|
||||
aContentType = nsCRT::strdup("unknown");
|
||||
}
|
||||
if(nsCRT::strlen(aContentType) > 50){
|
||||
|
@ -226,8 +229,8 @@ ImageNetContextSyncImpl::GetURL(ilIURL* aURL,
|
|||
nsCRT::free(aContentType);
|
||||
aContentType = nsCRT::strdup("unknown");
|
||||
}
|
||||
|
||||
rv = channel->OpenInputStream(&stream);
|
||||
|
||||
rv = channel->Open( &stream);
|
||||
NS_RELEASE(channel);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ CStreamListener::OnStartDocumentLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CStreamListener::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsresult aStatus)
|
||||
{
|
||||
fputs("done.\n",stdout);
|
||||
|
@ -162,14 +162,14 @@ CStreamListener::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CStreamListener::OnStartURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel)
|
||||
nsIRequest *request)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CStreamListener::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ CStreamListener::OnProgressURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CStreamListener::OnStatusURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsString& aMsg)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -186,7 +186,7 @@ CStreamListener::OnStatusURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
NS_IMETHODIMP
|
||||
CStreamListener::OnEndURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIRequest *request,
|
||||
nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
|
|
|
@ -61,7 +61,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
|
|||
mContextType=eCTNone;
|
||||
mCopyUnused=aCopyUnused;
|
||||
mParserCommand=aCommand;
|
||||
mChannel=0;
|
||||
mRequest=0;
|
||||
mValidator=0;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ CParserContext::CParserContext(const CParserContext &aContext) : mMimeType() {
|
|||
mStreamListenerState=aContext.mStreamListenerState;
|
||||
mMultipart=aContext.mMultipart;
|
||||
mContextType=aContext.mContextType;
|
||||
mChannel=aContext.mChannel;
|
||||
mRequest=aContext.mRequest;
|
||||
mParserCommand=aContext.mParserCommand;
|
||||
SetMimeType(aContext.mMimeType);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
eContextType mContextType;
|
||||
eAutoDetectResult mAutoDetectStatus;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
nsIChannel* mChannel; // provided by necko to differnciate different input streams
|
||||
nsIRequest* mRequest; // provided by necko to differnciate different input streams
|
||||
|
||||
nsScanner* mScanner;
|
||||
nsIDTD* mDTD;
|
||||
|
|
|
@ -2062,11 +2062,11 @@ nsITokenizer* nsParser::GetTokenizer(void) {
|
|||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult
|
||||
nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
nsParser::OnProgress(nsIRequest *request, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
nsresult result=0;
|
||||
if (nsnull != mProgressEventSink) {
|
||||
mProgressEventSink->OnProgress(channel, aContext, aProgress, aProgressMax);
|
||||
mProgressEventSink->OnProgress(request, aContext, aProgress, aProgressMax);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -2079,12 +2079,12 @@ nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgr
|
|||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult
|
||||
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
|
||||
nsParser::OnStatus(nsIRequest *request, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
if (nsnull != mProgressEventSink) {
|
||||
rv = mProgressEventSink->OnStatus(channel, aContext, aStatus, aStatusArg);
|
||||
rv = mProgressEventSink->OnStatus(request, aContext, aStatus, aStatusArg);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -2102,19 +2102,22 @@ nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
|
|||
* @param
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext) {
|
||||
nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
|
||||
|
||||
NS_PRECONDITION((eNone==mParserContext->mStreamListenerState),kBadListenerInit);
|
||||
|
||||
if (nsnull != mObserver) {
|
||||
mObserver->OnStartRequest(channel, aContext);
|
||||
mObserver->OnStartRequest(request, aContext);
|
||||
}
|
||||
mParserContext->mStreamListenerState=eOnStart;
|
||||
mParserContext->mAutoDetectStatus=eUnknownDetect;
|
||||
mParserContext->mChannel=channel;
|
||||
mParserContext->mRequest=request;
|
||||
mParserContext->mDTD=0;
|
||||
nsresult rv;
|
||||
char* contentType = nsnull;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
NS_ASSERTION(channel, "parser needs a channel to find a dtd");
|
||||
|
||||
rv = channel->GetContentType(&contentType);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -2310,7 +2313,7 @@ ParserWriteFunc(nsIInputStream* in,
|
|||
* @return error code (usually 0)
|
||||
*/
|
||||
|
||||
nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
|
||||
nsresult nsParser::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
|
||||
nsIInputStream *pIStream, PRUint32 sourceOffset, PRUint32 aLength)
|
||||
{
|
||||
|
||||
|
@ -2322,12 +2325,12 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
|
|||
CParserContext *theContext=mParserContext;
|
||||
|
||||
while(theContext) {
|
||||
if(theContext->mChannel!=channel && theContext->mPrevContext)
|
||||
if(theContext->mRequest!=request && theContext->mPrevContext)
|
||||
theContext=theContext->mPrevContext;
|
||||
else break;
|
||||
}
|
||||
|
||||
if(theContext && theContext->mChannel==channel) {
|
||||
if(theContext && theContext->mRequest==request) {
|
||||
|
||||
theContext->mStreamListenerState=eOnDataAvail;
|
||||
|
||||
|
@ -2366,7 +2369,7 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
|
||||
nsresult nsParser::OnStopRequest(nsIRequest *request, nsISupports* aContext,
|
||||
nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
|
||||
|
@ -2398,7 +2401,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
|
|||
// XXX Should we wait to notify our observers as well if the
|
||||
// parser isn't yet enabled?
|
||||
if (nsnull != mObserver) {
|
||||
mObserver->OnStopRequest(channel, aContext, status, aMsg);
|
||||
mObserver->OnStopRequest(request, aContext, status, aMsg);
|
||||
}
|
||||
|
||||
#ifdef rickgdebug
|
||||
|
|
|
@ -48,6 +48,7 @@ class nsScannerString : public nsSlidingString {
|
|||
nsScannerString(PRUnichar* aStorageStart,
|
||||
PRUnichar* aDataEnd,
|
||||
PRUnichar* aStorageEnd);
|
||||
|
||||
virtual void UngetReadable(const nsAReadableString& aReadable, const nsReadingIterator<PRUnichar>& aCurrentPosition) { InsertReadable(aReadable,aCurrentPosition); }
|
||||
virtual void ReplaceCharacter(nsReadingIterator<PRUnichar>& aPosition,
|
||||
PRUnichar aChar);
|
||||
|
|
|
@ -237,7 +237,7 @@ PageGrabber::Grab(const nsString& aURL)
|
|||
if(copier) {
|
||||
NS_ADDREF(copier);
|
||||
|
||||
rv = channel->AsyncRead(copier, nsnull);
|
||||
rv = channel->AsyncOpen(copier, nsnull);
|
||||
|
||||
if (NS_OK != rv) {
|
||||
NS_RELEASE(copier);
|
||||
|
|
|
@ -238,8 +238,10 @@ nsStringBundle::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
nsXPIDLCString uriSpec;
|
||||
if (NS_FAILED(aStatus)) {
|
||||
if (aLoader) {
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
aLoader->GetChannel(getter_AddRefs(channel));
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
aLoader->GetRequest(getter_AddRefs(request));
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
|
||||
if (channel) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
|
|
|
@ -632,13 +632,12 @@ protected:
|
|||
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIChannel** aResult, nsIPresShell* aPresShell);
|
||||
Create(nsIRequest** aResult, nsIPresShell* aPresShell);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest
|
||||
NS_IMETHOD GetName(PRUnichar* *result) {
|
||||
NS_NOTREACHED("DummyLayoutRequest::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD IsPending(PRBool *_retval) { *_retval = PR_TRUE; return NS_OK; }
|
||||
|
@ -647,39 +646,27 @@ public:
|
|||
NS_IMETHOD Suspend(void) { return NS_OK; }
|
||||
NS_IMETHOD Resume(void) { return NS_OK; }
|
||||
|
||||
// nsIChannel
|
||||
// nsIChannel
|
||||
NS_IMETHOD GetOriginalURI(nsIURI* *aOriginalURI) { *aOriginalURI = gURI; NS_ADDREF(*aOriginalURI); return NS_OK; }
|
||||
NS_IMETHOD SetOriginalURI(nsIURI* aOriginalURI) { gURI = aOriginalURI; NS_ADDREF(gURI); return NS_OK; }
|
||||
NS_IMETHOD GetURI(nsIURI* *aURI) { *aURI = gURI; NS_ADDREF(*aURI); return NS_OK; }
|
||||
NS_IMETHOD SetURI(nsIURI* aURI) { gURI = aURI; NS_ADDREF(gURI); return NS_OK; }
|
||||
NS_IMETHOD OpenInputStream(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD OpenOutputStream(nsIOutputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadAttributes(nsLoadFlags *aLoadAttributes) { *aLoadAttributes = nsIChannel::LOAD_NORMAL; return NS_OK; }
|
||||
NS_IMETHOD Open(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadAttributes(nsLoadFlags *aLoadAttributes) { *aLoadAttributes = nsIChannel::LOAD_NORMAL; return NS_OK; }
|
||||
NS_IMETHOD SetLoadAttributes(nsLoadFlags aLoadAttributes) { return NS_OK; }
|
||||
NS_IMETHOD GetContentType(char * *aContentType) { *aContentType = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetContentType(const char *aContentType) { return NS_OK; }
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { *aContentLength = 0; return NS_OK; }
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { NS_NOTREACHED("SetContentLength"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetTransferOffset(PRUint32 *aTransferOffset) { NS_NOTREACHED("GetTransferOffset"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetTransferOffset(PRUint32 aTransferOffset) { NS_NOTREACHED("SetTransferOffset"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetTransferCount(PRInt32 *aTransferCount) { NS_NOTREACHED("GetTransferCount"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetTransferCount(PRInt32 aTransferCount) { NS_NOTREACHED("SetTransferCount"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetBufferSegmentSize(PRUint32 *aBufferSegmentSize) { NS_NOTREACHED("GetBufferSegmentSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetBufferSegmentSize(PRUint32 aBufferSegmentSize) { NS_NOTREACHED("SetBufferSegmentSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetBufferMaxSize(PRUint32 *aBufferMaxSize) { NS_NOTREACHED("GetBufferMaxSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetBufferMaxSize(PRUint32 aBufferMaxSize) { NS_NOTREACHED("SetBufferMaxSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetLocalFile(nsIFile* *result) { NS_NOTREACHED("GetLocalFile"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetPipeliningAllowed(PRBool *aPipeliningAllowed) { *aPipeliningAllowed = PR_FALSE; return NS_OK; }
|
||||
NS_IMETHOD SetPipeliningAllowed(PRBool aPipeliningAllowed) { NS_NOTREACHED("SetPipeliningAllowed"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetOwner(nsISupports * *aOwner) { *aOwner = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetOwner(nsISupports * aOwner) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { *aLoadGroup = mLoadGroup; NS_IF_ADDREF(*aLoadGroup); return NS_OK; }
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { mLoadGroup = aLoadGroup; return NS_OK; }
|
||||
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { *aNotificationCallbacks = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return NS_OK; }
|
||||
NS_IMETHOD GetSecurityInfo(nsISupports **info) {*info = nsnull; return NS_OK;}
|
||||
NS_IMETHOD GetOwner(nsISupports * *aOwner) { *aOwner = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetOwner(nsISupports * aOwner) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { *aLoadGroup = mLoadGroup; NS_IF_ADDREF(*aLoadGroup); return NS_OK; }
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { mLoadGroup = aLoadGroup; return NS_OK; }
|
||||
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { *aNotificationCallbacks = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return NS_OK; }
|
||||
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { *aSecurityInfo = nsnull; return NS_OK; }
|
||||
NS_IMETHOD GetContentType(char * *aContentType) { *aContentType = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetContentType(const char * aContentType) { return NS_OK; }
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return NS_OK; }
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return NS_OK; }
|
||||
|
||||
};
|
||||
|
||||
PRInt32 DummyLayoutRequest::gRefCnt;
|
||||
|
@ -690,15 +677,13 @@ NS_IMPL_RELEASE(DummyLayoutRequest);
|
|||
NS_IMPL_QUERY_INTERFACE2(DummyLayoutRequest, nsIRequest, nsIChannel);
|
||||
|
||||
nsresult
|
||||
DummyLayoutRequest::Create(nsIChannel** aResult, nsIPresShell* aPresShell)
|
||||
DummyLayoutRequest::Create(nsIRequest** aResult, nsIPresShell* aPresShell)
|
||||
{
|
||||
DummyLayoutRequest* request = new DummyLayoutRequest(aPresShell);
|
||||
if (!request)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aResult = request;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
return request->QueryInterface(NS_GET_IID(nsIRequest), (void**) aResult);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1063,7 +1048,7 @@ protected:
|
|||
nsCOMPtr<nsIObserverService> mObserverService; // Observer service for reflow events
|
||||
nsCOMPtr<nsIDragService> mDragService;
|
||||
PRInt32 mRCCreatedDuringLoad; // Counter to keep track of reflow commands created during doc
|
||||
nsCOMPtr<nsIChannel> mDummyLayoutRequest;
|
||||
nsCOMPtr<nsIRequest> mDummyLayoutRequest;
|
||||
|
||||
// used for list of posted events and attribute changes. To be done
|
||||
// after reflow.
|
||||
|
@ -5277,10 +5262,10 @@ PresShell::AddDummyLayoutRequest(void)
|
|||
}
|
||||
|
||||
if (loadGroup) {
|
||||
rv = mDummyLayoutRequest->SetLoadGroup(loadGroup);
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mDummyLayoutRequest);
|
||||
rv = channel->SetLoadGroup(loadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = loadGroup->AddChannel(mDummyLayoutRequest, nsnull);
|
||||
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -5304,7 +5289,7 @@ PresShell::RemoveDummyLayoutRequest(void)
|
|||
}
|
||||
|
||||
if (loadGroup && mDummyLayoutRequest) {
|
||||
rv = loadGroup->RemoveChannel(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
|
||||
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDummyLayoutRequest = nsnull;
|
||||
|
|
|
@ -632,13 +632,12 @@ protected:
|
|||
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIChannel** aResult, nsIPresShell* aPresShell);
|
||||
Create(nsIRequest** aResult, nsIPresShell* aPresShell);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest
|
||||
NS_IMETHOD GetName(PRUnichar* *result) {
|
||||
NS_NOTREACHED("DummyLayoutRequest::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHOD IsPending(PRBool *_retval) { *_retval = PR_TRUE; return NS_OK; }
|
||||
|
@ -647,39 +646,27 @@ public:
|
|||
NS_IMETHOD Suspend(void) { return NS_OK; }
|
||||
NS_IMETHOD Resume(void) { return NS_OK; }
|
||||
|
||||
// nsIChannel
|
||||
// nsIChannel
|
||||
NS_IMETHOD GetOriginalURI(nsIURI* *aOriginalURI) { *aOriginalURI = gURI; NS_ADDREF(*aOriginalURI); return NS_OK; }
|
||||
NS_IMETHOD SetOriginalURI(nsIURI* aOriginalURI) { gURI = aOriginalURI; NS_ADDREF(gURI); return NS_OK; }
|
||||
NS_IMETHOD GetURI(nsIURI* *aURI) { *aURI = gURI; NS_ADDREF(*aURI); return NS_OK; }
|
||||
NS_IMETHOD SetURI(nsIURI* aURI) { gURI = aURI; NS_ADDREF(gURI); return NS_OK; }
|
||||
NS_IMETHOD OpenInputStream(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD OpenOutputStream(nsIOutputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadAttributes(nsLoadFlags *aLoadAttributes) { *aLoadAttributes = nsIChannel::LOAD_NORMAL; return NS_OK; }
|
||||
NS_IMETHOD Open(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
|
||||
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadAttributes(nsLoadFlags *aLoadAttributes) { *aLoadAttributes = nsIChannel::LOAD_NORMAL; return NS_OK; }
|
||||
NS_IMETHOD SetLoadAttributes(nsLoadFlags aLoadAttributes) { return NS_OK; }
|
||||
NS_IMETHOD GetContentType(char * *aContentType) { *aContentType = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetContentType(const char *aContentType) { return NS_OK; }
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { *aContentLength = 0; return NS_OK; }
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { NS_NOTREACHED("SetContentLength"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetTransferOffset(PRUint32 *aTransferOffset) { NS_NOTREACHED("GetTransferOffset"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetTransferOffset(PRUint32 aTransferOffset) { NS_NOTREACHED("SetTransferOffset"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetTransferCount(PRInt32 *aTransferCount) { NS_NOTREACHED("GetTransferCount"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetTransferCount(PRInt32 aTransferCount) { NS_NOTREACHED("SetTransferCount"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetBufferSegmentSize(PRUint32 *aBufferSegmentSize) { NS_NOTREACHED("GetBufferSegmentSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetBufferSegmentSize(PRUint32 aBufferSegmentSize) { NS_NOTREACHED("SetBufferSegmentSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetBufferMaxSize(PRUint32 *aBufferMaxSize) { NS_NOTREACHED("GetBufferMaxSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetBufferMaxSize(PRUint32 aBufferMaxSize) { NS_NOTREACHED("SetBufferMaxSize"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetLocalFile(nsIFile* *result) { NS_NOTREACHED("GetLocalFile"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetPipeliningAllowed(PRBool *aPipeliningAllowed) { *aPipeliningAllowed = PR_FALSE; return NS_OK; }
|
||||
NS_IMETHOD SetPipeliningAllowed(PRBool aPipeliningAllowed) { NS_NOTREACHED("SetPipeliningAllowed"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetOwner(nsISupports * *aOwner) { *aOwner = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetOwner(nsISupports * aOwner) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { *aLoadGroup = mLoadGroup; NS_IF_ADDREF(*aLoadGroup); return NS_OK; }
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { mLoadGroup = aLoadGroup; return NS_OK; }
|
||||
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { *aNotificationCallbacks = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return NS_OK; }
|
||||
NS_IMETHOD GetSecurityInfo(nsISupports **info) {*info = nsnull; return NS_OK;}
|
||||
NS_IMETHOD GetOwner(nsISupports * *aOwner) { *aOwner = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetOwner(nsISupports * aOwner) { return NS_OK; }
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { *aLoadGroup = mLoadGroup; NS_IF_ADDREF(*aLoadGroup); return NS_OK; }
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { mLoadGroup = aLoadGroup; return NS_OK; }
|
||||
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { *aNotificationCallbacks = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return NS_OK; }
|
||||
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { *aSecurityInfo = nsnull; return NS_OK; }
|
||||
NS_IMETHOD GetContentType(char * *aContentType) { *aContentType = nsnull; return NS_OK; }
|
||||
NS_IMETHOD SetContentType(const char * aContentType) { return NS_OK; }
|
||||
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return NS_OK; }
|
||||
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return NS_OK; }
|
||||
|
||||
};
|
||||
|
||||
PRInt32 DummyLayoutRequest::gRefCnt;
|
||||
|
@ -690,15 +677,13 @@ NS_IMPL_RELEASE(DummyLayoutRequest);
|
|||
NS_IMPL_QUERY_INTERFACE2(DummyLayoutRequest, nsIRequest, nsIChannel);
|
||||
|
||||
nsresult
|
||||
DummyLayoutRequest::Create(nsIChannel** aResult, nsIPresShell* aPresShell)
|
||||
DummyLayoutRequest::Create(nsIRequest** aResult, nsIPresShell* aPresShell)
|
||||
{
|
||||
DummyLayoutRequest* request = new DummyLayoutRequest(aPresShell);
|
||||
if (!request)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aResult = request;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
return request->QueryInterface(NS_GET_IID(nsIRequest), (void**) aResult);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1063,7 +1048,7 @@ protected:
|
|||
nsCOMPtr<nsIObserverService> mObserverService; // Observer service for reflow events
|
||||
nsCOMPtr<nsIDragService> mDragService;
|
||||
PRInt32 mRCCreatedDuringLoad; // Counter to keep track of reflow commands created during doc
|
||||
nsCOMPtr<nsIChannel> mDummyLayoutRequest;
|
||||
nsCOMPtr<nsIRequest> mDummyLayoutRequest;
|
||||
|
||||
// used for list of posted events and attribute changes. To be done
|
||||
// after reflow.
|
||||
|
@ -5277,10 +5262,10 @@ PresShell::AddDummyLayoutRequest(void)
|
|||
}
|
||||
|
||||
if (loadGroup) {
|
||||
rv = mDummyLayoutRequest->SetLoadGroup(loadGroup);
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mDummyLayoutRequest);
|
||||
rv = channel->SetLoadGroup(loadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = loadGroup->AddChannel(mDummyLayoutRequest, nsnull);
|
||||
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -5304,7 +5289,7 @@ PresShell::RemoveDummyLayoutRequest(void)
|
|||
}
|
||||
|
||||
if (loadGroup && mDummyLayoutRequest) {
|
||||
rv = loadGroup->RemoveChannel(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
|
||||
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDummyLayoutRequest = nsnull;
|
||||
|
|
|
@ -342,7 +342,7 @@ NS_IMETHODIMP
|
|||
nsAbSyncPostEngine::DoContent(const char * aContentType,
|
||||
nsURILoadCommand aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsIChannel * aOpenedChannel,
|
||||
nsIRequest *request,
|
||||
nsIStreamListener ** aContentHandler,
|
||||
PRBool * aAbortProcess)
|
||||
{
|
||||
|
@ -391,7 +391,7 @@ nsAbSyncPostEngine::StillRunning(PRBool *running)
|
|||
|
||||
// Methods for nsIStreamListener...
|
||||
nsresult
|
||||
nsAbSyncPostEngine::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
|
||||
nsAbSyncPostEngine::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
|
||||
PRUint32 sourceOffset, PRUint32 aLength)
|
||||
{
|
||||
PRUint32 readLen = aLength;
|
||||
|
@ -417,7 +417,7 @@ nsAbSyncPostEngine::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, n
|
|||
|
||||
// Methods for nsIStreamObserver
|
||||
nsresult
|
||||
nsAbSyncPostEngine::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
|
||||
nsAbSyncPostEngine::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
if (mAuthenticationRunning)
|
||||
NotifyListenersOnStartAuthOperation();
|
||||
|
@ -427,7 +427,7 @@ nsAbSyncPostEngine::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsAbSyncPostEngine::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
#ifdef NS_DEBUG_rhp
|
||||
printf("nsAbSyncPostEngine::OnStopRequest()\n");
|
||||
|
@ -441,20 +441,20 @@ nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */
|
|||
mStillRunning = PR_FALSE;
|
||||
|
||||
// Check the content type!
|
||||
if (aChannel)
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (channel)
|
||||
{
|
||||
char *contentType = nsnull;
|
||||
char *charset = nsnull;
|
||||
|
||||
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
|
||||
if (NS_SUCCEEDED(channel->GetContentType(&contentType)) && contentType)
|
||||
{
|
||||
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
|
||||
{
|
||||
mContentType = contentType;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
|
||||
if (httpChannel)
|
||||
{
|
||||
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
|
||||
|
@ -706,8 +706,8 @@ nsAbSyncPostEngine::FireURLRequest(nsIURI *aURL, const char *postData)
|
|||
httpChannel->SetRequestMethod(method);
|
||||
if (NS_SUCCEEDED(rv = NS_NewPostDataStream(getter_AddRefs(postStream), PR_FALSE, postData, 0)))
|
||||
httpChannel->SetUploadStream(postStream);
|
||||
|
||||
httpChannel->AsyncRead(this, nsnull);
|
||||
|
||||
httpChannel->AsyncOpen(this, nsnull);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -844,11 +844,9 @@ nsAbSyncPostEngine::CancelAbSync()
|
|||
{
|
||||
rv = mSyncMojo->CancelTheMojo();
|
||||
}
|
||||
else
|
||||
else if (mChannel)
|
||||
{
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(mChannel);
|
||||
if (httpChannel)
|
||||
rv = httpChannel->Cancel(NS_BINDING_ABORTED);
|
||||
rv = mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -109,7 +109,6 @@ private:
|
|||
PRBool mAuthenticationRunning;
|
||||
nsCOMPtr<nsIAbSyncMojo> mSyncMojo;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
|
||||
char *mSyncProtocolRequest;
|
||||
char *mSyncProtocolRequestPrefix;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ interface nsIMsgFilterList;
|
|||
|
||||
interface nsIMsgFolderCacheElement;
|
||||
interface nsAutoString;
|
||||
interface nsIFileChannel;
|
||||
interface nsITransport;
|
||||
|
||||
typedef long nsMsgBiffState;
|
||||
// enumerated type for determining if a message has been replied to, forwarded, etc.
|
||||
|
@ -349,7 +349,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
|||
nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);
|
||||
boolean shouldStoreMsgOffline(in nsMsgKey msgKey);
|
||||
boolean hasMsgOffline(in nsMsgKey msgKey);
|
||||
nsIFileChannel getOfflineFileChannel(in nsMsgKey msgKey);
|
||||
nsITransport getOfflineFileTransport(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size);
|
||||
void DownloadMessagesForOffline(in nsISupportsArray messages);
|
||||
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);
|
||||
void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window);
|
||||
|
|
|
@ -131,14 +131,14 @@ NS_IMETHODIMP nsCopyMessageStreamListener::EndMessage(nsMsgKey key)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mDestination->CopyData(aIStream, aLength);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request, nsISupports *ctxt)
|
||||
{
|
||||
nsCOMPtr<nsIMessage> message;
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -154,7 +154,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIChannel * aChannel,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt, &rv);
|
||||
|
|
|
@ -1595,7 +1595,7 @@ nsSaveMsgListener::OnStopCopy(nsresult aStatus)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSaveMsgListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aSupport)
|
||||
nsSaveMsgListener::OnStartRequest(nsIRequest* request, nsISupports* aSupport)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (m_fileSpec)
|
||||
|
@ -1612,7 +1612,7 @@ nsSaveMsgListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aSupport)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSaveMsgListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aSupport,
|
||||
nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
|
||||
nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1710,7 +1710,7 @@ nsSaveMsgListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aSupport,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSaveMsgListener::OnDataAvailable(nsIChannel* aChannel,
|
||||
nsSaveMsgListener::OnDataAvailable(nsIRequest* request,
|
||||
nsISupports* aSupport,
|
||||
nsIInputStream* inStream,
|
||||
PRUint32 srcOffset,
|
||||
|
|
|
@ -356,7 +356,7 @@ nsFolderCompactState::GetMessage(nsIMessage **message)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFolderCompactState::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
|
||||
nsFolderCompactState::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
NS_ASSERTION(m_fileStream, "Fatal, null m_fileStream...\n");
|
||||
|
@ -371,7 +371,7 @@ nsFolderCompactState::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFolderCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsFolderCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
|
||||
nsresult status,
|
||||
const PRUnichar *errorMsg)
|
||||
{
|
||||
|
@ -430,7 +430,7 @@ done:
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFolderCompactState::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsFolderCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||
nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ nsOfflineStoreCompactState::InitDB(nsIMsgDatabase *db)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOfflineStoreCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
|
||||
nsresult status,
|
||||
const PRUnichar *errorMsg)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
virtual ~nsOfflineStoreCompactState(void);
|
||||
virtual nsresult InitDB(nsIMsgDatabase *db);
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg);
|
||||
|
||||
NS_IMETHODIMP FinishCompact();
|
||||
|
|
|
@ -96,7 +96,7 @@ nsMsgPrintEngine::OnStartDocumentLoad(nsIDocumentLoader *aLoader, nsIURI *aURL,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChannel, PRUint32 aStatus)
|
||||
nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIRequest *request, PRUint32 aStatus)
|
||||
{
|
||||
// Now, fire off the print operation!
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
@ -107,10 +107,12 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
|
|||
PR_FREEIF(msg);
|
||||
|
||||
NS_ASSERTION(mDocShell,"can't print, there is no docshell");
|
||||
if ( (!mDocShell) || (!aChannel) )
|
||||
if ( (!mDocShell) || (!request) )
|
||||
{
|
||||
return StartNextPrintOperation();
|
||||
}
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel) return NS_ERROR_FAILURE;
|
||||
|
||||
// Make sure this isn't just "about:blank" finishing....
|
||||
nsCOMPtr<nsIURI> originalURI = nsnull;
|
||||
|
@ -158,25 +160,25 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIChannel *channel)
|
||||
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIChannel *channel, nsString & aMsg)
|
||||
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIRequest *request, nsString & aMsg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aStatus)
|
||||
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -245,15 +245,15 @@ NS_IMETHODIMP nsMsgStatusFeedback::SetDocShell(nsIDocShell *shell, nsIDOMWindowI
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIChannel* channel, nsISupports* ctxt,
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIRequest *request, nsISupports* ctxt,
|
||||
PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
// XXX: What should the nsIWebProgress be?
|
||||
return OnProgressChange(nsnull, channel, aProgress, aProgressMax,
|
||||
return OnProgressChange(nsnull, request, aProgress, aProgressMax,
|
||||
aProgress /* current total progress */, aProgressMax /* max total progress */);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIChannel* channel, nsISupports* ctxt,
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
|
|
@ -398,7 +398,7 @@ NS_IMETHODIMP nsMsgWindow::GetProtocolHandler(nsIURI * /* aURI */, nsIProtocolHa
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget,
|
||||
nsIChannel *aChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
|
||||
{
|
||||
if (aContentType)
|
||||
{
|
||||
|
@ -408,6 +408,9 @@ NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand
|
|||
nsCOMPtr<nsIURIContentListener> ctnListener = do_QueryInterface(messageWindowDocShell);
|
||||
if (ctnListener)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel) return NS_ERROR_FAILURE;
|
||||
|
||||
// get the url for the channel...let's hope it is a mailnews url so we can set our msg hdr sink on it..
|
||||
// right now, this is the only way I can think of to force the msg hdr sink into the mime converter so it can
|
||||
// get too it later...
|
||||
|
@ -419,7 +422,7 @@ NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand
|
|||
if (mailnewsUrl)
|
||||
mailnewsUrl->SetMsgWindow(this);
|
||||
}
|
||||
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, aChannel, aContentHandler, aAbortProcess);
|
||||
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, request, aContentHandler, aAbortProcess);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include "nsLocalFolderSummarySpec.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIMsgFolderCompactor.h"
|
||||
#if defined(XP_OS2)
|
||||
#define MAX_FILE_LENGTH_WITHOUT_EXTENSION 8
|
||||
|
@ -587,10 +589,12 @@ nsresult nsMsgDBFolder::GetOfflineStoreInputStream(nsIInputStream **stream)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel)
|
||||
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **aFileChannel)
|
||||
{
|
||||
NS_ENSURE_ARG(aFileChannel);
|
||||
|
||||
*offset = *size = 0;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(NS_LOCALFILECHANNEL_CONTRACTID, nsnull,
|
||||
|
@ -604,7 +608,14 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChann
|
|||
rv = NS_NewLocalFile(nativePath, PR_TRUE, getter_AddRefs(localStore));
|
||||
if (NS_SUCCEEDED(rv) && localStore)
|
||||
{
|
||||
rv = (*aFileChannel)->Init(localStore, PR_CREATE_FILE | PR_RDWR, 0);
|
||||
NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = fts->CreateTransport(localStore, PR_RDWR | PR_CREATE_FILE, 0664, aFileChannel);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
||||
|
@ -612,12 +623,8 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChann
|
|||
rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(hdr));
|
||||
if (hdr && NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUint32 messageOffset;
|
||||
PRUint32 messageSize;
|
||||
hdr->GetMessageOffset(&messageOffset);
|
||||
hdr->GetOfflineMessageSize(&messageSize);
|
||||
(*aFileChannel)->SetTransferOffset(messageOffset);
|
||||
(*aFileChannel)->SetTransferCount(messageSize);
|
||||
hdr->GetMessageOffset(offset);
|
||||
hdr->GetOfflineMessageSize(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -637,11 +644,6 @@ nsresult nsMsgDBFolder::GetOfflineStoreOutputStream(nsIOutputStream **outputStre
|
|||
nsCOMPtr<nsIFileChannel> fileChannel = do_CreateInstance(NS_LOCALFILECHANNEL_CONTRACTID);
|
||||
if (fileChannel)
|
||||
{
|
||||
PRUint32 fileSize = 0;
|
||||
nsXPIDLCString nativePath;
|
||||
mPath->GetNativePath(getter_Copies(nativePath));
|
||||
|
||||
mPath->GetFileSize(&fileSize);
|
||||
nsCOMPtr <nsILocalFile> localStore;
|
||||
rv = NS_NewLocalFile(nativePath, PR_TRUE, getter_AddRefs(localStore));
|
||||
if (NS_SUCCEEDED(rv) && localStore)
|
||||
|
@ -649,8 +651,7 @@ nsresult nsMsgDBFolder::GetOfflineStoreOutputStream(nsIOutputStream **outputStre
|
|||
rv = fileChannel->Init(localStore, PR_CREATE_FILE | PR_RDWR, 0);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
fileChannel->SetTransferOffset(fileSize);
|
||||
rv = fileChannel->OpenOutputStream(outputStream);
|
||||
rv = fileChannel->Open(outputStream);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
@ -696,7 +697,6 @@ nsresult nsMsgDBFolder::CreatePlatformLeafNameForDisk(const char *userLeafName,
|
|||
// (c) does not already exist on the disk
|
||||
// then we simply return nsCRT::strdup(userLeafName)
|
||||
// Otherwise we mangle it
|
||||
|
||||
// mangledPath is the entire path to the newly mangled leaf name
|
||||
nsCAutoString mangledLeaf(userLeafName);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "nsIUrlListener.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsIOutputStream.h"
|
||||
|
||||
#include "nsITransport.h"
|
||||
class nsIMsgFolderCacheElement;
|
||||
|
||||
/*
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
NS_IMETHOD SetGettingNewMessages(PRBool gettingNewMessages);
|
||||
|
||||
NS_IMETHOD ShouldStoreMsgOffline(nsMsgKey msgKey, PRBool *result);
|
||||
NS_IMETHOD GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel);
|
||||
NS_IMETHOD GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **_retval);
|
||||
NS_IMETHOD HasMsgOffline(nsMsgKey msgKey, PRBool *result);
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages);
|
||||
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
|
||||
|
|
|
@ -2473,6 +2473,7 @@ NS_IMETHODIMP nsMsgFolder::EnableNotifications(PRInt32 notificationType, PRBool
|
|||
// we're probably doing something that should be batched.
|
||||
nsCOMPtr <nsIMsgDatabase> database;
|
||||
|
||||
|
||||
nsresult rv = GetMsgDatabase(nsnull, getter_AddRefs(database));
|
||||
if(enable)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
@ -37,7 +39,11 @@
|
|||
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
NS_IMPL_ISUPPORTS3(nsMsgProtocol, nsIStreamListener, nsIStreamObserver, nsIChannel)
|
||||
NS_IMPL_ISUPPORTS4(nsMsgProtocol,
|
||||
nsIStreamListener,
|
||||
nsIStreamObserver,
|
||||
nsIChannel,
|
||||
nsIRequest)
|
||||
|
||||
nsMsgProtocol::nsMsgProtocol(nsIURI * aURL)
|
||||
{
|
||||
|
@ -83,7 +89,7 @@ nsresult nsMsgProtocol::OpenNetworkSocketWithInfo(const char * aHostName, PRInt3
|
|||
m_readCount = -1; // with socket connections we want to read as much data as arrives
|
||||
m_startPosition = 0;
|
||||
|
||||
rv = socketService->CreateTransportOfType(connectionType, aHostName, aGetPort, nsnull, -1, 0, 0, getter_AddRefs(m_channel));
|
||||
rv = socketService->CreateTransportOfType(connectionType, aHostName, aGetPort, nsnull, -1, 0, 0, getter_AddRefs(m_transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
m_socketIsOpen = PR_FALSE;
|
||||
|
@ -120,11 +126,28 @@ nsresult nsMsgProtocol::OpenFileSocket(nsIURI * aURL, const nsFileSpec * aFileSp
|
|||
aURL->GetPath(getter_Copies(filePath));
|
||||
char * urlSpec = PR_smprintf("file://%s", (const char *) filePath);
|
||||
|
||||
rv = netService->NewChannel(urlSpec,
|
||||
nsnull, // null base URI
|
||||
getter_AddRefs(m_channel));
|
||||
// dougt - there should be an easier way!
|
||||
nsCOMPtr<nsIURI> aIURI;
|
||||
if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), urlSpec)))
|
||||
return(PR_FALSE);
|
||||
if (!aIURI) return(PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
|
||||
if (!fileURL) return(PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
rv = fileURL->GetFile(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) return(PR_FALSE);
|
||||
// dougt
|
||||
|
||||
NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = fts->CreateTransport(file, PR_RDWR | PR_CREATE_FILE,
|
||||
0664, getter_AddRefs(m_transport));
|
||||
PR_FREEIF(urlSpec);
|
||||
m_socketIsOpen = PR_FALSE;
|
||||
m_socketIsOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -134,9 +157,9 @@ nsresult nsMsgProtocol::SetupTransportState()
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!m_socketIsOpen && m_channel)
|
||||
if (!m_socketIsOpen && m_transport)
|
||||
{
|
||||
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
|
||||
rv = m_transport->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream));
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create an output stream");
|
||||
// we want to open the stream
|
||||
|
@ -154,10 +177,11 @@ nsresult nsMsgProtocol::CloseSocket()
|
|||
m_outputStream = null_nsCOMPtr();
|
||||
|
||||
// we need to call Cancel so that we remove the socket transport from the mActiveTransportList. see bug #30648
|
||||
if (m_channel) {
|
||||
rv = m_channel->Cancel(NS_BINDING_ABORTED);
|
||||
if (m_request) {
|
||||
rv = m_request->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
m_channel = null_nsCOMPtr();
|
||||
m_request = 0;
|
||||
m_transport = 0;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -187,14 +211,14 @@ PRInt32 nsMsgProtocol::SendData(nsIURI * aURL, const char * dataBuffer, PRBool a
|
|||
|
||||
// Whenever data arrives from the connection, core netlib notifices the protocol by calling
|
||||
// OnDataAvailable. We then read and process the incoming data from the input stream.
|
||||
NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
// right now, this really just means turn around and churn through the state machine
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt);
|
||||
return ProcessProtocolState(uri, inStr, sourceOffset, count);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> aMsgUrl = do_QueryInterface(ctxt, &rv);
|
||||
|
@ -202,7 +226,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *
|
|||
{
|
||||
rv = aMsgUrl->SetUrlState(PR_TRUE, NS_OK);
|
||||
if (m_loadGroup)
|
||||
m_loadGroup->AddChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull /* context isupports */);
|
||||
m_loadGroup->AddRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull /* context isupports */);
|
||||
}
|
||||
|
||||
// if we are set up as a channel, we should notify our channel listener that we are starting...
|
||||
|
@ -219,7 +243,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *
|
|||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -234,7 +258,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *c
|
|||
{
|
||||
rv = msgUrl->SetUrlState(PR_FALSE, aStatus);
|
||||
if (m_loadGroup)
|
||||
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull, aStatus, nsnull);
|
||||
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, aStatus, nsnull);
|
||||
|
||||
// !NS_BINDING_ABORTED because we don't want to see an alert if the user
|
||||
// cancelled the operation. also, we'll get here because we call Cancel()
|
||||
|
@ -312,19 +336,10 @@ nsresult nsMsgProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
if (!m_socketIsOpen)
|
||||
{
|
||||
nsCOMPtr<nsISupports> urlSupports = do_QueryInterface(aURL);
|
||||
if (m_channel)
|
||||
if (m_transport)
|
||||
{
|
||||
// XXX should these errors be returned?:
|
||||
if (m_startPosition > 0)
|
||||
{
|
||||
rv = m_channel->SetTransferOffset(m_startPosition);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetTransferOffset failed");
|
||||
}
|
||||
rv = m_channel->SetTransferCount(m_readCount);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetTransferCount failed");
|
||||
|
||||
// put us in a state where we are always notified of incoming data
|
||||
rv = m_channel->AsyncRead(this /* stream observer */, urlSupports);
|
||||
rv = m_transport->AsyncRead(this, urlSupports, m_startPosition, m_readCount, 0, getter_AddRefs(m_request));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncRead failed");
|
||||
m_socketIsOpen = PR_TRUE; // mark the channel as open
|
||||
}
|
||||
|
@ -378,19 +393,13 @@ NS_IMETHODIMP nsMsgProtocol::SetURI(nsIURI* aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::OpenInputStream(nsIInputStream **_retval)
|
||||
NS_IMETHODIMP nsMsgProtocol::Open(nsIInputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("OpenInputStream");
|
||||
NS_NOTREACHED("Open");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsMsgProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
// set the stream listener and then load the url
|
||||
m_channelContext = ctxt;
|
||||
|
@ -417,12 +426,6 @@ NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
|
|||
return LoadUrl(m_url, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
*aLoadAttributes = mLoadAttributes;
|
||||
|
@ -461,6 +464,18 @@ NS_IMETHODIMP nsMsgProtocol::GetContentLength(PRInt32 * aContentLength)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetName(PRUnichar * *aName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
|
@ -468,83 +483,6 @@ nsMsgProtocol::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
NS_NOTREACHED("GetLocalFile");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetOwner(nsISupports * *aPrincipal)
|
||||
{
|
||||
*aPrincipal = mOwner;
|
||||
|
@ -591,26 +529,10 @@ nsMsgProtocol::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCall
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIRequest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetName(PRUnichar* *result)
|
||||
{
|
||||
if (m_channel)
|
||||
return m_channel->GetName(result);
|
||||
NS_NOTREACHED("nsMsgProtocol::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::IsPending(PRBool *result)
|
||||
{
|
||||
*result = PR_TRUE;
|
||||
|
@ -619,8 +541,8 @@ NS_IMETHODIMP nsMsgProtocol::IsPending(PRBool *result)
|
|||
|
||||
NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
|
||||
{
|
||||
if (m_channel)
|
||||
return m_channel->GetStatus(status);
|
||||
if (m_request)
|
||||
return m_request->GetStatus(status);
|
||||
|
||||
*status = NS_ERROR_FAILURE;
|
||||
return *status;
|
||||
|
@ -628,12 +550,12 @@ NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
|
|||
|
||||
NS_IMETHODIMP nsMsgProtocol::Cancel(nsresult status)
|
||||
{
|
||||
NS_ASSERTION(m_channel,"no channel");
|
||||
if (!m_channel) {
|
||||
NS_ASSERTION(m_request,"no channel");
|
||||
if (!m_request) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return m_channel->Cancel(status);
|
||||
return m_request->Cancel(status);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProtocol::Suspend()
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
#include "nsITransport.h"
|
||||
class nsIPrompt;
|
||||
class nsIMsgMailNewsUrl;
|
||||
|
||||
|
@ -42,7 +42,9 @@ class nsIMsgMailNewsUrl;
|
|||
// it unifies the core networking code for the protocols. My hope is that
|
||||
// this will make unification with Necko easier as we'll only have to change
|
||||
// this class and not all of the mailnews protocols.
|
||||
class NS_MSG_BASE nsMsgProtocol : public nsIStreamListener, public nsIChannel
|
||||
class NS_MSG_BASE nsMsgProtocol
|
||||
: public nsIStreamListener,
|
||||
public nsIChannel
|
||||
{
|
||||
public:
|
||||
nsMsgProtocol(nsIURI * aURL);
|
||||
|
@ -101,8 +103,10 @@ protected:
|
|||
virtual nsresult InitFromURI(nsIURI *aUrl);
|
||||
|
||||
// Ouput stream for writing commands to the socket
|
||||
nsCOMPtr<nsIChannel> m_channel;
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
|
||||
nsCOMPtr<nsITransport> m_transport;
|
||||
nsCOMPtr<nsIRequest> m_request;
|
||||
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
|
||||
|
||||
PRBool m_socketIsOpen; // mscott: we should look into keeping this state in the nsSocketTransport...
|
||||
// I'm using it to make sure I open the socket the first time a URL is loaded into the connection
|
||||
|
|
|
@ -1169,12 +1169,12 @@ QuotingOutputStreamListener::ConvertToPlainText(PRBool formatflowed /* = PR_FALS
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIChannel * /* aChannel */, nsISupports * /* ctxt */)
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIRequest *request, nsISupports * /* ctxt */)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString aCharset;
|
||||
|
@ -1370,7 +1370,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIChannel *aChannel, n
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIChannel * /* aChannel */,
|
||||
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIRequest *request,
|
||||
nsISupports *ctxt, nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
|
|
|
@ -42,15 +42,18 @@ nsMsgComposeContentHandler::~nsMsgComposeContentHandler()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgComposeContentHandler::HandleContent(const char * aContentType, const char * aCommand,
|
||||
const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
|
||||
const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aChannel)
|
||||
if (!request)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// First of all, get the content type and make sure it is a content type we know how to handle!
|
||||
if (nsCRT::strcasecmp(aContentType, "x-application-mailto") == 0) {
|
||||
nsCOMPtr<nsIURI> aUri;
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if(!aChannel) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = aChannel->GetURI(getter_AddRefs(aUri));
|
||||
if (aUri)
|
||||
{
|
||||
|
|
|
@ -220,7 +220,7 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, PRBool quoteHeaders, nsIStream
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// now try to open the channel passing in our display consumer as the listener
|
||||
rv = mQuoteChannel->AsyncRead(convertedListener, ctxt);
|
||||
rv = mQuoteChannel->AsyncOpen(convertedListener, ctxt);
|
||||
|
||||
ReleaseMessageServiceFromURI(aMsgUri, msgService);
|
||||
return rv;
|
||||
|
|
|
@ -141,7 +141,7 @@ nsMsgSendLater::~nsMsgSendLater()
|
|||
|
||||
// Stream is done...drive on!
|
||||
nsresult
|
||||
nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
|
||||
nsMsgSendLater::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -179,6 +179,9 @@ nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult s
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if(!channel) return NS_ERROR_FAILURE;
|
||||
|
||||
// extract the prompt object to use for the alert from the url....
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIPrompt> promptObject;
|
||||
|
@ -260,7 +263,7 @@ nsMsgSendLater::BuildNewBuffer(const char* aBuf, PRUint32 aCount, PRUint32 *tota
|
|||
|
||||
// Got data?
|
||||
nsresult
|
||||
nsMsgSendLater::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
// This is a little bit tricky since we have to chop random
|
||||
// buffers into lines and deliver the lines...plus keeping the
|
||||
|
@ -316,7 +319,7 @@ nsMsgSendLater::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, nsIInput
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgSendLater::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
|
||||
nsMsgSendLater::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ const char * nsSmtpProtocol::GetUserDomainName()
|
|||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
{
|
||||
nsMsgProtocol::OnStopRequest(nsnull, ctxt, aStatus, aMsg);
|
||||
|
||||
|
@ -763,7 +763,8 @@ PRInt32 nsSmtpProtocol::SendTLSResponse()
|
|||
{
|
||||
|
||||
nsCOMPtr<nsISupports> secInfo;
|
||||
rv = m_channel->GetSecurityInfo(getter_AddRefs(secInfo));
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(m_request);
|
||||
rv = channel->GetSecurityInfo(getter_AddRefs(secInfo));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && secInfo) {
|
||||
nsCOMPtr<nsISSLSocketControl> sslControl = do_QueryInterface(secInfo, &rv);
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
|
||||
|
||||
private:
|
||||
// logon redirection related variables and methods
|
||||
|
|
|
@ -210,9 +210,11 @@ nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer)
|
|||
// almost there...now create a nntp protocol instance to run the url in...
|
||||
smtpProtocol = new nsSmtpProtocol(aUrl);
|
||||
if (smtpProtocol == nsnull)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
rv = smtpProtocol->LoadUrl(aUrl, aConsumer); // protocol will get destroyed when url is completed...
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(smtpProtocol);
|
||||
rv = smtpProtocol->LoadUrl(aUrl, aConsumer); // protocol will get destroyed when url is completed...
|
||||
NS_RELEASE(smtpProtocol);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -251,7 +253,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIREQUEST
|
||||
|
||||
|
||||
nsMailtoChannel(nsIURI * aURI);
|
||||
virtual ~nsMailtoChannel();
|
||||
|
||||
|
@ -293,13 +295,6 @@ NS_IMETHODIMP nsMailtoChannel::SetNotificationCallbacks(nsIInterfaceRequestor* a
|
|||
return NS_OK; // don't fail when trying to set this
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::GetOriginalURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = nsnull;
|
||||
|
@ -324,29 +319,17 @@ NS_IMETHODIMP nsMailtoChannel::SetURI(nsIURI* aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
NS_IMETHODIMP nsMailtoChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("OpenInputStream");
|
||||
NS_NOTREACHED("Open");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsMailtoChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
return listener->OnStartRequest(this, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -382,83 +365,6 @@ nsMailtoChannel::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
NS_NOTREACHED("GetLocalFile");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::GetOwner(nsISupports * *aPrincipal)
|
||||
{
|
||||
NS_NOTREACHED("GetOwner");
|
||||
|
@ -471,13 +377,19 @@ NS_IMETHODIMP nsMailtoChannel::SetOwner(nsISupports * aPrincipal)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute nsISupports securityInfo; */
|
||||
NS_IMETHODIMP nsMailtoChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIRequest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::GetName(PRUnichar* *result)
|
||||
/* readonly attribute wstring name; */
|
||||
NS_IMETHODIMP nsMailtoChannel::GetName(PRUnichar * *aName)
|
||||
{
|
||||
NS_NOTREACHED("nsMailtoChannel::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -511,7 +423,6 @@ NS_IMETHODIMP nsMailtoChannel::Resume()
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
// the smtp service is also the protocol handler for mailto urls....
|
||||
|
||||
NS_IMETHODIMP nsSmtpService::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **_retval)
|
||||
|
@ -869,7 +780,7 @@ nsSmtpService::findServerByHostname(nsISupports *element, void *aData)
|
|||
rv = server->GetHostname(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
nsXPIDLCString username;
|
||||
nsXPIDLCString username;
|
||||
rv = server->GetUsername(getter_Copies(username));
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ NS_IMETHODIMP
|
|||
nsURLFetcher::DoContent(const char * aContentType,
|
||||
nsURILoadCommand aCommand,
|
||||
const char * aWindowTarget,
|
||||
nsIChannel * aOpenedChannel,
|
||||
nsIRequest *request,
|
||||
nsIStreamListener ** aContentHandler,
|
||||
PRBool * aAbortProcess)
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ nsURLFetcher::StillRunning(PRBool *running)
|
|||
|
||||
// Methods for nsIStreamListener...
|
||||
nsresult
|
||||
nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
|
||||
nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
|
||||
PRUint32 sourceOffset, PRUint32 aLength)
|
||||
{
|
||||
PRUint32 readLen = aLength;
|
||||
|
@ -263,13 +263,13 @@ nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInpu
|
|||
|
||||
// Methods for nsIStreamObserver
|
||||
nsresult
|
||||
nsURLFetcher::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
|
||||
nsURLFetcher::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
#ifdef NS_DEBUG_rhp
|
||||
printf("nsURLFetcher::OnStopRequest()\n");
|
||||
|
@ -294,29 +294,30 @@ nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsre
|
|||
mOutStream = nsnull;
|
||||
}
|
||||
|
||||
|
||||
// Check the content type!
|
||||
if (aChannel)
|
||||
char *contentType = nsnull;
|
||||
char *charset = nsnull;
|
||||
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if(!aChannel) return NS_ERROR_FAILURE;
|
||||
|
||||
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
|
||||
{
|
||||
char *contentType = nsnull;
|
||||
char *charset = nsnull;
|
||||
|
||||
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
|
||||
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
|
||||
{
|
||||
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
|
||||
{
|
||||
mContentType = contentType;
|
||||
}
|
||||
mContentType = contentType;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
if (httpChannel)
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
if (httpChannel)
|
||||
{
|
||||
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
|
||||
{
|
||||
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
|
||||
{
|
||||
mCharset = charset;
|
||||
}
|
||||
mCharset = charset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now if there is a callback, we need to call it...
|
||||
if (mCallback)
|
||||
|
@ -402,10 +403,7 @@ nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
// the url....
|
||||
|
||||
if (NS_FAILED(aStatus))
|
||||
{
|
||||
nsCOMPtr<nsIChannel> channel (do_QueryInterface(aRequest));
|
||||
OnStopRequest(channel, nsnull, aStatus, nsnull);
|
||||
}
|
||||
OnStopRequest(aRequest, nsnull, aStatus, nsnull);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "nsHashtable.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsITransport.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
|
|
|
@ -478,7 +478,10 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
|
|||
|
||||
if (NS_SUCCEEDED(aImapUrl->GetMockChannel(getter_AddRefs(mockChannel))) && mockChannel)
|
||||
{
|
||||
mockChannel->GetStatus(&rv);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
|
||||
if (!request)
|
||||
return NS_ERROR_FAILURE;
|
||||
request->GetStatus(&rv);
|
||||
if (!NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsresult res;
|
||||
|
|
|
@ -1038,7 +1038,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
|
|||
if (empytingOnExit)
|
||||
{
|
||||
nsCOMPtr<nsIImapIncomingServer> imapServer;
|
||||
nsresult rv = GetImapIncomingServer(getter_AddRefs(imapServer));
|
||||
rv = GetImapIncomingServer(getter_AddRefs(imapServer));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && imapServer)
|
||||
{
|
||||
|
@ -3649,18 +3649,18 @@ nsImapMailFolder::SetContentModified(nsIImapUrl *aImapUrl, nsImapContentModified
|
|||
// to hook up the mock channel and other stuff when downloading messages for offline use.
|
||||
// But we don't really need to do anything with these notifications because we use
|
||||
// the nsIImapMesageSink interfaces ParseAdoptedMessageLine and NormalEndMsgWriteStream
|
||||
NS_IMETHODIMP nsImapMailFolder::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
|
||||
NS_IMETHODIMP nsImapMailFolder::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4212,7 +4212,9 @@ nsresult nsImapMailFolder::DisplayStatusMsg(nsIImapUrl *aImapUrl, const PRUnicha
|
|||
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
|
||||
if (progressSink)
|
||||
{
|
||||
progressSink->OnStatus(mockChannel, nsnull, NS_OK, msg); // XXX i18n message
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
|
||||
if (!request) return NS_ERROR_FAILURE;
|
||||
progressSink->OnStatus(request, nsnull, NS_OK, msg); // XXX i18n message
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -4275,9 +4277,12 @@ nsImapMailFolder::PercentProgress(nsIImapProtocol* aProtocol,
|
|||
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
|
||||
if (progressSink)
|
||||
{
|
||||
progressSink->OnProgress(mockChannel, nsnull, aInfo->currentProgress, aInfo->maxProgress);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
|
||||
if (!request) return NS_ERROR_FAILURE;
|
||||
|
||||
progressSink->OnProgress(request, nsnull, aInfo->currentProgress, aInfo->maxProgress);
|
||||
if (aInfo->message)
|
||||
progressSink->OnStatus(mockChannel, nsnull, NS_OK, aInfo->message); // XXX i18n message
|
||||
progressSink->OnStatus(request, nsnull, NS_OK, aInfo->message); // XXX i18n message
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
|
|||
rv = socketService->CreateTransportOfType(connectionType, hostName, port, nsnull, -1, 0, 0, getter_AddRefs(m_channel));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
|
||||
rv = m_channel->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream));
|
||||
}
|
||||
} // if m_runningUrl
|
||||
|
||||
|
@ -616,7 +616,12 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
|
|||
// Copy over the notification callbacks object from the mock channel
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
m_mockChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
m_channel->SetNotificationCallbacks(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.
|
||||
|
@ -1004,7 +1009,8 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
|||
|
||||
if (!TestFlag(IMAP_CONNECTION_IS_OPEN) && m_channel)
|
||||
{
|
||||
m_channel->AsyncRead(this /* stream observer */, nsnull);
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
m_channel->AsyncRead(this /* stream observer */, nsnull, 0,-1,0, getter_AddRefs(request));
|
||||
SetFlag(IMAP_CONNECTION_IS_OPEN);
|
||||
}
|
||||
#ifdef DEBUG_bienvenu
|
||||
|
@ -1036,9 +1042,10 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
|||
// if we are set up as a channel, we should notify our channel listener that we are starting...
|
||||
// so pass in ourself as the channel and not the underlying socket or file channel the protocol
|
||||
// happens to be using
|
||||
if (m_channelListener)
|
||||
m_channelListener->OnStartRequest(m_mockChannel, m_channelContext);
|
||||
|
||||
if (m_channelListener) {
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
m_channelListener->OnStartRequest(request, m_channelContext);
|
||||
}
|
||||
// mscott - I believe whenever we get here that we will also have
|
||||
// a connection. Why? Because when we load the url we open the
|
||||
// connection if it isn't open already....However, if we haven't received
|
||||
|
@ -1123,9 +1130,13 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
|||
// if we are set up as a channel, we should notify our channel listener that we are starting...
|
||||
// so pass in ourself as the channel and not the underlying socket or file channel the protocol
|
||||
// happens to be using
|
||||
if (m_channelListener)
|
||||
rv = m_channelListener->OnStopRequest(m_mockChannel, m_channelContext, NS_OK, nsnull);
|
||||
if (m_channelListener)
|
||||
{
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
if (!request) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = m_channelListener->OnStopRequest(request, m_channelContext, NS_OK, nsnull);
|
||||
}
|
||||
m_lastActiveTime = PR_Now(); // ** jt -- is this the best place for time stamp
|
||||
SetFlag(IMAP_CLEAN_UP_URL_STATE);
|
||||
if (NS_SUCCEEDED(rv) && GetConnectionStatus() >= 0 && GetServerStateParser().LastCommandSuccessful()
|
||||
|
@ -1189,7 +1200,7 @@ void nsImapProtocol::ParseIMAPandCheckForNewMail(const char* commandString, PRBo
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
|
||||
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
|
@ -1213,7 +1224,7 @@ NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISu
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
// we used to change the url state here......but OnStartRequest only gets called
|
||||
// once....when the connnection is first build from necko...So we'll set the url
|
||||
|
@ -1230,7 +1241,7 @@ NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, nsISup
|
|||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
|
||||
PRBool killThread = PR_FALSE;
|
||||
|
@ -2809,8 +2820,11 @@ nsImapProtocol::PostLineDownLoadEvent(msg_line_info *downloadLineDontDelete)
|
|||
{
|
||||
nsresult rv = m_channelOutputStream->Write(line, PL_strlen(line), &count);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_channelListener->OnDataAvailable(m_mockChannel, m_channelContext, m_channelInputStream, 0, count);
|
||||
// here is where we should echo the line to the local folder copy of an online message
|
||||
{
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
m_channelListener->OnDataAvailable(request, m_channelContext, m_channelInputStream, 0, count);
|
||||
}
|
||||
// here is where we should echo the line to the local folder copy of an online message
|
||||
}
|
||||
if (m_imapMessageSink)
|
||||
m_imapMessageSink->GetNotifyDownloadedLines(&echoLineToMessageSink);
|
||||
|
@ -3509,8 +3523,11 @@ PRBool nsImapProtocol::DeathSignalReceived()
|
|||
// ignore mock channel status if we've been pseudo interrupted
|
||||
// ### need to make sure we clear pseudo interrupted status appropriately.
|
||||
if (!GetPseudoInterrupted() && m_mockChannel)
|
||||
m_mockChannel->GetStatus(&returnValue);
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
if (request)
|
||||
request->GetStatus(&returnValue);
|
||||
}
|
||||
if (NS_SUCCEEDED(returnValue)) // check the other way of cancelling.
|
||||
{
|
||||
PR_EnterMonitor(m_threadDeathMonitor);
|
||||
|
@ -6709,23 +6726,25 @@ nsresult nsImapCacheStreamListener::Init(nsIStreamListener * aStreamListener, ns
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
|
||||
nsImapCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
|
||||
{
|
||||
nsCOMPtr <nsILoadGroup> loadGroup;
|
||||
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
nsCOMPtr<nsIRequest> ourRequest = do_QueryInterface(mChannelToUse);
|
||||
if (loadGroup)
|
||||
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
|
||||
return mListener->OnStartRequest(mChannelToUse, aCtxt);
|
||||
loadGroup->AddRequest(ourRequest, nsnull /* context isupports */);
|
||||
return mListener->OnStartRequest(ourRequest, aCtxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsImapCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
|
||||
nsCOMPtr<nsIRequest> ourRequest = do_QueryInterface(mChannelToUse);
|
||||
nsresult rv = mListener->OnStopRequest(ourRequest, aCtxt, aStatus, aMsg);
|
||||
nsCOMPtr <nsILoadGroup> loadGroup;
|
||||
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if (loadGroup)
|
||||
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
|
||||
loadGroup->RemoveRequest(ourRequest, nsnull, aStatus, nsnull);
|
||||
|
||||
mListener = nsnull;
|
||||
mChannelToUse = nsnull;
|
||||
|
@ -6733,9 +6752,10 @@ nsImapCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aC
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
|
||||
nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
|
||||
{
|
||||
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
|
||||
nsCOMPtr<nsIRequest> ourRequest = do_QueryInterface(mChannelToUse);
|
||||
return mListener->OnDataAvailable(ourRequest, aCtxt, aInStream, aSourceOffset, aCount);
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsImapMockChannel)
|
||||
|
@ -6767,12 +6787,6 @@ NS_IMETHODIMP nsImapMockChannel::Close()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::SetSecurityInfo(nsISupports * aSecurityInfo)
|
||||
{
|
||||
mSecurityInfo = aSecurityInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::GetProgressEventSink(nsIProgressEventSink ** aProgressEventSink)
|
||||
{
|
||||
*aProgressEventSink = mProgressEventSink;
|
||||
|
@ -6855,19 +6869,13 @@ NS_IMETHODIMP nsImapMockChannel::SetURI(nsIURI* aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
NS_IMETHODIMP nsImapMockChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::OpenInputStream");
|
||||
NS_NOTREACHED("nsImapMockChannel::Open");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
nsCOMPtr<nsICachedNetData> cacheEntry;
|
||||
PRUint32 contentLength = 0;
|
||||
|
@ -6943,7 +6951,7 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
|
|||
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
|
||||
NS_ADDREF(cacheListener);
|
||||
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
|
||||
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
|
||||
rv = cacheChannel->AsyncOpen(cacheListener, m_channelContext);
|
||||
NS_RELEASE(cacheListener);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
|
||||
|
@ -6960,7 +6968,6 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
|
|||
nsCOMPtr<nsISupports> securityInfo;
|
||||
cacheEntry->GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||
SetSecurityInfo(securityInfo);
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -6979,14 +6986,17 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
|
|||
if (folder && NS_SUCCEEDED(rv))
|
||||
{
|
||||
// we want to create a file channel and read the msg from there.
|
||||
nsCOMPtr<nsIFileChannel> fileChannel;
|
||||
nsCOMPtr<nsITransport> fileChannel;
|
||||
nsMsgKey msgKey = atoi(messageIdString);
|
||||
rv = folder->GetOfflineFileChannel(msgKey, getter_AddRefs(fileChannel));
|
||||
PRUint32 size, offset;
|
||||
rv = folder->GetOfflineFileTransport(msgKey, &offset, &size, getter_AddRefs(fileChannel));
|
||||
// get the file channel from the folder, somehow (through the message or
|
||||
// folder sink?) We also need to set the transfer offset to the message offset
|
||||
if (fileChannel && NS_SUCCEEDED(rv))
|
||||
{
|
||||
fileChannel->SetLoadGroup(m_loadGroup);
|
||||
// dougt - This may break the ablity to "cancel" a read from offline mail reading.
|
||||
// fileChannel->SetLoadGroup(m_loadGroup);
|
||||
|
||||
// force the url to remove its reference on the mock channel...this is to solve
|
||||
// a nasty reference counting problem...
|
||||
imapUrl->SetMockChannel(nsnull);
|
||||
|
@ -6995,7 +7005,8 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
|
|||
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
|
||||
NS_ADDREF(cacheListener);
|
||||
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
|
||||
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, 0, getter_AddRefs(request));
|
||||
NS_RELEASE(cacheListener);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
|
||||
|
@ -7031,12 +7042,6 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
//*aLoadAttributes = nsIChannel::LOAD_NORMAL;
|
||||
|
@ -7078,83 +7083,6 @@ nsImapMockChannel::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
NS_NOTREACHED("GetLocalFile");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::GetOwner(nsISupports * *aPrincipal)
|
||||
{
|
||||
*aPrincipal = mOwner;
|
||||
|
@ -7168,13 +7096,22 @@ NS_IMETHODIMP nsImapMockChannel::SetOwner(nsISupports * aPrincipal)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::SetSecurityInfo(nsISupports *aSecurityInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIRequest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsImapMockChannel::GetName(PRUnichar* *result)
|
||||
{
|
||||
NS_NOTREACHED("nsImapMockChannel::GetName");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -7234,10 +7171,3 @@ nsImapMockChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = mSecurityInfo;
|
||||
NS_IF_ADDREF(*aSecurityInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsITransport.h"
|
||||
|
||||
// imap event sinks
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
|
@ -315,7 +316,7 @@ private:
|
|||
PRUint32 m_curReadIndex; // current read index
|
||||
|
||||
// Ouput stream for writing commands to the socket
|
||||
nsCOMPtr<nsIChannel> m_channel;
|
||||
nsCOMPtr<nsITransport> m_channel;
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
|
||||
nsCOMPtr<nsIInputStream> m_inputStream;
|
||||
|
||||
|
|
|
@ -671,8 +671,8 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);
|
||||
// now try to open the channel passing in our display consumer as the listener
|
||||
rv = aChannel->AsyncRead(aStreamListener, aCtxt);
|
||||
// now try to open the channel passing in our display consumer as the listener
|
||||
rv = aChannel->AsyncOpen(aStreamListener, aCtxt);
|
||||
}
|
||||
else // do what we used to do before
|
||||
{
|
||||
|
@ -1035,7 +1035,7 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
|
|||
|
||||
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);
|
||||
// now try to open the channel passing in our display consumer as the listener
|
||||
rv = aChannel->AsyncRead(aStreamListener, aCtxt);
|
||||
rv = aChannel->AsyncOpen(aStreamListener, aCtxt);
|
||||
}
|
||||
else // do what we used to do before
|
||||
{
|
||||
|
|
|
@ -1132,7 +1132,8 @@ NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
|
|||
|
||||
if (loadGroup)
|
||||
{
|
||||
loadGroup->AddChannel(m_mockChannel, nsnull /* context isupports */);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
loadGroup->AddRequest(request, nsnull /* context isupports */);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1150,7 +1151,8 @@ NS_IMETHODIMP nsImapUrl::RemoveChannel(nsresult status)
|
|||
GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if (loadGroup)
|
||||
{
|
||||
loadGroup->RemoveChannel(m_mockChannel, nsnull, status, nsnull);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
|
||||
loadGroup->RemoveRequest(request, nsnull, status, nsnull);
|
||||
}
|
||||
// break deadly embrace between mock channel and url
|
||||
SetMockChannel(nsnull);
|
||||
|
|
|
@ -82,11 +82,13 @@ NS_IMETHODIMP nsMailboxProtocol::GetContentLength(PRInt32 * aContentLength)
|
|||
{
|
||||
// our file transport knows the entire length of the berkley mail folder
|
||||
// so get it from there.
|
||||
if (m_channel)
|
||||
return m_channel->GetContentLength(aContentLength);
|
||||
else
|
||||
if (!m_request)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIChannel> info = do_QueryInterface(m_request);
|
||||
if (info) info->GetContentLength(aContentLength);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
else if (m_runningUrl)
|
||||
{
|
||||
|
@ -144,7 +146,7 @@ void nsMailboxProtocol::Initialize(nsIURI * aURL)
|
|||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
// extract the appropriate event sinks from the url and initialize them in our protocol data
|
||||
// the URL should be queried for a nsINewsURL. If it doesn't support a news URL interface then
|
||||
|
@ -152,19 +154,19 @@ NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIChannel * aChannel, nsISuppor
|
|||
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
|
||||
{
|
||||
// we need to inform our mailbox parser that it's time to start...
|
||||
m_mailboxParser->OnStartRequest(aChannel, ctxt);
|
||||
m_mailboxParser->OnStartRequest(request, ctxt);
|
||||
}
|
||||
|
||||
return nsMsgProtocol::OnStartRequest(aChannel, ctxt);
|
||||
return nsMsgProtocol::OnStartRequest(request, ctxt);
|
||||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
{
|
||||
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
|
||||
{
|
||||
// we need to inform our mailbox parser that there is no more incoming data...
|
||||
m_mailboxParser->OnStopRequest(aChannel, ctxt, aStatus, nsnull);
|
||||
m_mailboxParser->OnStopRequest(request, ctxt, aStatus, nsnull);
|
||||
}
|
||||
else if (m_nextState == MAILBOX_READ_MESSAGE)
|
||||
{
|
||||
|
@ -196,7 +198,7 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, nsISupport
|
|||
*/
|
||||
if (aStatus == NS_BINDING_ABORTED)
|
||||
aStatus = NS_OK;
|
||||
nsMsgProtocol::OnStopRequest(aChannel, ctxt, aStatus, aMsg);
|
||||
nsMsgProtocol::OnStopRequest(request, ctxt, aStatus, aMsg);
|
||||
return CloseSocket();
|
||||
}
|
||||
|
||||
|
@ -479,8 +481,8 @@ nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream *
|
|||
case MAILBOX_DONE:
|
||||
case MAILBOX_ERROR_DONE:
|
||||
{
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningUrl);
|
||||
url->SetUrlState(PR_FALSE, m_nextState == MAILBOX_DONE ?
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> anotherUrl = do_QueryInterface(m_runningUrl);
|
||||
anotherUrl->SetUrlState(PR_FALSE, m_nextState == MAILBOX_DONE ?
|
||||
NS_OK : NS_ERROR_FAILURE);
|
||||
m_nextState = MAILBOX_FREE;
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ public:
|
|||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHOD OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt);
|
||||
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
|
||||
NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
|
||||
NS_IMETHOD GetContentLength(PRInt32 * aContentLength);
|
||||
|
||||
private:
|
||||
|
@ -127,3 +127,9 @@ private:
|
|||
};
|
||||
|
||||
#endif // nsMailboxProtocol_h___
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMsgMailboxParser, nsParseMailMessageState, nsIStre
|
|||
|
||||
// Whenever data arrives from the connection, core netlib notifices the protocol by calling
|
||||
// OnDataAvailable. We then read and process the incoming data from the input stream.
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset,
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
// right now, this really just means turn around and process the url
|
||||
|
@ -73,7 +73,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIChannel * /* aChannel */, n
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
nsTime currentTime;
|
||||
m_startTime = currentTime;
|
||||
|
@ -143,7 +143,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, ns
|
|||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
|
||||
{
|
||||
DoneParsingFolder(aStatus);
|
||||
// what can we do? we can close the stream?
|
||||
|
|
|
@ -286,7 +286,7 @@ NS_IMETHODIMP nsPop3IncomingServer::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlL
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIPop3Service, pop3Service, kCPop3ServiceCID, &rv);
|
||||
nsCOMPtr<nsIPop3Service> pop3Service = do_GetService(kCPop3ServiceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, aResult);
|
||||
|
|
|
@ -567,9 +567,9 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
|
|||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsPop3Protocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsPop3Protocol::OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = nsMsgProtocol::OnStopRequest(aChannel, aContext, aStatus, aMsg);
|
||||
nsresult rv = nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
|
||||
// turn off the server busy flag on stop request - we know we're done, right?
|
||||
if (m_pop3Server)
|
||||
{
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
|
||||
nsresult GetPassword(char ** aPassword, PRBool *okayValue);
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
|
||||
NS_IMETHOD Cancel(nsresult status);
|
||||
// for nsMsgLineBuffer
|
||||
virtual PRInt32 HandleLine(char *line, PRUint32 line_length);
|
||||
|
|
|
@ -276,6 +276,7 @@ nsresult nsPop3Service::RunPopUrl(nsIMsgIncomingServer * aServer, nsIURI * aUrlT
|
|||
nsPop3Protocol * protocol = new nsPop3Protocol(aUrlToRun);
|
||||
if (protocol)
|
||||
{
|
||||
NS_ADDREF(protocol);
|
||||
rv = protocol->Initialize(aUrlToRun);
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
|
@ -285,6 +286,7 @@ nsresult nsPop3Service::RunPopUrl(nsIMsgIncomingServer * aServer, nsIURI * aUrlT
|
|||
// the protocol stores the unescaped username, so there is no need to escape it.
|
||||
protocol->SetUsername(userName);
|
||||
rv = protocol->LoadUrl(aUrlToRun);
|
||||
NS_RELEASE(protocol);
|
||||
}
|
||||
}
|
||||
} // if server
|
||||
|
|
|
@ -268,7 +268,10 @@ NS_IMETHODIMP nsMimeBaseEmitter::OnFull(nsIOutputStream* out)
|
|||
PRUint32 bytesAvailable = 0;
|
||||
rv = mInputStream->Available(&bytesAvailable);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Available failed");
|
||||
rv = mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0, bytesAvailable);
|
||||
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
rv = mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, bytesAvailable);
|
||||
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
@ -283,7 +286,7 @@ NS_IMETHODIMP nsMimeBaseEmitter::OnClose(nsIInputStream* in)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsMimeBaseEmitter Interface
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
NS_IMETHODIMP
|
||||
nsMimeBaseEmitter::SetPipe(nsIInputStream * aInputStream, nsIOutputStream *outStream)
|
||||
{
|
||||
|
@ -862,7 +865,8 @@ nsMimeBaseEmitter::Complete()
|
|||
PRUint32 bytesInStream;
|
||||
nsresult rv2 = mInputStream->Available(&bytesInStream);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "Available failed");
|
||||
rv2 = mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0, bytesInStream);
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
rv2 = mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, bytesInStream);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "OnDataAvailable failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ protected:
|
|||
nsIOutputStream *mOutStream;
|
||||
nsIInputStream *mInputStream;
|
||||
nsIStreamListener *mOutListener;
|
||||
nsIChannel *mChannel;
|
||||
nsIChannel *mChannel;
|
||||
|
||||
// For gathering statistics on processing...
|
||||
PRUint32 mTotalWritten;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "mozITXTToHTMLConv.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsStreamConverter.h"
|
||||
|
||||
#define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph"
|
||||
#define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct"
|
||||
|
@ -610,6 +611,7 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
|
|||
GetContentType(getter_Copies(contentTypeToUse));
|
||||
// mscott --> my theory is that we don't need this fake outgoing channel. Let's use the
|
||||
// original channel and just set our content type ontop of the original channel...
|
||||
|
||||
aChannel->SetContentType(contentTypeToUse);
|
||||
|
||||
//rv = NS_NewInputStreamChannel(getter_AddRefs(mOutgoingChannel), aURI, nsnull, contentTypeToUse, -1);
|
||||
|
@ -816,7 +818,7 @@ nsStreamConverter::SetIdentity(nsIMsgIdentity * aIdentity)
|
|||
// networking library...
|
||||
//
|
||||
nsresult
|
||||
nsStreamConverter::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt,
|
||||
nsStreamConverter::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 sourceOffset,
|
||||
PRUint32 aLength)
|
||||
|
@ -887,7 +889,7 @@ char *output = "\
|
|||
// called only once, at the beginning of a URL load.
|
||||
//
|
||||
nsresult
|
||||
nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
||||
nsStreamConverter::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
{
|
||||
#ifdef DEBUG_rhp
|
||||
printf("nsStreamConverter::OnStartRequest()\n");
|
||||
|
@ -900,25 +902,21 @@ nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
|||
// here's a little bit of hackery....
|
||||
// since the mime converter is now between the channel
|
||||
// and the
|
||||
nsresult rv = NS_OK;
|
||||
if (aChannel)
|
||||
if (request)
|
||||
{
|
||||
nsXPIDLCString contentType;
|
||||
GetContentType(getter_Copies(contentType));
|
||||
aChannel->SetContentType(contentType);
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (channel)
|
||||
{
|
||||
nsXPIDLCString contentType;
|
||||
GetContentType(getter_Copies(contentType));
|
||||
|
||||
channel->SetContentType(contentType);
|
||||
}
|
||||
}
|
||||
|
||||
// forward the start request to any listeners
|
||||
// forward the start rquest to any listeners
|
||||
if (mOutListener)
|
||||
if (mOutputType == nsMimeOutput::nsMimeMessageRaw)
|
||||
{
|
||||
//we need to delay the on start request until we have figure out the real content type
|
||||
mPendingChannel = aChannel;
|
||||
mPendingContext = ctxt;
|
||||
}
|
||||
else
|
||||
mOutListener->OnStartRequest(aChannel, ctxt);
|
||||
|
||||
mOutListener->OnStartRequest(request, ctxt);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -927,7 +925,7 @@ nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
|
|||
// called once when the networking library has finished processing the
|
||||
//
|
||||
nsresult
|
||||
nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
|
||||
nsStreamConverter::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
|
||||
{
|
||||
#ifdef DEBUG_rhp
|
||||
printf("nsStreamConverter::OnStopRequest()\n");
|
||||
|
@ -1006,7 +1004,7 @@ nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsres
|
|||
|
||||
// forward on top request to any listeners
|
||||
if (mOutListener)
|
||||
mOutListener->OnStopRequest(/* mOutgoingChannel */ aChannel, ctxt, status, errorMsg);
|
||||
mOutListener->OnStopRequest(request, ctxt, status, errorMsg);
|
||||
|
||||
|
||||
mAlreadyKnowOutputType = PR_FALSE;
|
||||
|
@ -1070,7 +1068,6 @@ NS_IMETHODIMP nsStreamConverter::AsyncConvertData(const PRUnichar *aFromType, co
|
|||
|
||||
nsCOMPtr<nsIURI> aUri;
|
||||
aChannel->GetURI(getter_AddRefs(aUri));
|
||||
|
||||
return Init(aUri, aListener, aChannel);
|
||||
}
|
||||
|
||||
|
|
|
@ -694,9 +694,9 @@ public:
|
|||
nsNntpCacheStreamListener ();
|
||||
virtual ~nsNntpCacheStreamListener();
|
||||
|
||||
nsresult Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse, nsIMsgMailNewsUrl *aRunningUrl);
|
||||
nsresult Init(nsIStreamListener * aStreamListener, nsIChannel* channel, nsIMsgMailNewsUrl *aRunningUrl);
|
||||
protected:
|
||||
nsCOMPtr<nsIChannel> mChannelToUse;
|
||||
nsCOMPtr<nsIChannel> mChannelToUse;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mRunningUrl;
|
||||
};
|
||||
|
@ -718,36 +718,37 @@ nsNntpCacheStreamListener::nsNntpCacheStreamListener()
|
|||
nsNntpCacheStreamListener::~nsNntpCacheStreamListener()
|
||||
{}
|
||||
|
||||
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse,
|
||||
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel* channel,
|
||||
nsIMsgMailNewsUrl *aRunningUrl)
|
||||
{
|
||||
NS_ENSURE_ARG(aStreamListener);
|
||||
NS_ENSURE_ARG(aChannelToUse);
|
||||
NS_ENSURE_ARG(channel);
|
||||
|
||||
mChannelToUse = channel;
|
||||
|
||||
mChannelToUse = aChannelToUse;
|
||||
mListener = aStreamListener;
|
||||
mRunningUrl = aRunningUrl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
|
||||
nsNntpCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
|
||||
{
|
||||
nsCOMPtr <nsILoadGroup> loadGroup;
|
||||
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if (loadGroup)
|
||||
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
|
||||
return mListener->OnStartRequest(mChannelToUse, aCtxt);
|
||||
loadGroup->AddRequest(request, nsnull /* context isupports */);
|
||||
return mListener->OnStartRequest(request, aCtxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsNntpCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
|
||||
nsresult rv = mListener->OnStopRequest(request, aCtxt, aStatus, aMsg);
|
||||
nsCOMPtr <nsILoadGroup> loadGroup;
|
||||
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if (loadGroup)
|
||||
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
|
||||
loadGroup->RemoveRequest(request, nsnull, aStatus, nsnull);
|
||||
|
||||
// clear out mem cache entry so we're not holding onto it.
|
||||
if (mRunningUrl)
|
||||
|
@ -759,13 +760,13 @@ nsNntpCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aC
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
|
||||
nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
|
||||
{
|
||||
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
|
||||
return mListener->OnDataAvailable(request, aCtxt, aInStream, aSourceOffset, aCount);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningURL, &rv);
|
||||
|
@ -793,18 +794,22 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
|
|||
// we want to create a file channel and read the msg from there.
|
||||
nsMsgKey key = nsMsgKey_None;
|
||||
rv = m_runningURL->GetMessageKey(&key);
|
||||
nsCOMPtr<nsIFileChannel> fileChannel;
|
||||
rv = folder->GetOfflineFileChannel(key, getter_AddRefs(fileChannel));
|
||||
nsCOMPtr<nsITransport> fileChannel;
|
||||
PRUint32 offset=0, size=0;
|
||||
rv = folder->GetOfflineFileTransport(key, &offset, &size, getter_AddRefs(fileChannel));
|
||||
// get the file channel from the folder, somehow (through the message or
|
||||
// folder sink?) We also need to set the transfer offset to the message offset
|
||||
if (fileChannel && NS_SUCCEEDED(rv))
|
||||
{
|
||||
fileChannel->SetLoadGroup(m_loadGroup);
|
||||
// dougt - This may break the ablity to "cancel" a read from offline mail reading.
|
||||
// fileChannel->SetLoadGroup(m_loadGroup);
|
||||
|
||||
m_typeWanted = ARTICLE_WANTED;
|
||||
nsNntpCacheStreamListener * cacheListener = new nsNntpCacheStreamListener();
|
||||
NS_ADDREF(cacheListener);
|
||||
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);
|
||||
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, 0, getter_AddRefs(request));
|
||||
NS_RELEASE(cacheListener);
|
||||
MarkCurrentMsgRead();
|
||||
|
||||
|
@ -840,10 +845,11 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
|
|||
{
|
||||
// we're going to fill up this cache entry,
|
||||
// do we have a listener here?
|
||||
nsIStreamListener *listener = m_channelListener;
|
||||
rv = cacheEntry->InterceptAsyncRead(listener, 0, getter_AddRefs(m_channelListener));
|
||||
nsIStreamListener *anotherListener = m_channelListener;
|
||||
rv = cacheEntry->InterceptAsyncRead(anotherListener, 0, getter_AddRefs(m_channelListener));
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return nsMsgProtocol::AsyncRead(m_channelListener, ctxt);
|
||||
return nsMsgProtocol::AsyncOpen(m_channelListener, ctxt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -860,7 +866,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
|
|||
SetLoadGroup(m_loadGroup);
|
||||
m_typeWanted = ARTICLE_WANTED;
|
||||
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);
|
||||
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
|
||||
nsCOMPtr<nsIRequest> request;
|
||||
rv = cacheChannel->AsyncOpen(cacheListener, m_channelContext);
|
||||
NS_RELEASE(cacheListener);
|
||||
|
||||
MarkCurrentMsgRead();
|
||||
|
@ -875,7 +882,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
|
|||
}
|
||||
|
||||
}
|
||||
return nsMsgProtocol::AsyncRead(listener, ctxt);
|
||||
nsCOMPtr<nsIRequest> parentRequest;
|
||||
return nsMsgProtocol::AsyncOpen(listener, ctxt);
|
||||
}
|
||||
|
||||
nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
|
@ -1211,9 +1219,9 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsMsgProtocol::OnStopRequest(aChannel, aContext, aStatus, aMsg);
|
||||
nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
|
||||
|
||||
// nsMsgProtocol::OnStopRequest() has called m_channelListener. There is
|
||||
// no need to be called again in CloseSocket(). Let's clear it here.
|
||||
|
@ -5409,7 +5417,7 @@ nsresult nsNNTPProtocol::CleanupAfterRunningUrl()
|
|||
rv = m_channelListener->OnStopRequest(this, m_channelContext, NS_OK, nsnull);
|
||||
|
||||
if (m_loadGroup)
|
||||
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull, NS_OK, nsnull);
|
||||
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, NS_OK, nsnull);
|
||||
if (m_newsgroupList)
|
||||
{
|
||||
int status;
|
||||
|
|
|
@ -162,13 +162,13 @@ public:
|
|||
virtual ~nsNNTPProtocol();
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg);
|
||||
|
||||
char * m_ProxyServer; /* proxy server hostname */
|
||||
|
||||
NS_IMETHOD Cancel(nsresult status); // handle stop button
|
||||
NS_IMETHOD GetContentType(char * *aContentType);
|
||||
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt);
|
||||
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt);
|
||||
nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer);
|
||||
|
||||
private:
|
||||
|
|
|
@ -1610,9 +1610,12 @@ NS_IMETHODIMP nsNntpService::GetChromeUrlForTask(char **aChromeUrlForTask)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
|
||||
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!request) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (nsCRT::strcasecmp(aContentType, "x-application-newsgroup") == 0) {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "nsMimeTypes.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsIAggregatePrincipal.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
|
@ -60,13 +61,9 @@ PRLogModuleInfo* gJarProtocolLog = nsnull;
|
|||
|
||||
nsJARChannel::nsJARChannel()
|
||||
: mLoadAttributes(LOAD_NORMAL),
|
||||
mStartPosition(0),
|
||||
mReadCount(-1),
|
||||
mContentType(nsnull),
|
||||
mContentLength(-1),
|
||||
mJAREntry(nsnull),
|
||||
mBufferSegmentSize(NS_DEFAULT_JAR_BUFFER_SEGMENT_SIZE),
|
||||
mBufferMaxSize(NS_DEFAULT_JAR_BUFFER_MAX_SIZE),
|
||||
mStatus(NS_OK),
|
||||
mMonitor(nsnull)
|
||||
{
|
||||
|
@ -174,9 +171,9 @@ nsJARChannel::Cancel(nsresult status)
|
|||
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Cancel(status);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mJarExtractionTransport = nsnull;
|
||||
}
|
||||
|
||||
mStatus = status;
|
||||
return rv;
|
||||
}
|
||||
|
@ -184,29 +181,27 @@ nsJARChannel::Cancel(nsresult status)
|
|||
NS_IMETHODIMP
|
||||
nsJARChannel::Suspend()
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Suspend();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Resume()
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Resume();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -255,12 +250,12 @@ nsJARChannel::OpenJARElement()
|
|||
rv = Open(nsnull, nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = GetInputStream(getter_AddRefs(mSynchronousInputStream));
|
||||
mon.Notify(); // wake up OpenInputStream
|
||||
mon.Notify(); // wake up nsIChannel::Open
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OpenInputStream(nsIInputStream* *result)
|
||||
nsJARChannel::Open(nsIInputStream* *result)
|
||||
{
|
||||
nsAutoCMonitor mon(this);
|
||||
nsresult rv;
|
||||
|
@ -273,7 +268,7 @@ nsJARChannel::OpenInputStream(nsIInputStream* *result)
|
|||
{
|
||||
*result = mSynchronousInputStream; // Result of GetInputStream called on transport thread
|
||||
NS_ADDREF(*result);
|
||||
mSynchronousInputStream = null_nsCOMPtr();
|
||||
mSynchronousInputStream = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
@ -281,14 +276,7 @@ nsJARChannel::OpenInputStream(nsIInputStream* *result)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OpenOutputStream(nsIOutputStream* *result)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncRead(nsIStreamListener* listener, nsISupports* ctxt)
|
||||
nsJARChannel::AsyncOpen(nsIStreamListener* listener, nsISupports* ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
mUserContext = ctxt;
|
||||
|
@ -310,7 +298,7 @@ nsJARChannel::AsyncRead(nsIStreamListener* listener, nsISupports* ctxt)
|
|||
}
|
||||
}
|
||||
}
|
||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
||||
rv = mLoadGroup->AddRequest(this, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -342,7 +330,7 @@ nsJARChannel::EnsureJARFileAvailable()
|
|||
|
||||
rv = NS_NewDownloader(getter_AddRefs(mDownloader),
|
||||
mJARBaseURI, this, nsnull, mSynchronousRead, mLoadGroup, mCallbacks,
|
||||
mLoadAttributes, mBufferSegmentSize, mBufferMaxSize);
|
||||
mLoadAttributes);
|
||||
|
||||
// if DownloadComplete() was called early, need to release the reference.
|
||||
if (mSynchronousRead && mSynchronousInputStream)
|
||||
|
@ -350,7 +338,7 @@ nsJARChannel::EnsureJARFileAvailable()
|
|||
|
||||
error:
|
||||
if (NS_FAILED(rv) && mLoadGroup) {
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
nsresult rv2 = mLoadGroup->RemoveRequest(this, nsnull, NS_OK, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed");
|
||||
}
|
||||
return rv;
|
||||
|
@ -366,20 +354,18 @@ nsJARChannel::AsyncReadJARElement()
|
|||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = fts->CreateTransportFromStreamIO(this,
|
||||
getter_AddRefs(mJarExtractionTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetTransferOffset(mStartPosition);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetTransferCount(mReadCount);
|
||||
nsCOMPtr<nsITransport> jarTransport;
|
||||
rv = fts->CreateTransportFromStreamIO(this, getter_AddRefs(jarTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mCallbacks) {
|
||||
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
|
||||
if (sink) {
|
||||
// don't think that this is not needed anymore
|
||||
// jarTransport->SetProgressEventSink(sink);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
nsXPIDLCString jarURLStr;
|
||||
mURI->GetSpec(getter_Copies(jarURLStr));
|
||||
|
@ -387,18 +373,12 @@ nsJARChannel::AsyncReadJARElement()
|
|||
("nsJarProtocol: AsyncRead jar entry %s", (const char*)jarURLStr));
|
||||
#endif
|
||||
|
||||
rv = mJarExtractionTransport->AsyncRead(this, nsnull);
|
||||
rv = jarTransport->AsyncRead(this, nsnull, 0, -1, 0, getter_AddRefs(mJarExtractionTransport));
|
||||
mJarExtractionTransport = 0;
|
||||
jarTransport = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncWrite(nsIStreamProvider* provider,
|
||||
nsISupports* ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadAttributes(PRUint32* aLoadFlags)
|
||||
{
|
||||
|
@ -491,83 +471,6 @@ nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
*aTransferOffset = mStartPosition;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
mStartPosition = aTransferOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
*aTransferCount = mReadCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
mReadCount = aTransferCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
*aBufferSegmentSize = mBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
mBufferSegmentSize = aBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
*aBufferMaxSize = mBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
mBufferMaxSize = aBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLocalFile(nsIFile* *file)
|
||||
{
|
||||
*file = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
|
@ -667,7 +570,7 @@ nsJARChannel::OnDownloadComplete(nsIDownloader* aDownloader, nsISupports* aClosu
|
|||
else
|
||||
rv = AsyncReadJARElement();
|
||||
}
|
||||
mDownloader = null_nsCOMPtr();
|
||||
mDownloader = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -675,14 +578,14 @@ nsJARChannel::OnDownloadComplete(nsIDownloader* aDownloader, nsISupports* aClosu
|
|||
// nsIStreamObserver methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStartRequest(nsIChannel* jarExtractionTransport,
|
||||
nsJARChannel::OnStartRequest(nsIRequest* jarExtractionTransport,
|
||||
nsISupports* context)
|
||||
{
|
||||
return mUserListener->OnStartRequest(this, mUserContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* context,
|
||||
nsJARChannel::OnStopRequest(nsIRequest* jarExtractionTransport, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -698,12 +601,10 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* con
|
|||
#endif
|
||||
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "OnStopRequest failed");
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, context, aStatus, aStatusArg);
|
||||
|
||||
mUserListener = nsnull;
|
||||
mUserContext = nsnull;
|
||||
|
@ -715,7 +616,7 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* con
|
|||
// nsIStreamListener methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnDataAvailable(nsIChannel* jarCacheTransport,
|
||||
nsJARChannel::OnDataAvailable(nsIRequest* jarCacheTransport,
|
||||
nsISupports* context,
|
||||
nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset,
|
||||
|
|
|
@ -89,8 +89,6 @@ protected:
|
|||
nsLoadFlags mLoadAttributes;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
||||
PRUint32 mStartPosition;
|
||||
PRInt32 mReadCount;
|
||||
nsCOMPtr<nsISupports> mUserContext;
|
||||
nsCOMPtr<nsIStreamListener> mUserListener;
|
||||
|
||||
|
@ -100,15 +98,13 @@ protected:
|
|||
char* mJAREntry;
|
||||
nsCOMPtr<nsIZipReader> mJAR;
|
||||
nsCOMPtr<nsIFile> mDownloadedJARFile;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
nsresult mStatus;
|
||||
PRBool mSynchronousRead;
|
||||
nsCOMPtr<nsIInputStream> mSynchronousInputStream;
|
||||
|
||||
PRMonitor* mMonitor;
|
||||
nsCOMPtr<nsIDownloader> mDownloader;
|
||||
nsCOMPtr<nsIChannel> mJarExtractionTransport;
|
||||
nsCOMPtr<nsIRequest> mJarExtractionTransport;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -965,7 +965,7 @@ public:
|
|||
private:
|
||||
|
||||
nsresult SetUpCache(nsIURI* aURL);
|
||||
nsresult SetUpStreamListener(nsIChannel *channel, nsIURI* aURL);
|
||||
nsresult SetUpStreamListener(nsIRequest* request, nsIURI* aURL);
|
||||
|
||||
nsIURI *mURL;
|
||||
nsIPluginInstanceOwner *mOwner;
|
||||
|
@ -1026,13 +1026,13 @@ nsPluginCacheListener::~nsPluginCacheListener()
|
|||
NS_IMPL_ISUPPORTS(nsPluginCacheListener, kIStreamListenerIID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginCacheListener::OnStartRequest(nsIChannel* channel, nsISupports* ctxt)
|
||||
nsPluginCacheListener::OnStartRequest(nsIRequest *request, nsISupports* ctxt)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginCacheListener::OnDataAvailable(nsIChannel* channel, nsISupports* ctxt,
|
||||
nsPluginCacheListener::OnDataAvailable(nsIRequest *request, nsISupports* ctxt,
|
||||
nsIInputStream* aIStream,
|
||||
PRUint32 sourceOffset,
|
||||
PRUint32 aLength)
|
||||
|
@ -1055,7 +1055,7 @@ nsPluginCacheListener::OnDataAvailable(nsIChannel* channel, nsISupports* ctxt,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginCacheListener::OnStopRequest(nsIChannel* channel,
|
||||
nsPluginCacheListener::OnStopRequest(nsIRequest *request,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
|
@ -1223,10 +1223,15 @@ nsresult nsPluginStreamListenerPeer::InitializeFullPage(nsIPluginInstance *aInst
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamListenerPeer::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aContext)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
|
||||
if (!channel)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
char* aContentType = nsnull;
|
||||
rv = channel->GetContentType(&aContentType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1299,14 +1304,14 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIChannel* channel, nsISupports* aCo
|
|||
}
|
||||
|
||||
|
||||
rv = SetUpStreamListener(channel, aURL);
|
||||
rv = SetUpStreamListener(request, aURL);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIChannel* channel,
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIRequest *request,
|
||||
nsISupports* aContext,
|
||||
PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
|
@ -1315,7 +1320,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIChannel* channel,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIChannel* channel,
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIRequest *request,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aStatusArg)
|
||||
|
@ -1323,7 +1328,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIChannel* channel,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIChannel* channel,
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIRequest *request,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 sourceOffset,
|
||||
|
@ -1331,6 +1336,9 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIChannel* channel,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (!channel) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = channel->GetURI(getter_AddRefs(aURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -1352,7 +1360,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIChannel* channel,
|
|||
// if a plugin returns an error, the peer must kill the stream
|
||||
// else the stream and PluginStreamListener leak
|
||||
if (NS_FAILED(rv))
|
||||
channel->Cancel(rv);
|
||||
request->Cancel(rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1365,13 +1373,15 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIChannel* channel,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIChannel* channel,
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
if (!channel) return NS_ERROR_FAILURE;
|
||||
rv = channel->GetURI(getter_AddRefs(aURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -1379,7 +1389,11 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIChannel* channel,
|
|||
{
|
||||
char* urlString;
|
||||
nsCOMPtr<nsIFile> localFile;
|
||||
rv = channel->GetLocalFile(getter_AddRefs(localFile));
|
||||
nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(channel);
|
||||
|
||||
if (fileChannel)
|
||||
rv = fileChannel->GetFile(getter_AddRefs(localFile));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && localFile)
|
||||
{
|
||||
char* pathAndFilename;
|
||||
|
@ -1434,7 +1448,7 @@ nsresult nsPluginStreamListenerPeer::SetUpCache(nsIURI* aURL)
|
|||
return NS_OpenURI(cacheListener, nsnull, aURL, nsnull);
|
||||
}
|
||||
|
||||
nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIChannel* channel,
|
||||
nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
|
||||
nsIURI* aURL)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1466,6 +1480,8 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIChannel* channel,
|
|||
nsCOMPtr<nsIHTTPHeaderListener> headerListener =
|
||||
do_QueryInterface(mPStreamListener);
|
||||
if (headerListener) {
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
|
||||
if (httpChannel) {
|
||||
ReadHeadersFromChannelAndPostToListener(httpChannel, headerListener);
|
||||
|
@ -1477,6 +1493,8 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIChannel* channel,
|
|||
mPluginStreamInfo->SetSeekable(PR_FALSE);
|
||||
|
||||
// get Last-Modified header for plugin info
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
nsCOMPtr<nsIHTTPChannel> theHTTPChannel = do_QueryInterface(channel);
|
||||
if (theHTTPChannel) {
|
||||
char * lastModified;
|
||||
|
@ -3826,8 +3844,7 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
rv = channel->AsyncRead(listenerPeer, nsnull);
|
||||
rv = channel->AsyncOpen(listenerPeer, nsnull);
|
||||
}
|
||||
|
||||
NS_RELEASE(listenerPeer);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче