Back out dougt's channel changes

This commit is contained in:
disttsc%bart.nl 2001-02-12 03:14:23 +00:00
Родитель aa76b2587d
Коммит 3d2d80d536
275 изменённых файлов: 7847 добавлений и 5710 удалений

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

@ -116,25 +116,27 @@ public:
NS_DECL_ISUPPORTS
// nsIRequest
NS_IMETHOD GetName(PRUnichar* *result) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetName(PRUnichar* *result) {
NS_NOTREACHED("nsCachedChromeChannel::GetName");
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
NS_DECL_NSICHANNEL
// nsIChannel
NS_DECL_NSICHANNEL
};
#ifdef PR_LOGGING
PRLogModuleInfo* nsCachedChromeChannel::gLog;
#endif
NS_IMPL_ISUPPORTS2(nsCachedChromeChannel,
nsIChannel,
nsIRequest);
NS_IMPL_ADDREF(nsCachedChromeChannel);
NS_IMPL_RELEASE(nsCachedChromeChannel);
NS_IMPL_QUERY_INTERFACE2(nsCachedChromeChannel, nsIRequest, nsIChannel);
nsresult
nsCachedChromeChannel::Create(nsIURI* aURI, nsIChannel** aResult)
@ -209,7 +211,7 @@ nsCachedChromeChannel::SetURI(nsIURI* aURI)
}
NS_IMETHODIMP
nsCachedChromeChannel::Open(nsIInputStream **_retval)
nsCachedChromeChannel::OpenInputStream(nsIInputStream **_retval)
{
// NS_NOTREACHED("don't do that");
*_retval = nsnull;
@ -217,7 +219,15 @@ nsCachedChromeChannel::Open(nsIInputStream **_retval)
}
NS_IMETHODIMP
nsCachedChromeChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
nsCachedChromeChannel::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("don't do that");
*_retval = nsnull;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsCachedChromeChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
{
if (listener) {
nsresult rv;
@ -227,7 +237,7 @@ nsCachedChromeChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
("nsCachedChromeChannel[%p]: adding self to load group %p",
this, mLoadGroup.get()));
rv = mLoadGroup->AddRequest(this, nsnull);
rv = mLoadGroup->AddChannel(this, nsnull);
if (NS_FAILED(rv)) return rv;
}
@ -247,7 +257,7 @@ nsCachedChromeChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
("nsCachedChromeChannel[%p]: removing self from load group %p",
this, mLoadGroup.get()));
(void) mLoadGroup->RemoveRequest(this, nsnull, nsnull, nsnull);
(void) mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
}
return rv;
@ -261,9 +271,10 @@ nsCachedChromeChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
}
NS_IMETHODIMP
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
nsCachedChromeChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
{
return NS_ERROR_NOT_IMPLEMENTED;
NS_NOTREACHED("don't do that");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
@ -280,6 +291,113 @@ 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)
{
@ -323,34 +441,12 @@ nsCachedChromeChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotific
return NS_OK; // ignored
}
NS_IMETHODIMP
nsCachedChromeChannel::GetContentType(char * *aContentType)
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
*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;
*aSecurityInfo = nsnull;
return NS_OK;
}
nsresult
@ -427,14 +523,12 @@ 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(request, channel->mContext,
(void) channel->mListener->OnStopRequest(channel, channel->mContext,
channel->mStatus, nsnull);
if (channel->mLoadGroup) {
@ -442,7 +536,7 @@ nsCachedChromeChannel::HandleStopLoadEvent(PLEvent* aEvent)
("nsCachedChromeChannel[%p]: removing self from load group %p",
channel, channel->mLoadGroup.get()));
(void) channel->mLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull);
(void) channel->mLoadGroup->RemoveChannel(channel, nsnull, nsnull, nsnull);
}
channel->mListener = nsnull;

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

@ -298,7 +298,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
}
// Start reading from the channel
rv = channel->AsyncOpen(listener, nsnull);
rv = channel->AsyncRead(listener, nsnull);
if (NS_FAILED(rv)) {
if (modalEventQueue) {

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

@ -28,7 +28,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkxmldoc_s
REQUIRES = xpcom js dom locale widget caps htmlparser necko view docshell webshell uriloader pref xpconnect uconv chardet expat lwbrk exthandler mime
REQUIRES = xpcom js dom locale widget caps htmlparser necko view docshell webshell uriloader pref xpconnect uconv chardet expat lwbrk
CPPSRCS = \
nsXMLContentSink.cpp \

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

@ -1669,11 +1669,7 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
if (NS_OK == aStatus) {
{ // scope in block so nsCOMPtr released at one point
nsCOMPtr<nsIChannel> channel;
nsCOMPtr<nsIRequest> request;
aLoader->GetRequest(getter_AddRefs(request));
if (request)
channel = do_QueryInterface(request);
aLoader->GetChannel(getter_AddRefs(channel));
nsCOMPtr<nsIURI> url;
if (channel) {
channel->GetURI(getter_AddRefs(url));

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

@ -74,11 +74,6 @@
#include "nsIPrincipal.h"
#include "nsIAggregatePrincipal.h"
#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
// XXX The XML world depends on the html atoms
#include "nsHTMLAtoms.h"
@ -356,7 +351,7 @@ nsXMLDocument::Load(const nsAReadableString& aUrl)
}
// Start an asynchronous read of the XML document
rv = channel->AsyncOpen(listener, nsnull);
rv = channel->AsyncRead(listener, nsnull);
return rv;
}
@ -386,10 +381,8 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
rv = aChannel->GetURI(getter_AddRefs(aUrl));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMIMEService> MIMEService (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
rv = MIMEService->GetTypeFromURI(aUrl, &aContentType);
rv = aChannel->GetContentType(&aContentType);
if (NS_SUCCEEDED(rv)) {
if ( 0 == PL_strcmp(aContentType, "text/html")) {
bIsHTML = PR_TRUE;

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

@ -127,10 +127,6 @@
#include "nsIDOMDocumentType.h"
#include "nsIXBLService.h"
#include "nsReadableUtils.h"
#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
//----------------------------------------------------------------------
@ -317,19 +313,19 @@ NS_IMPL_ISUPPORTS1(nsProxyLoadStream, nsIInputStream);
//----------------------------------------------------------------------
//
// PlaceholderRequest
// PlaceholderChannel
//
// This is a dummy request implementation that we add to the load
// This is a dummy channel implementation that we add to the load
// group. It ensures that EndDocumentLoad() in the docshell doesn't
// fire before we've finished building the complete document content
// model.
//
class PlaceHolderRequest : public nsIChannel
class PlaceholderChannel : public nsIChannel
{
protected:
PlaceHolderRequest();
virtual ~PlaceHolderRequest();
PlaceholderChannel();
virtual ~PlaceholderChannel();
static PRInt32 gRefCnt;
static nsIURI* gURI;
@ -338,12 +334,13 @@ protected:
public:
static nsresult
Create(nsIRequest** aResult);
Create(nsIChannel** aResult);
NS_DECL_ISUPPORTS
// nsIRequest
NS_IMETHOD GetName(PRUnichar* *result) {
NS_NOTREACHED("PlaceholderChannel::GetName");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD IsPending(PRBool *_retval) { *_retval = PR_TRUE; return NS_OK; }
@ -352,50 +349,63 @@ 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 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 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; }
NS_IMETHOD OpenInputStream(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
NS_IMETHOD OpenOutputStream(nsIOutputStream **_retval) { *_retval = nsnull; return NS_OK; }
NS_IMETHOD AsyncOpen(nsIStreamObserver *observer, nsISupports *ctxt) { 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 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"); NS_NOTREACHED("NOTREACHED"); 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;}
};
PRInt32 PlaceHolderRequest::gRefCnt;
nsIURI* PlaceHolderRequest::gURI;
PRInt32 PlaceholderChannel::gRefCnt;
nsIURI* PlaceholderChannel::gURI;
NS_IMPL_ADDREF(PlaceHolderRequest);
NS_IMPL_RELEASE(PlaceHolderRequest);
NS_IMPL_QUERY_INTERFACE2(PlaceHolderRequest, nsIRequest, nsIChannel);
NS_IMPL_ADDREF(PlaceholderChannel);
NS_IMPL_RELEASE(PlaceholderChannel);
NS_IMPL_QUERY_INTERFACE2(PlaceholderChannel, nsIRequest, nsIChannel);
nsresult
PlaceHolderRequest::Create(nsIRequest** aResult)
PlaceholderChannel::Create(nsIChannel** aResult)
{
PlaceHolderRequest* request = new PlaceHolderRequest();
if (! request)
PlaceholderChannel* channel = new PlaceholderChannel();
if (! channel)
return NS_ERROR_OUT_OF_MEMORY;
*aResult = request;
*aResult = channel;
NS_ADDREF(*aResult);
return NS_OK;
}
PlaceHolderRequest::PlaceHolderRequest()
PlaceholderChannel::PlaceholderChannel()
{
NS_INIT_REFCNT();
@ -407,7 +417,7 @@ PlaceHolderRequest::PlaceHolderRequest()
}
PlaceHolderRequest::~PlaceHolderRequest()
PlaceholderChannel::~PlaceholderChannel()
{
if (--gRefCnt == 0) {
NS_IF_RELEASE(gURI);
@ -763,9 +773,8 @@ nsXULDocument::StartDocumentLoad(const char* aCommand,
// certain hacks (cough, the directory viewer) need to be able to
// StartDocumentLoad() before the channel's content type has been
// detected.
nsXPIDLCString contentType;
aChannel->GetContentType(getter_Copies(contentType));
(void) aChannel->GetContentType(getter_Copies(contentType));
if (contentType && PL_strcmp(contentType, "text/cached-xul") == 0) {
// Look in the chrome cache: we've got this puppy loaded
@ -4934,16 +4943,16 @@ nsXULDocument::PrepareToWalk()
// Add a dummy channel to the load group as a placeholder for the document
// load
rv = PlaceHolderRequest::Create(getter_AddRefs(mPlaceHolderRequest));
rv = PlaceholderChannel::Create(getter_AddRefs(mPlaceholderChannel));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
if (group) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mPlaceHolderRequest);
rv = channel->SetLoadGroup(group);
rv = mPlaceholderChannel->SetLoadGroup(group);
if (NS_FAILED(rv)) return rv;
rv = group->AddRequest(mPlaceHolderRequest, nsnull);
rv = group->AddChannel(mPlaceholderChannel, nsnull);
if (NS_FAILED(rv)) return rv;
}
}
@ -5287,10 +5296,10 @@ nsXULDocument::ResumeWalk()
// docshell, and run the onload handlers, etc.
nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
if (group) {
rv = group->RemoveRequest(mPlaceHolderRequest, nsnull, NS_OK, nsnull);
rv = group->RemoveChannel(mPlaceholderChannel, nsnull, NS_OK, nsnull);
if (NS_FAILED(rv)) return rv;
mPlaceHolderRequest = nsnull;
mPlaceholderChannel = nsnull;
}
return rv;
}
@ -5352,11 +5361,8 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
{
if (aLoader)
{
nsCOMPtr<nsIRequest> request;
nsCOMPtr<nsIChannel> channel;
aLoader->GetRequest(getter_AddRefs(request));
if (request)
channel = do_QueryInterface(request);
aLoader->GetChannel(getter_AddRefs(channel));
if (channel)
{
nsCOMPtr<nsIURI> uri;
@ -6521,14 +6527,14 @@ nsXULDocument::CachedChromeStreamListener::~CachedChromeStreamListener()
NS_IMPL_ISUPPORTS2(nsXULDocument::CachedChromeStreamListener, nsIStreamObserver, nsIStreamListener);
NS_IMETHODIMP
nsXULDocument::CachedChromeStreamListener::OnStartRequest(nsIRequest *request, nsISupports* acontext)
nsXULDocument::CachedChromeStreamListener::OnStartRequest(nsIChannel* aChannel, nsISupports* acontext)
{
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::CachedChromeStreamListener::OnStopRequest(nsIRequest *request,
nsXULDocument::CachedChromeStreamListener::OnStopRequest(nsIChannel* aChannel,
nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aErrorMsg)
@ -6543,7 +6549,7 @@ nsXULDocument::CachedChromeStreamListener::OnStopRequest(nsIRequest *request,
NS_IMETHODIMP
nsXULDocument::CachedChromeStreamListener::OnDataAvailable(nsIRequest *request,
nsXULDocument::CachedChromeStreamListener::OnDataAvailable(nsIChannel* aChannel,
nsISupports* aContext,
nsIInputStream* aInStr,
PRUint32 aSourceOffset,
@ -6573,14 +6579,14 @@ nsXULDocument::ParserObserver::~ParserObserver()
NS_IMPL_ISUPPORTS1(nsXULDocument::ParserObserver, nsIStreamObserver);
NS_IMETHODIMP
nsXULDocument::ParserObserver::OnStartRequest(nsIRequest *request,
nsXULDocument::ParserObserver::OnStartRequest(nsIChannel* aChannel,
nsISupports* aContext)
{
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::ParserObserver::OnStopRequest(nsIRequest *request,
nsXULDocument::ParserObserver::OnStopRequest(nsIChannel* aChannel,
nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aErrorMsg)
@ -6592,10 +6598,6 @@ nsXULDocument::ParserObserver::OnStopRequest(nsIRequest *request,
// walk along.
#define YELL_IF_MISSING_OVERLAY 1
#if defined(DEBUG) || defined(YELL_IF_MISSING_OVERLAY)
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
if (!aChannel) return NS_ERROR_FAILURE;
nsCOMPtr<nsIURI> uri;
aChannel->GetOriginalURI(getter_AddRefs(uri));

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

@ -119,7 +119,7 @@ public:
NS_IMETHOD GetContentType(nsAWritableString& aContentType) const;
NS_IMETHOD StartDocumentLoad(const char* aCommand,
nsIChannel *channel,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
@ -642,7 +642,7 @@ protected:
* A "dummy" channel that is used as a placeholder to signal document load
* completion.
*/
nsCOMPtr<nsIRequest> mPlaceHolderRequest;
nsCOMPtr<nsIChannel> mPlaceholderChannel;
/**
* Create a XUL template builder on the specified node if a 'datasources'

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

@ -54,9 +54,7 @@ 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()
@ -214,7 +212,7 @@ nsLDAPChannel::Cancel(nsresult aStatus)
// remove self from loadgroup to stop the throbber
//
if (mLoadGroup) {
rv = mLoadGroup->RemoveRequest(this, mResponseContext, aStatus,
rv = mLoadGroup->RemoveChannel(this, mResponseContext, aStatus,
nsnull);
if (NS_FAILED(rv))
return rv;
@ -285,6 +283,55 @@ 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
@ -516,6 +563,86 @@ 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.
@ -526,14 +653,35 @@ nsLDAPChannel::GetSecurityInfo(nsISupports* *aSecurityInfo)
// the data, the amount available is returned in the stream.
//
NS_IMETHODIMP
nsLDAPChannel::Open(nsIInputStream* *result)
nsLDAPChannel::OpenInputStream(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::AsyncOpen(nsIStreamListener* aListener,
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,
nsISupports* aCtxt)
{
nsresult rv;
@ -548,7 +696,7 @@ nsLDAPChannel::AsyncOpen(nsIStreamListener* aListener,
// add ourselves to the appropriate loadgroup
//
if (mLoadGroup) {
mLoadGroup->AddRequest(this, mResponseContext);
mLoadGroup->AddChannel(this, mResponseContext);
}
// slurp out relevant pieces of the URL
@ -664,6 +812,24 @@ nsLDAPChannel::AsyncOpen(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.
*
@ -838,7 +1004,7 @@ nsLDAPChannel::OnLDAPSearchResult(nsILDAPMessage *aMessage)
// remove self from loadgroup to stop the throbber
//
if (mLoadGroup) {
rv = mLoadGroup->RemoveRequest(this, mResponseContext, NS_OK, nsnull);
rv = mLoadGroup->RemoveChannel(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,
nsIRequest* request, nsIStreamListener** aContentHandler,
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler,
PRBool* aAbortProcess)
{
NS_ENSURE_ARG_POINTER(aContentHandler);
@ -89,8 +89,6 @@ 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);
@ -102,7 +100,7 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
}
nsresult rv = mDocShell->CreateContentViewer(aContentType,
request, aContentHandler);
aOpenedChannel, 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)

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

@ -2751,7 +2751,7 @@ NS_IMETHODIMP nsDocShell::CreateAboutBlankContentViewer()
}
NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
nsIRequest *request, nsIStreamListener** aContentHandler)
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler)
{
// Can we check the content type of the current content viewer
// and reuse it without destroying it and re-creating it?
@ -2761,17 +2761,12 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
// Instantiate the content viewer object
nsCOMPtr<nsIContentViewer> viewer;
nsresult rv = NewContentViewerObj(aContentType, request, loadGroup,
aContentHandler, getter_AddRefs(viewer));
if(NS_FAILED(rv))
if(NS_FAILED(NewContentViewerObj(aContentType, aOpenedChannel, loadGroup,
aContentHandler, getter_AddRefs(viewer))))
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...
@ -2802,9 +2797,9 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
aOpenedChannel->SetLoadAttributes(loadAttribs);
loadGroup->AddRequest(request, nsnull);
loadGroup->AddChannel(aOpenedChannel, nsnull);
if(currentLoadGroup)
currentLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull);
currentLoadGroup->RemoveChannel(aOpenedChannel, nsnull, nsnull, nsnull);
}
#ifdef SH_IN_FRAMES
@ -2818,7 +2813,7 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
}
nsresult nsDocShell::NewContentViewerObj(const char* aContentType,
nsIRequest *request, nsILoadGroup* aLoadGroup,
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer)
{
//XXX This should probably be some category thing....
@ -2845,8 +2840,6 @@ 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(

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

@ -191,9 +191,9 @@ protected:
NS_IMETHOD EnsureDeviceContext();
NS_IMETHOD CreateAboutBlankContentViewer();
NS_IMETHOD CreateContentViewer(const char* aContentType,
nsIRequest *request, nsIStreamListener** aContentHandler);
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
NS_IMETHOD NewContentViewerObj(const char* aContentType,
nsIRequest *request, nsILoadGroup* aLoadGroup,
nsIChannel* aOpenedChannel, 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 *request,
nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
PRInt32 aStateFlags, nsresult aStatus)
{
if (!request) {
if (!aRequest) {
return NS_OK;
}
@ -903,8 +903,7 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *request,
if (aProgress == webProgress.get()) {
nsCOMPtr<nsIURI> url;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
nsCOMPtr<nsIDocumentLoaderObserver> dlObserver;
(void) channel->GetURI(getter_AddRefs(url));
@ -937,21 +936,21 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *request,
* Fire the OnEndDocumentLoad of the DocLoaderobserver
*/
if(dlObserver && url) {
dlObserver->OnEndDocumentLoad(mDocLoader, request, aStatus);
dlObserver->OnEndDocumentLoad(mDocLoader, channel, aStatus);
}
}
}
}
if (aStateFlags & STATE_IS_REQUEST) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
if (aStateFlags & STATE_START) {
/*
*Fire the OnStartDocumentLoad of the webshell observer
*/
if ((nsnull != mContainer) && (nsnull != mDocLoaderObserver)) {
mDocLoaderObserver->OnStartURLLoad(mDocLoader, request);
mDocLoaderObserver->OnStartURLLoad(mDocLoader, channel);
}
}
else if (aStateFlags & STATE_STOP) {
@ -959,26 +958,27 @@ nsWebShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *request,
*Fire the OnEndDocumentLoad of the webshell observer
*/
if ((nsnull != mContainer) && (nsnull != mDocLoaderObserver)) {
mDocLoaderObserver->OnEndURLLoad(mDocLoader, request, aStatus);
mDocLoaderObserver->OnEndURLLoad(mDocLoader, channel, aStatus);
}
}
}
return nsDocShell::OnStateChange(aProgress, request, aStateFlags, aStatus);
return nsDocShell::OnStateChange(aProgress, aRequest, aStateFlags, aStatus);
}
//----------------------------------------------------------------------
nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
nsIChannel* channel,
nsIChannel *aChannel,
nsresult aStatus)
{
nsresult rv = NS_OK;
if(!channel)
if(!aChannel)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIURI> url;
rv = channel->GetURI(getter_AddRefs(url));
rv = aChannel->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, channel, aStatus);
nsDocShell::EndPageLoad(aProgress, aChannel, 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* channel,
nsIChannel *aChannel,
nsresult aStatus);
nsIEventQueue* mThreadEventQueue;
@ -156,7 +156,7 @@ protected:
nsresult FireUnloadForChildren();
nsresult CreateViewer(nsIRequest* request,
nsresult CreateViewer(nsIChannel* aChannel,
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, nsIRequest* request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIChannel *aOpenedChannel, 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, nsIRequest* request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
NS_IMETHODIMP nsEditorShell::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget, nsIChannel *aOpenedChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
{
NS_ENSURE_ARG_POINTER(aContentHandler);
NS_ENSURE_ARG_POINTER(aAbortProcess);

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

@ -35,5 +35,4 @@ 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 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)
/* 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)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -714,7 +714,7 @@ CWebBrowserContainer::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
NS_IMETHODIMP
CWebBrowserContainer::OnStartRequest(nsIRequest *request, nsISupports* aContext)
CWebBrowserContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext)
{
USES_CONVERSION;
NG_TRACE(_T("CWebBrowserContainer::OnStartRequest(...)\n"));
@ -724,7 +724,7 @@ CWebBrowserContainer::OnStartRequest(nsIRequest *request, nsISupports* aContext)
NS_IMETHODIMP
CWebBrowserContainer::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg)
CWebBrowserContainer::OnStopRequest(nsIChannel* aChannel, 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, nsIRequest *request, nsresult aStatus)
CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aChannel, nsresult aStatus)
{
NG_TRACE(_T("CWebBrowserContainer::OnEndDocumentLoad(..., \"\")\n"));
@ -776,9 +776,6 @@ CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest *r
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)
{
@ -807,7 +804,7 @@ CWebBrowserContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest *r
NS_IMETHODIMP
CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request)
CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel)
{
NG_TRACE(_T("CWebBrowserContainer::OnStartURLLoad(..., \"\")\n"));
@ -818,7 +815,7 @@ CWebBrowserContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *requ
NS_IMETHODIMP
CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
{
USES_CONVERSION;
NG_TRACE(_T("CWebBrowserContainer::OnProgress(..., \"%d\", \"%d\")\n"), (int) aProgress, (int) aProgressMax);
@ -828,7 +825,7 @@ CWebBrowserContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIRequest *r
NS_IMETHODIMP
CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsString& aMsg)
CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, nsString& aMsg)
{
NG_TRACE(_T("CWebBrowserContainer::OnStatusURLLoad(..., \"\")\n"));
@ -843,7 +840,7 @@ CWebBrowserContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIRequest *req
NS_IMETHODIMP
CWebBrowserContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus)
CWebBrowserContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
{
NG_TRACE(_T("CWebBrowserContainer::OnEndURLLoad(..., \"\")\n"));

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

@ -264,8 +264,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::OpenStream (const char *aBaseURI, const char *a
return rv;
// start our request
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
rv = mStreamListener->OnStartRequest(request, NULL);
rv = mStreamListener->OnStartRequest(mChannel, NULL);
if (NS_FAILED(rv))
return rv;
@ -282,8 +281,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::AppendToStream (const char *aData, gint32 aLen)
rv = embedStream->Append(aData, aLen);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
rv = mStreamListener->OnDataAvailable(request,
rv = mStreamListener->OnDataAvailable(mChannel,
NULL,
mStream,
mOffset, /* offset */
@ -299,8 +297,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::CloseStream (void)
nsresult rv;
NS_ENSURE_STATE(mDoingStream);
mDoingStream = PR_FALSE;
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
rv = mStreamListener->OnStopRequest(request,
rv = mStreamListener->OnStopRequest(mChannel,
NULL,
NS_OK,
NULL);
@ -534,7 +531,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetProtocolHandler(nsIURI *aURI, nsIProtocolHan
}
NS_IMETHODIMP GtkMozEmbedChrome::DoContent(const char *aContentType, nsURILoadCommand aCommand,
const char *aWindowTarget, nsIRequest *request,
const char *aWindowTarget, nsIChannel *aOpenedChannel,
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,
nsIRequest* request, nsIStreamListener** aContentHandler,
nsIChannel* aOpenedChannel, 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;
}
mOutputTransport = nsnull;
mOutputChannel = nsnull;
}
NS_IMPL_ADDREF(nsWebBrowserPersist)
@ -162,6 +162,10 @@ 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);
@ -184,7 +188,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
}
// Open a channel on the local file
nsCOMPtr<nsITransport> outputChannel;
nsCOMPtr<nsIChannel> outputChannel;
rv = fts->CreateTransport(file, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
0664, getter_AddRefs(outputChannel));
if (NS_FAILED(rv))
@ -193,12 +197,10 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
return NS_ERROR_FAILURE;
}
mOutputTransport = outputChannel;
mOutputChannel = outputChannel;
//dougt wtf?! why both a async and sync read?
// Read from the input channel
rv = inputChannel->AsyncOpen(this, nsnull);
rv = inputChannel->AsyncRead(this, nsnull);
if (NS_FAILED(rv))
{
OnEndDownload();
@ -206,7 +208,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
}
nsCOMPtr<nsIInputStream> inStream;
rv = inputChannel->Open(getter_AddRefs(inStream));
rv = inputChannel->OpenInputStream(getter_AddRefs(inStream));
if (NS_FAILED(rv))
{
OnEndDownload();
@ -217,10 +219,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
mInputStream = inStream;
// Get the output channel ready for writing
nsCOMPtr<nsIRequest> writeRequest;
rv = NS_AsyncWriteFromStream(getter_AddRefs(writeRequest),
outputChannel, inStream, 0, 0, 0,
NS_STATIC_CAST(nsIStreamObserver*, this), nsnull);
rv = NS_AsyncWriteFromStream(outputChannel, inStream, NS_STATIC_CAST(nsIStreamObserver *, this), nsnull);
if (NS_FAILED(rv))
{
OnEndDownload();
@ -395,13 +394,15 @@ NS_IMETHODIMP nsWebBrowserPersist::OnProgress(PRUint32 aStatus, nsIURI *aURI, PR
//*****************************************************************************
NS_IMETHODIMP nsWebBrowserPersist::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
NS_IMETHODIMP nsWebBrowserPersist::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
{
nsresult rv = mOutputTransport->OpenOutputStream(0, -1, 0, getter_AddRefs(mOutputStream));
nsresult rv = mOutputChannel->OpenOutputStream(getter_AddRefs(mOutputStream));
return rv;
}
NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg)
/* 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)
{
OnEndDownload();
CleanUp();
@ -414,7 +415,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(nsIRequest* request, nsISupport
//*****************************************************************************
NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIRequest* request, nsISupports *aContext, nsIInputStream *aIStream, PRUint32 aOffset, PRUint32 aLength)
NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIChannel *aChannel, nsISupports *aContext, nsIInputStream *aIStream, PRUint32 aOffset, PRUint32 aLength)
{
nsresult rv = NS_OK;
unsigned long bytesRemaining = aLength;
@ -452,9 +453,9 @@ NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(nsIRequest* request, nsISuppo
// Cancel reading?
if (cancel)
{
if (request)
if (aChannel)
{
request->Cancel(NS_BINDING_ABORTED);
aChannel->Cancel(NS_BINDING_ABORTED);
}
CleanUp();
OnEndDownload();
@ -543,6 +544,8 @@ 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)
@ -610,6 +613,8 @@ 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
@ -887,36 +892,30 @@ nsWebBrowserPersist::MakeAndStoreLocalFilenameInURIMap(const char *aURI, nsStrin
// Create a unique file name for the uri
MakeFilenameFromURI(uri, inputChannel, filename);
if (!mMIMEService)
{
mMIMEService = do_GetService(NS_MIMESERVICE_CONTRACTID);
if (!mMIMEService)
return NS_ERROR_FAILURE;
}
// Strap on the file extension using the mime lookup service
// Query the content type
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)
inputChannel->GetContentType(getter_Copies(contentType));
// Strap on the file extension using the mime lookup service
if (mMIMEService)
{
// Append the mime file extension
nsXPIDLCString fileExtension;
if (NS_SUCCEEDED(mimeInfo->FirstExtension(getter_Copies(fileExtension))))
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mMIMEService->GetFromMIMEType(contentType, getter_AddRefs(mimeInfo));
if (mimeInfo)
{
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);
// 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<nsITransport> mOutputTransport;
nsCOMPtr<nsIChannel> mOutputChannel;
nsCOMPtr<nsIOutputStream> mOutputStream;
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIURI> mURI;

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

@ -162,10 +162,8 @@ nsCookieHTTPNotify::ModifyRequest(nsISupports *aContext)
nsCOMPtr<nsIChannel> pChannel;
if (pLoadGroup) {
nsCOMPtr<nsIRequest> pRequest;
rv = pLoadGroup->GetDefaultLoadRequest(getter_AddRefs(pRequest));
if (pRequest)
pChannel = do_QueryInterface(pRequest);
rv = pLoadGroup->GetDefaultLoadChannel(getter_AddRefs(pChannel));
if (NS_FAILED(rv)) return rv;
}
nsCOMPtr<nsIURI> pFirstURL;
@ -224,10 +222,8 @@ nsCookieHTTPNotify::AsyncExamineResponse(nsISupports *aContext)
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIChannel> pChannel;
if (pLoadGroup) {
nsCOMPtr<nsIRequest> pRequest;
rv = pLoadGroup->GetDefaultLoadRequest(getter_AddRefs(pRequest));
rv = pLoadGroup->GetDefaultLoadChannel(getter_AddRefs(pChannel));
if (NS_FAILED(rv)) return rv;
pChannel = do_QueryInterface(pRequest);
}
nsCOMPtr<nsIURI> pFirstURL;
if (pChannel) {

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

@ -28,8 +28,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsXPIDLString.h"
#include "nsISocketTransportService.h"
#include "nsITransport.h"
#include "nsIProgressEventSink.h"
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
@ -43,11 +41,7 @@ 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)
@ -162,48 +156,57 @@ nsDateTimeChannel::SetURI(nsIURI* aURI)
}
NS_IMETHODIMP
nsDateTimeChannel::Open(nsIInputStream **_retval)
nsDateTimeChannel::OpenInputStream(nsIInputStream **_retval)
{
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsITransport> transport;
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(transport));
nsCOMPtr<nsIChannel> channel;
rv = socketService->CreateTransport(mHost, mPort, nsnull, -1, 32, 32, getter_AddRefs(channel));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
rv = channel->SetNotificationCallbacks(mCallbacks);
if (NS_FAILED(rv)) return rv;
return transport->OpenInputStream(0, -1, 0, _retval);
return channel->OpenInputStream(_retval);
}
NS_IMETHODIMP
nsDateTimeChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
nsDateTimeChannel::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("nsDateTimeChannel::OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDateTimeChannel::AsyncRead(nsIStreamListener *aListener,
nsISupports *ctxt)
{
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsITransport> transport;
rv = socketService->CreateTransport(mHost, mPort, nsnull, 0, 32, 32, getter_AddRefs(transport));
nsCOMPtr<nsIChannel> channel;
rv = socketService->CreateTransport(mHost, mPort, nsnull, 0, 32, 32, getter_AddRefs(channel));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
transport->SetProgressEventSink(sink);
}
rv = channel->SetNotificationCallbacks(mCallbacks);
if (NS_FAILED(rv)) return rv;
mListener = aListener;
nsCOMPtr<nsIRequest> request;
return transport->AsyncRead(this, ctxt, 0, -1, 0, getter_AddRefs(request));
return channel->AsyncRead(this, ctxt);
}
NS_IMETHODIMP
nsDateTimeChannel::AsyncWrite(nsIStreamProvider *provider,
nsISupports *ctxt)
{
NS_NOTREACHED("nsDateTimeChannel::AsyncWrite");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
@ -253,6 +256,83 @@ 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)
{
@ -265,11 +345,11 @@ NS_IMETHODIMP
nsDateTimeChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
{
if (mLoadGroup) // if we already had a load group remove ourselves...
(void)mLoadGroup->RemoveRequest(this, nsnull, NS_OK, nsnull);
(void)mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
mLoadGroup = aLoadGroup;
if (mLoadGroup) {
return mLoadGroup->AddRequest(this, nsnull);
return mLoadGroup->AddChannel(this, nsnull);
}
return NS_OK;
}
@ -304,26 +384,25 @@ nsDateTimeChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
return NS_OK;
}
NS_IMETHODIMP
nsDateTimeChannel::GetSecurityInfo(nsISupports **sec)
NS_IMETHODIMP
nsDateTimeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
NS_ENSURE_ARG_POINTER(sec);
*sec = nsnull;
*aSecurityInfo = nsnull;
return NS_OK;
}
// nsIStreamObserver methods
NS_IMETHODIMP
nsDateTimeChannel::OnStartRequest(nsIRequest *request, nsISupports *aContext) {
nsDateTimeChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
return mListener->OnStartRequest(this, aContext);
}
NS_IMETHODIMP
nsDateTimeChannel::OnStopRequest(nsIRequest *request, nsISupports* aContext,
nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
nsresult aStatus, const PRUnichar* aStatusArg) {
if (mLoadGroup) {
nsresult rv = mLoadGroup->RemoveRequest(this, nsnull, aStatus, aStatusArg);
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
if (NS_FAILED(rv)) return rv;
}
return mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
@ -332,7 +411,7 @@ nsDateTimeChannel::OnStopRequest(nsIRequest *request, nsISupports* aContext,
// nsIStreamListener method
NS_IMETHODIMP
nsDateTimeChannel::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
nsDateTimeChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
PRUint32 aLength) {
mContentLength = aLength;

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

@ -39,10 +39,7 @@
#include "nsIStreamListener.h"
class nsDateTimeChannel
: public nsIChannel,
public nsIStreamListener {
class nsDateTimeChannel : public nsIChannel, public nsIStreamListener {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUEST
@ -70,6 +67,8 @@ protected:
nsCString mContentType;
PRInt32 mContentLength;
nsCOMPtr<nsISupports> mOwner;
PRUint32 mBufferSegmentSize;
PRUint32 mBufferMaxSize;
PRInt32 mPort;
nsXPIDLCString mHost;

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

@ -32,7 +32,6 @@
#include "nsMimeTypes.h"
#include "nsIStreamConverterService.h"
#include "nsITXTToHTMLConv.h"
#include "nsIProgressEventSink.h"
#include "nsNetUtil.h"
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
@ -54,11 +53,8 @@ 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)
@ -148,8 +144,8 @@ nsFingerChannel::Cancel(nsresult status)
nsresult rv = NS_ERROR_FAILURE;
mStatus = status;
if (mTransportRequest) {
rv = mTransportRequest->Cancel(status);
if (mTransport) {
rv = mTransport->Cancel(status);
}
return rv;
}
@ -202,48 +198,60 @@ nsFingerChannel::SetURI(nsIURI* aURI)
}
NS_IMETHODIMP
nsFingerChannel::Open(nsIInputStream **_retval)
nsFingerChannel::OpenInputStream(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(mTransport));
BUFFER_MAX_SIZE, getter_AddRefs(channel));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
rv = channel->SetNotificationCallbacks(mCallbacks);
if (NS_FAILED(rv)) return rv;
return mTransport->OpenInputStream(0, -1, 0, _retval);
return channel->OpenInputStream(_retval);
}
NS_IMETHODIMP
nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
nsFingerChannel::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("nsFingerChannel::OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFingerChannel::AsyncRead(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(mTransport));
BUFFER_MAX_SIZE, getter_AddRefs(channel));
if (NS_FAILED(rv)) return rv;
if (mCallbacks) {
nsCOMPtr<nsIProgressEventSink> sink = do_GetInterface(mCallbacks);
if (sink)
mTransport->SetProgressEventSink(sink);
}
rv = channel->SetNotificationCallbacks(mCallbacks);
if (NS_FAILED(rv)) return rv;
mListener = aListener;
mResponseContext = ctxt;
mTransport = channel;
return SendRequest(mTransport);
return SendRequest(channel);
}
NS_IMETHODIMP
nsFingerChannel::AsyncWrite(nsIStreamProvider *provider,
nsISupports *ctxt)
{
NS_NOTREACHED("nsFingerChannel::AsyncWrite");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
@ -293,6 +301,83 @@ 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)
{
@ -347,7 +432,7 @@ nsFingerChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
// nsIStreamObserver methods
NS_IMETHODIMP
nsFingerChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) {
nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
if (!mActAsObserver) {
// acting as a listener
return mListener->OnStartRequest(this, mResponseContext);
@ -360,14 +445,14 @@ nsFingerChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) {
NS_IMETHODIMP
nsFingerChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext,
nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
nsresult aStatus, const PRUnichar* aStatusArg)
{
nsresult rv = NS_OK;
if (NS_FAILED(aStatus) || !mActAsObserver) {
if (mLoadGroup) {
rv = mLoadGroup->RemoveRequest(this, nsnull, aStatus, aStatusArg);
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
if (NS_FAILED(rv)) return rv;
}
rv = mListener->OnStopRequest(this, mResponseContext, aStatus, aStatusArg);
@ -402,8 +487,7 @@ nsFingerChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext,
converter->PreFormatHTML(PR_TRUE);
}
return mTransport->AsyncRead(converterListener, mResponseContext, 0,-1, 0,
getter_AddRefs(mTransportRequest));
return aChannel->AsyncRead(converterListener, mResponseContext);
}
}
@ -411,7 +495,7 @@ nsFingerChannel::OnStopRequest(nsIRequest *aRequest, nsISupports* aContext,
// nsIStreamListener method
NS_IMETHODIMP
nsFingerChannel::OnDataAvailable(nsIRequest *aRequest, nsISupports* aContext,
nsFingerChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
PRUint32 aLength) {
mContentLength = aLength;
@ -419,7 +503,7 @@ nsFingerChannel::OnDataAvailable(nsIRequest *aRequest, nsISupports* aContext,
}
nsresult
nsFingerChannel::SendRequest(nsITransport* aTransport) {
nsFingerChannel::SendRequest(nsIChannel* aChannel) {
// The text to send should already be in mUser
nsresult rv = NS_OK;
@ -428,7 +512,7 @@ nsFingerChannel::SendRequest(nsITransport* aTransport) {
nsCString requestBuffer(mUser);
if (mLoadGroup) {
mLoadGroup->AddRequest(this, nsnull);
mLoadGroup->AddChannel(this, nsnull);
}
requestBuffer.Append(CRLF);
@ -441,10 +525,9 @@ nsFingerChannel::SendRequest(nsITransport* aTransport) {
charstream = do_QueryInterface(result, &rv);
if (NS_FAILED(rv)) return rv;
rv = NS_AsyncWriteFromStream(getter_AddRefs(mTransportRequest),
aTransport, charstream,
0, requestBuffer.Length(), 0,
this, nsnull);
rv = aChannel->SetTransferCount(requestBuffer.Length());
if (NS_FAILED(rv)) return rv;
rv = NS_AsyncWriteFromStream(aChannel, charstream, this, nsnull);
return rv;
}

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

@ -33,12 +33,9 @@
#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
@ -77,12 +74,11 @@ protected:
nsXPIDLCString mRequest;
nsCOMPtr<nsISupports> mResponseContext;
nsCOMPtr<nsITransport> mTransport;
nsCOMPtr<nsIRequest> mTransportRequest;
nsCOMPtr<nsIChannel> mTransport;
nsresult mStatus;
protected:
nsresult SendRequest(nsITransport* aTransport);
nsresult SendRequest(nsIChannel* aChannel);
};
#endif /* nsFingerChannel_h___ */

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

@ -107,14 +107,13 @@ function (iid) {
}
IRCContentHandler.prototype.handleContent =
function (aContentType, aCommand, aWindowTarget, aSourceContext, aRequest)
function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
{
var e;
var channel = aRequest.QueryInterface(nsIChannel);
dump ("ircLoader.handleContent (" + aContentType + ", " +
aCommand + ", " + aWindowTarget + ", " + aSourceContext + ", " +
channel.URI.spec + ")\n");
aChannel.URI.spec + ")\n");
var windowManager =
Components.classes[MEDIATOR_CONTRACTID].getService(nsIWindowMediator);
@ -124,13 +123,13 @@ function (aContentType, aCommand, aWindowTarget, aSourceContext, aRequest)
if (w)
{
w.focus();
w.gotoIRCURL(channel.URI.spec);
w.gotoIRCURL(aChannel.URI.spec);
}
else
{
var ass = Components.classes[ASS_CONTRACTID].getService(nsIAppShellService);
w = ass.getHiddenDOMWindow();
w.open("chrome://chatzilla/content/chatzilla.xul?" + channel.URI.spec,
w.open("chrome://chatzilla/content/chatzilla.xul?" + aChannel.URI.spec,
"_blank", "chrome,menubar,toolbar,resizable");
}
@ -211,6 +210,8 @@ 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;
@ -218,9 +219,14 @@ 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.open =
BogusChannel.prototype.asyncOpen =
BogusChannel.prototype.openInputStream =
BogusChannel.prototype.openOutputStream =
BogusChannel.prototype.asyncWrite =
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, -1, 0);
this._outputStream = this._channel.openOutputStream(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, -1, 0));
toScriptableInputStream(this._channel.openInputStream (0, 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, 0, -1, 0);
this._channel.asyncRead (new StreamListener (server), this);
}
}
@ -179,20 +179,20 @@ function StreamListener(server)
}
StreamListener.prototype.onStartRequest =
function (request, ctxt)
function (channel, ctxt)
{
dd ("onStartRequest: " + request + ", " + ctxt);
dd ("onStartRequest: " + channel + ", " + ctxt);
}
StreamListener.prototype.onStopRequest =
function (request, ctxt, status, errorMsg)
function (channel, ctxt, status, errorMsg)
{
dd ("onStopRequest: " + request + ", " + ctxt + ", " + status + ", " +
dd ("onStopRequest: " + channel + ", " + ctxt + ", " + status + ", " +
errorMsg);
}
StreamListener.prototype.onDataAvailable =
function (request, ctxt, inStr, sourceOffset, count)
function (channel, 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, 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 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 OnConnectionsComplete();
@ -696,7 +696,7 @@ nsPICS::OnStartDocumentLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
nsPICS::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
nsresult aStatus)
{
nsresult rv = NS_OK;
@ -719,13 +719,9 @@ nsPICS::OnEndDocumentLoad(nsIDocumentLoader* loader,
}
NS_IMETHODIMP
nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request)
nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel)
{
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));
@ -802,7 +798,7 @@ nsPICS::OnStartURLLoad(nsIDocumentLoader* loader, nsIRequest *request)
NS_IMETHODIMP
nsPICS::OnProgressURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax)
{
@ -813,7 +809,7 @@ nsPICS::OnProgressURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
nsPICS::OnStatusURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
nsString& aMsg)
{
if(!mPICSRatingsEnabled)
@ -823,13 +819,11 @@ nsPICS::OnStatusURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
nsPICS::OnEndURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
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,5 +9,3 @@ 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,15 +719,12 @@ NS_IMPL_ISUPPORTS(CertDownloader,NS_GET_IID(nsIStreamListener));
const PRInt32 kDefaultCertAllocLength = 2048;
NS_IMETHODIMP
CertDownloader::OnStartRequest(nsIRequest *request, nsISupports* context)
CertDownloader::OnStartRequest(nsIChannel* channel, nsISupports* context)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (channel)
rv = channel->GetContentLength(&mContentLength);
if (!channel || rv != NS_OK || mContentLength == -1)
nsresult rv;
rv = channel->GetContentLength(&mContentLength);
if (rv != NS_OK || mContentLength == -1)
mContentLength = kDefaultCertAllocLength;
mBufferOffset = 0;
@ -740,7 +737,7 @@ CertDownloader::OnStartRequest(nsIRequest *request, nsISupports* context)
NS_IMETHODIMP
CertDownloader::OnDataAvailable(nsIRequest *request,
CertDownloader::OnDataAvailable(nsIChannel* channel,
nsISupports* context,
nsIInputStream *aIStream,
PRUint32 aSourceOffset,
@ -779,7 +776,7 @@ CertDownloader::OnDataAvailable(nsIRequest *request,
NS_IMETHODIMP
CertDownloader::OnStopRequest(nsIRequest *request,
CertDownloader::OnStopRequest(nsIChannel* channel,
nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
@ -860,23 +857,20 @@ nsPSMComponent::HandleContent(const char * aContentType,
const char * aCommand,
const char * aWindowTarget,
nsISupports* aWindowContext,
nsIRequest *request)
nsIChannel * aChannel)
{
// We were called via CI. We better protect ourselves and addref.
NS_ADDREF_THIS();
nsresult rv = NS_OK;
if (!request) return NS_ERROR_NULL_POINTER;
if (!aChannel) return NS_ERROR_NULL_POINTER;
CMUint32 type = getPSMCertType(aContentType);
if (type != -1)
{
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
if (!aChannel)
return NS_ERROR_FAILURE;
// I can't directly open the passed channel cause it fails :-(
nsCOMPtr<nsIURI> uri;
rv = aChannel->GetURI(getter_AddRefs(uri));
if (NS_FAILED(rv)) return rv;
@ -885,11 +879,10 @@ nsPSMComponent::HandleContent(const char * aContentType,
rv = NS_OpenURI(getter_AddRefs(channel), uri);
if (NS_FAILED(rv)) return rv;
return channel->AsyncOpen(new CertDownloader(type), NS_STATIC_CAST(nsIPSMComponent*,this));
return channel->AsyncRead(new CertDownloader(type), NS_STATIC_CAST(nsIPSMComponent*,this));
}
return NS_ERROR_FAILURE;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMPL_ISUPPORTS(CertContentListener, NS_GET_IID(nsIURIContentListener));
@ -964,7 +957,7 @@ NS_IMETHODIMP
CertContentListener::DoContent(const char * aContentType,
nsURILoadCommand aCommand,
const char * aWindowTarget,
nsIRequest * request,
nsIChannel * aOpenedChannel,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{

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

@ -298,7 +298,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
}
// Start reading from the channel
rv = channel->AsyncOpen(listener, nsnull);
rv = channel->AsyncRead(listener, nsnull);
if (NS_FAILED(rv)) {
if (modalEventQueue) {

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

@ -253,7 +253,7 @@ nsWalletlibService::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL
#include "prmem.h"
NS_IMETHODIMP
nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIRequest *request, nsresult aStatus)
nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* channel, nsresult aStatus)
{
nsresult rv = NS_OK;
@ -373,7 +373,6 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIRequest *re
nsCOMPtr<nsIInterfaceRequestor> interfaces;
nsCOMPtr<nsIPrompt> prompter;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (channel)
channel->GetNotificationCallbacks(getter_AddRefs(interfaces));
if (interfaces)
@ -408,21 +407,21 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIRequest *re
NS_IMETHODIMP
nsWalletlibService::OnStartURLLoad
(nsIDocumentLoader* loader, nsIRequest *request)
(nsIDocumentLoader* loader, nsIChannel* channel)
{
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::OnProgressURLLoad
(nsIDocumentLoader* loader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax)
{
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::OnStatusURLLoad
(nsIDocumentLoader* loader, nsIRequest *request, nsString& aMsg)
(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg)
{
return NS_OK;
}
@ -430,7 +429,7 @@ nsWalletlibService::OnStatusURLLoad
NS_IMETHODIMP
nsWalletlibService::OnEndURLLoad
(nsIDocumentLoader* loader, nsIRequest *request, nsresult aStatus)
(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
{
return NS_OK;
}

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

@ -18,9 +18,9 @@
/*
* nsXmlRpcClient XPCOM component
* Version: $Revision: 1.13 $
* Version: $Revision: 1.14 $
*
* $Id: nsXmlRpcClient.js,v 1.13 2001/02/10 00:14:31 dougt%netscape.com Exp $
* $Id: nsXmlRpcClient.js,v 1.14 2001/02/12 03:12:39 disttsc%bart.nl Exp $
*/
/*
@ -125,7 +125,7 @@ nsXmlRpcClient.prototype = {
debug('Do the deed.');
var input = channel.open(0, 0, 0);
var input = channel.openInputStream();
input = toScriptableStream(input);
var now = new Date()
@ -220,7 +220,7 @@ nsXmlRpcClient.prototype = {
var chann = this._getChannel(requestBody);
// And...... call!
chann.asyncOpen(this, context);
chann.asyncRead(this, context);
},
// Return a HTTP channel ready for POSTing.

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

@ -82,9 +82,7 @@ nsDOMParserChannel::~nsDOMParserChannel()
{
}
NS_IMPL_ISUPPORTS2(nsDOMParserChannel,
nsIChannel,
nsIRequest)
NS_IMPL_ISUPPORTS2(nsDOMParserChannel, nsIRequest, nsIChannel)
/* boolean isPending (); */
NS_IMETHODIMP nsDOMParserChannel::GetName(PRUnichar* *result)
@ -161,6 +159,38 @@ 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)
{
@ -202,16 +232,6 @@ 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)
{
@ -242,12 +262,62 @@ NS_IMETHODIMP nsDOMParserChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMParserChannel::Open(nsIInputStream **_retval)
/* attribute unsigned long bufferSegmentSize; */
NS_IMETHODIMP nsDOMParserChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMParserChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMParserChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
/* 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)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -439,7 +509,6 @@ 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;
@ -456,15 +525,15 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
// Now start pumping data to the listener
nsresult status;
rv = listener->OnStartRequest(request, nsnull);
request->GetStatus(&status);
rv = listener->OnStartRequest(channel, nsnull);
channel->GetStatus(&status);
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(status)) {
rv = listener->OnDataAvailable(request, nsnull, stream, 0, contentLength);
request->GetStatus(&status);
rv = listener->OnDataAvailable(channel, nsnull, stream, 0, contentLength);
channel->GetStatus(&status);
}
rv = listener->OnStopRequest(request, nsnull, status, nsnull);
rv = listener->OnStopRequest(channel, 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 (mReadRequest) {
return mReadRequest->Cancel(NS_BINDING_ABORTED);
if (mChannel) {
return mChannel->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->AsyncOpen(listener, nsnull);
rv = mChannel->AsyncRead(listener, nsnull);
#ifdef IMPLEMENT_SYNC_LOAD
if (NS_FAILED(rv)) {

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

@ -89,7 +89,6 @@ 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->Open( getter_AddRefs( pInputStream ) );
rv = pChannel->OpenInputStream( 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, nsIRequest* request,
mozXMLTerminal::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel,
nsresult aStatus)
{
@ -1068,7 +1068,7 @@ mozXMLTerminal::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIRequest* request
NS_IMETHODIMP
mozXMLTerminal::OnStartURLLoad(nsIDocumentLoader* loader,
nsIRequest* request)
nsIChannel* channel)
{
return NS_OK;
@ -1076,7 +1076,7 @@ mozXMLTerminal::OnStartURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
mozXMLTerminal::OnProgressURLLoad(nsIDocumentLoader* loader,
nsIRequest* request, PRUint32 aProgress,
nsIChannel* channel, PRUint32 aProgress,
PRUint32 aProgressMax)
{
return NS_OK;
@ -1084,14 +1084,14 @@ mozXMLTerminal::OnProgressURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
mozXMLTerminal::OnStatusURLLoad(nsIDocumentLoader* loader,
nsIRequest* request, nsString& aMsg)
nsIChannel* channel, nsString& aMsg)
{
return NS_OK;
}
NS_IMETHODIMP
mozXMLTerminal::OnEndURLLoad(nsIDocumentLoader* loader,
nsIRequest* request, nsresult aStatus)
nsIChannel* channel, nsresult aStatus)
{
XMLT_LOG(mozXMLTerminal::OnEndURLLoad,20,("\n"));

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

@ -114,12 +114,10 @@ function (iid) {
}
TelnetContentHandler.prototype.handleContent =
function (aContentType, aCommand, aWindowTarget, aSourceContext, aRequest)
function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
{
var e;
var aChannel = aRequest.QueryInterface(Components.interfaces.nsIChannel);
dump ("telnetLoader.handleContent (" + aContentType + ", " +
aCommand + ", " + aWindowTarget + ", " + aSourceContext + ", " +
aChannel.URI.spec + ")\n");
@ -220,11 +218,8 @@ function (aURI)
//dump("gSystemPrincipal="+gSystemPrincipal+"\n");
// Cancel XUL request and release channel
// why are you canceling here?! you have not even opened anything yet - dougt.
// temChannel.cancel(Components.results.NS_BINDING_ABORTED);
temChannel = null;
temChannel.cancel(Components.results.NS_BINDING_ABORTED);
temChannel = null;
// Get current process directory
var dscontractid = "@mozilla.org/file/directory_service;1";
@ -284,6 +279,8 @@ 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;
@ -291,10 +288,14 @@ 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.open =
BogusChannel.prototype.asyncOpen =
BogusChannel.prototype.openInputStream =
BogusChannel.prototype.openOutputStream =
BogusChannel.prototype.asyncWrite =
function ()
{
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
@ -306,6 +307,12 @@ function (observer, ctxt)
observer.onStartRequest (this, ctxt);
}
BogusChannel.prototype.asyncRead =
function (listener, ctxt)
{
return listener.onStartRequest (this, ctxt);
}
/* nsIRequest */
BogusChannel.prototype.isPending =
function ()
@ -321,7 +328,6 @@ 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, nsIRequest* request,
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg);
nsresult RequestDone(ImageConsumer *aConsumer, nsIChannel* channel,
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(nsIRequest* request, nsISupports* context) {
NS_ADDREF(request);
NS_IF_RELEASE(mRequest);
mRequest = request;
void SetKeepPumpingData(nsIChannel* channel, nsISupports* context) {
NS_ADDREF(channel);
NS_IF_RELEASE(mChannel);
mChannel = channel;
NS_IF_ADDREF(context);
NS_IF_RELEASE(mUserContext);
@ -145,7 +145,7 @@ protected:
PRBool mFirstRead;
char *mBuffer;
PRInt32 mStatus;
nsIRequest* mRequest;
nsIChannel* mChannel;
nsISupports* mUserContext;
PRBool mIsMulti;
};
@ -162,7 +162,7 @@ ImageConsumer::ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext)
mStream = nsnull;
mBuffer = nsnull;
mStatus = 0;
mRequest = nsnull;
mChannel = nsnull;
mUserContext = nsnull;
mIsMulti = PR_FALSE;
}
@ -262,7 +262,7 @@ NS_IMETHODIMP
ImageConsumer::DoContent(const char * aContentType,
nsURILoadCommand aCommand,
const char * aWindowTarget,
nsIRequest * aOpenedChannel,
nsIChannel * aOpenedChannel,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{
@ -294,10 +294,8 @@ ImageConsumer::DoContent(const char * aContentType,
NS_IMETHODIMP
ImageConsumer::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
ImageConsumer::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
PRUint32 httpStatus;
if (mInterrupted) {
mStatus = MK_INTERRUPTED;
@ -320,7 +318,7 @@ ImageConsumer::OnStartRequest(nsIRequest* aRequest, 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;
@ -355,15 +353,13 @@ ImageConsumer::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
NS_IMETHODIMP
ImageConsumer::OnDataAvailable(nsIRequest* request, nsISupports* aContext,
nsIInputStream *pIStream, PRUint32 offset, PRUint32 length)
ImageConsumer::OnDataAvailable(nsIChannel* channel, 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);
@ -486,12 +482,12 @@ ImageConsumer::KeepPumpingStream(nsITimer *aTimer, void *aClosure)
ImageConsumer *consumer = (ImageConsumer *)aClosure;
nsAutoString status;
consumer->OnStopRequest(consumer->mRequest, consumer->mUserContext,
consumer->OnStopRequest(consumer->mChannel, consumer->mUserContext,
NS_BINDING_SUCCEEDED, status.GetUnicode());
}
NS_IMETHODIMP
ImageConsumer::OnStopRequest(nsIRequest* request, nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
{
if (mTimer) {
mTimer->Cancel();
@ -510,12 +506,12 @@ ImageConsumer::OnStopRequest(nsIRequest* request, 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(request, aContext, mStream, 0, str_length); // XXX fix offset
err = OnDataAvailable(channel, 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(request, aContext);
SetKeepPumpingData(channel, aContext);
nsresult rv;
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
@ -554,7 +550,7 @@ ImageConsumer::OnStopRequest(nsIRequest* request, nsISupports* aContext, nsresul
reader->NetRequestDone(mURL, mStatus);
NS_RELEASE(reader);
return mContext->RequestDone(this, request, aContext, status, aMsg);
return mContext->RequestDone(this, channel, aContext, status, aMsg);
}
void
@ -587,7 +583,7 @@ ImageConsumer::~ImageConsumer()
if (mBuffer != nsnull) {
PR_DELETE(mBuffer);
}
NS_IF_RELEASE(mRequest);
NS_IF_RELEASE(mChannel);
NS_IF_RELEASE(mUserContext);
}
@ -726,10 +722,8 @@ ImageNetContextImpl::GetContentLength (ilIURL * aURL)
rv = NS_OpenURI(getter_AddRefs(channel), nsurl, nsnull, group, sink);
if (NS_FAILED(rv)) return 0;
// Why would this code ever return anything but zero. we don't do asyncread
// on the channel we create?
// Commenting this line for now TODO -gagan
//rv = channel->GetContentLength(&content_length);
rv = channel->GetContentLength(&content_length);
return content_length;
}
@ -791,16 +785,14 @@ ImageNetContextImpl::GetURL (ilIURL * aURL,
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
if (httpChannel)
{
// Get the defloadRequest from the loadgroup-
nsCOMPtr<nsIRequest> defLoadRequest;
if (NS_SUCCEEDED(group->GetDefaultLoadRequest(
getter_AddRefs(defLoadRequest))) && defLoadRequest)
// Get the defloadchannel from the loadgroup-
nsCOMPtr<nsIChannel> defLoadChannel;
if (NS_SUCCEEDED(group->GetDefaultLoadChannel(
getter_AddRefs(defLoadChannel))) && defLoadChannel)
{
nsCOMPtr<nsIChannel> reqchannel = do_QueryInterface(defLoadRequest);
// Get the referrer from the loadchannel-
nsCOMPtr<nsIURI> referrer;
if (NS_SUCCEEDED(reqchannel->GetURI(getter_AddRefs(referrer))))
if (NS_SUCCEEDED(defLoadChannel->GetURI(getter_AddRefs(referrer))))
{
// Set the referrer-
httpChannel->SetReferrer(referrer,
@ -834,7 +826,7 @@ ImageNetContextImpl::GetURL (ilIURL * aURL,
rv = pURILoader->OpenURI(channel, loadCmd, nsnull /* window target */,
window);
}
// rv = channel->AsyncOpen(ic, nsnull);
// rv = channel->AsyncRead(ic, nsnull);
if (NS_FAILED(rv)) goto error;
}
@ -859,8 +851,8 @@ ImageNetContextImpl::RemoveRequest(ImageConsumer *aConsumer)
}
nsresult
ImageNetContextImpl::RequestDone(ImageConsumer *aConsumer, nsIRequest* request,
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg)
ImageNetContextImpl::RequestDone(ImageConsumer *aConsumer, nsIChannel* channel,
nsISupports* ctxt, nsresult status, const PRUnichar* aMsg)
{
RemoveRequest(aConsumer);
/// if (mLoadGroup)
@ -887,18 +879,14 @@ 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<nsIRequest> defLoadRequest;
nsCOMPtr<nsIChannel> channel;
if (NS_SUCCEEDED(group->GetDefaultLoadRequest(
getter_AddRefs(defLoadRequest))) && defLoadRequest)
{
channel = do_QueryInterface(defLoadRequest);
if (channel) channel->GetLoadAttributes(&defchan_attribs);
}
nsCOMPtr<nsIChannel> defLoadChannel;
if (NS_SUCCEEDED(group->GetDefaultLoadChannel(
getter_AddRefs(defLoadChannel))) && defLoadChannel)
defLoadChannel->GetLoadAttributes(&defchan_attribs);
#if defined( DEBUG )
if (image_net_context_async_log_module == NULL) {

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

@ -218,9 +218,6 @@ ImageNetContextSyncImpl::GetURL(ilIURL* aURL,
if(aContentType){
nsCRT::free(aContentType);
}
}
if (!aContentType) {
aContentType = nsCRT::strdup("unknown");
}
if(nsCRT::strlen(aContentType) > 50){
@ -229,8 +226,8 @@ ImageNetContextSyncImpl::GetURL(ilIURL* aURL,
nsCRT::free(aContentType);
aContentType = nsCRT::strdup("unknown");
}
rv = channel->Open( &stream);
rv = channel->OpenInputStream(&stream);
NS_RELEASE(channel);
if (NS_SUCCEEDED(rv)) {

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

@ -152,7 +152,7 @@ CStreamListener::OnStartDocumentLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
CStreamListener::OnEndDocumentLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
nsresult aStatus)
{
fputs("done.\n",stdout);
@ -162,14 +162,14 @@ CStreamListener::OnEndDocumentLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
CStreamListener::OnStartURLLoad(nsIDocumentLoader* loader,
nsIRequest *request)
nsIChannel* channel)
{
return NS_OK;
}
NS_IMETHODIMP
CStreamListener::OnProgressURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
PRUint32 aProgress,
PRUint32 aProgressMax)
{
@ -178,7 +178,7 @@ CStreamListener::OnProgressURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
CStreamListener::OnStatusURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
nsString& aMsg)
{
return NS_OK;
@ -186,7 +186,7 @@ CStreamListener::OnStatusURLLoad(nsIDocumentLoader* loader,
NS_IMETHODIMP
CStreamListener::OnEndURLLoad(nsIDocumentLoader* loader,
nsIRequest *request,
nsIChannel* channel,
nsresult aStatus)
{
return NS_OK;

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

@ -61,7 +61,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
mContextType=eCTNone;
mCopyUnused=aCopyUnused;
mParserCommand=aCommand;
mRequest=0;
mChannel=0;
mValidator=0;
}
@ -92,7 +92,7 @@ CParserContext::CParserContext(const CParserContext &aContext) : mMimeType() {
mStreamListenerState=aContext.mStreamListenerState;
mMultipart=aContext.mMultipart;
mContextType=aContext.mContextType;
mRequest=aContext.mRequest;
mChannel=aContext.mChannel;
mParserCommand=aContext.mParserCommand;
SetMimeType(aContext.mMimeType);
}

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

@ -72,7 +72,7 @@ public:
eContextType mContextType;
eAutoDetectResult mAutoDetectStatus;
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
nsIRequest* mRequest; // provided by necko to differnciate different input streams
nsIChannel* mChannel; // 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(nsIRequest *request, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
{
nsresult result=0;
if (nsnull != mProgressEventSink) {
mProgressEventSink->OnProgress(request, aContext, aProgress, aProgressMax);
mProgressEventSink->OnProgress(channel, aContext, aProgress, aProgressMax);
}
return result;
}
@ -2079,12 +2079,12 @@ nsParser::OnProgress(nsIRequest *request, nsISupports* aContext, PRUint32 aProgr
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult
nsParser::OnStatus(nsIRequest *request, nsISupports* aContext,
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
nsresult aStatus, const PRUnichar* aStatusArg)
{
nsresult rv;
if (nsnull != mProgressEventSink) {
rv = mProgressEventSink->OnStatus(request, aContext, aStatus, aStatusArg);
rv = mProgressEventSink->OnStatus(channel, aContext, aStatus, aStatusArg);
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
}
return NS_OK;
@ -2102,22 +2102,19 @@ nsParser::OnStatus(nsIRequest *request, nsISupports* aContext,
* @param
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext) {
NS_PRECONDITION((eNone==mParserContext->mStreamListenerState),kBadListenerInit);
if (nsnull != mObserver) {
mObserver->OnStartRequest(request, aContext);
mObserver->OnStartRequest(channel, aContext);
}
mParserContext->mStreamListenerState=eOnStart;
mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mRequest=request;
mParserContext->mChannel=channel;
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))
{
@ -2313,7 +2310,7 @@ ParserWriteFunc(nsIInputStream* in,
* @return error code (usually 0)
*/
nsresult nsParser::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
nsIInputStream *pIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
@ -2325,12 +2322,12 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
CParserContext *theContext=mParserContext;
while(theContext) {
if(theContext->mRequest!=request && theContext->mPrevContext)
if(theContext->mChannel!=channel && theContext->mPrevContext)
theContext=theContext->mPrevContext;
else break;
}
if(theContext && theContext->mRequest==request) {
if(theContext && theContext->mChannel==channel) {
theContext->mStreamListenerState=eOnDataAvail;
@ -2369,7 +2366,7 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
* @param
* @return
*/
nsresult nsParser::OnStopRequest(nsIRequest *request, nsISupports* aContext,
nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult status, const PRUnichar* aMsg)
{
@ -2401,7 +2398,7 @@ nsresult nsParser::OnStopRequest(nsIRequest *request, nsISupports* aContext,
// XXX Should we wait to notify our observers as well if the
// parser isn't yet enabled?
if (nsnull != mObserver) {
mObserver->OnStopRequest(request, aContext, status, aMsg);
mObserver->OnStopRequest(channel, aContext, status, aMsg);
}
#ifdef rickgdebug

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

@ -237,7 +237,7 @@ PageGrabber::Grab(const nsString& aURL)
if(copier) {
NS_ADDREF(copier);
rv = channel->AsyncOpen(copier, nsnull);
rv = channel->AsyncRead(copier, nsnull);
if (NS_OK != rv) {
NS_RELEASE(copier);

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

@ -238,10 +238,8 @@ nsStringBundle::OnStreamComplete(nsIStreamLoader* aLoader,
nsXPIDLCString uriSpec;
if (NS_FAILED(aStatus)) {
if (aLoader) {
nsCOMPtr<nsIRequest> request;
aLoader->GetRequest(getter_AddRefs(request));
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
nsCOMPtr<nsIChannel> channel;
aLoader->GetChannel(getter_AddRefs(channel));
if (channel) {
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));

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

@ -634,12 +634,13 @@ protected:
public:
static nsresult
Create(nsIRequest** aResult, nsIPresShell* aPresShell);
Create(nsIChannel** 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; }
@ -648,27 +649,39 @@ 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 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 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 SetLoadAttributes(nsLoadFlags aLoadAttributes) { 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; }
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;}
};
PRInt32 DummyLayoutRequest::gRefCnt;
@ -679,7 +692,7 @@ NS_IMPL_RELEASE(DummyLayoutRequest);
NS_IMPL_QUERY_INTERFACE2(DummyLayoutRequest, nsIRequest, nsIChannel);
nsresult
DummyLayoutRequest::Create(nsIRequest** aResult, nsIPresShell* aPresShell)
DummyLayoutRequest::Create(nsIChannel** aResult, nsIPresShell* aPresShell)
{
DummyLayoutRequest* request = new DummyLayoutRequest(aPresShell);
if (!request)
@ -1052,7 +1065,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<nsIRequest> mDummyLayoutRequest;
nsCOMPtr<nsIChannel> mDummyLayoutRequest;
// used for list of posted events and attribute changes. To be done
// after reflow.
@ -5330,10 +5343,10 @@ PresShell::AddDummyLayoutRequest(void)
}
if (loadGroup) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mDummyLayoutRequest);
rv = channel->SetLoadGroup(loadGroup);
rv = mDummyLayoutRequest->SetLoadGroup(loadGroup);
if (NS_FAILED(rv)) return rv;
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
rv = loadGroup->AddChannel(mDummyLayoutRequest, nsnull);
if (NS_FAILED(rv)) return rv;
}
@ -5357,7 +5370,7 @@ PresShell::RemoveDummyLayoutRequest(void)
}
if (loadGroup && mDummyLayoutRequest) {
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
rv = loadGroup->RemoveChannel(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
if (NS_FAILED(rv)) return rv;
mDummyLayoutRequest = nsnull;

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

@ -634,12 +634,13 @@ protected:
public:
static nsresult
Create(nsIRequest** aResult, nsIPresShell* aPresShell);
Create(nsIChannel** 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; }
@ -648,27 +649,39 @@ 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 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 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 SetLoadAttributes(nsLoadFlags aLoadAttributes) { 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; }
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;}
};
PRInt32 DummyLayoutRequest::gRefCnt;
@ -679,7 +692,7 @@ NS_IMPL_RELEASE(DummyLayoutRequest);
NS_IMPL_QUERY_INTERFACE2(DummyLayoutRequest, nsIRequest, nsIChannel);
nsresult
DummyLayoutRequest::Create(nsIRequest** aResult, nsIPresShell* aPresShell)
DummyLayoutRequest::Create(nsIChannel** aResult, nsIPresShell* aPresShell)
{
DummyLayoutRequest* request = new DummyLayoutRequest(aPresShell);
if (!request)
@ -1052,7 +1065,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<nsIRequest> mDummyLayoutRequest;
nsCOMPtr<nsIChannel> mDummyLayoutRequest;
// used for list of posted events and attribute changes. To be done
// after reflow.
@ -5330,10 +5343,10 @@ PresShell::AddDummyLayoutRequest(void)
}
if (loadGroup) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mDummyLayoutRequest);
rv = channel->SetLoadGroup(loadGroup);
rv = mDummyLayoutRequest->SetLoadGroup(loadGroup);
if (NS_FAILED(rv)) return rv;
rv = loadGroup->AddRequest(mDummyLayoutRequest, nsnull);
rv = loadGroup->AddChannel(mDummyLayoutRequest, nsnull);
if (NS_FAILED(rv)) return rv;
}
@ -5357,7 +5370,7 @@ PresShell::RemoveDummyLayoutRequest(void)
}
if (loadGroup && mDummyLayoutRequest) {
rv = loadGroup->RemoveRequest(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
rv = loadGroup->RemoveChannel(mDummyLayoutRequest, nsnull, NS_OK, nsnull);
if (NS_FAILED(rv)) return rv;
mDummyLayoutRequest = nsnull;

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

@ -4715,12 +4715,8 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
nsCOMPtr<nsIHTTPChannel> httpChannel;
nsCOMPtr<nsIChannel> channel;
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);
rv = aLoader->GetChannel(getter_AddRefs(channel));
NS_ASSERTION(channel, "StreamLoader's channel went away prematurely");
if (channel) {
httpChannel = do_QueryInterface(channel);

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

@ -585,35 +585,33 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsCOMPtr<nsIFile> file;
rv = fileChannel->GetFile(getter_AddRefs(file));
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;
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;
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,14 +121,10 @@ ImageListener::~ImageListener()
NS_IMPL_THREADSAFE_ISUPPORTS(ImageListener, NS_GET_IID(nsIStreamListener))
NS_IMETHODIMP
ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
ImageListener::OnStartRequest(nsIChannel* channel, 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;
@ -137,11 +133,11 @@ ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
return mNextStream->OnStartRequest(request, ctxt);
return mNextStream->OnStartRequest(channel, ctxt);
}
NS_IMETHODIMP
ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
ImageListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
nsresult status, const PRUnichar *errorMsg)
{
if(mDocument){
@ -151,17 +147,17 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
return mNextStream->OnStopRequest(request, ctxt, status, errorMsg);
return mNextStream->OnStopRequest(channel, ctxt, status, errorMsg);
}
NS_IMETHODIMP
ImageListener::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
ImageListener::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt,
nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
{
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
return mNextStream->OnDataAvailable(channel, ctxt, inStr, sourceOffset, count);
}
//----------------------------------------------------------------------

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

@ -260,37 +260,38 @@ 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(nsIRequest *request, nsISupports* aCtxt, nsIInputStream* aInStr,
nsXBLStreamListener::OnDataAvailable(nsIChannel* aChannel, nsISupports* aCtxt, nsIInputStream* aInStr,
PRUint32 aSourceOffset, PRUint32 aCount)
{
if (mInner)
return mInner->OnDataAvailable(request, aCtxt, aInStr, aSourceOffset, aCount);
return mInner->OnDataAvailable(aChannel, aCtxt, aInStr, aSourceOffset, aCount);
return NS_ERROR_FAILURE;
}
/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
NS_IMETHODIMP
nsXBLStreamListener::OnStartRequest(nsIRequest* request, nsISupports* aCtxt)
nsXBLStreamListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aCtxt)
{
if (mInner)
return mInner->OnStartRequest(request, aCtxt);
return mInner->OnStartRequest(aChannel, aCtxt);
return NS_ERROR_FAILURE;
}
/* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP
nsXBLStreamListener::OnStopRequest(nsIRequest* request, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg)
nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg)
{
nsresult rv = NS_OK;
if (mInner) {
rv = mInner->OnStopRequest(request, aCtxt, aStatus, aStatusArg);
rv = mInner->OnStopRequest(aChannel, aCtxt, aStatus, aStatusArg);
}
if (NS_FAILED(rv) || NS_FAILED(aStatus))
{
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
if (aChannel)
if (aChannel)
{
nsCOMPtr<nsIURI> channelURI;
aChannel->GetURI(getter_AddRefs(channelURI));
@ -1190,7 +1191,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;
@ -1232,22 +1233,18 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
xblListener->AddRequest(req);
// Now kick off the async read.
channel->AsyncOpen(xblListener, nsnull);
channel->AsyncRead(xblListener, nsnull);
return NS_OK;
}
// Now do a blocking synchronous parse of the file.
nsCOMPtr<nsIInputStream> in;
PRUint32 sourceOffset = 0;
rv = channel->Open(getter_AddRefs(in));
rv = channel->OpenInputStream(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;
@ -1256,7 +1253,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
if (! proxy)
return NS_ERROR_FAILURE;
listener->OnStartRequest(request, nsnull);
listener->OnStartRequest(channel, nsnull);
while (PR_TRUE) {
char buf[1024];
PRUint32 readCount;
@ -1269,12 +1266,12 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
proxy->SetBuffer(buf, readCount);
rv = listener->OnDataAvailable(request, nsnull, proxy, sourceOffset, readCount);
rv = listener->OnDataAvailable(channel, nsnull, proxy, sourceOffset, readCount);
sourceOffset += readCount;
if (NS_FAILED(rv))
break;
}
listener->OnStopRequest(request, nsnull, NS_OK, nsnull);
listener->OnStopRequest(channel, nsnull, NS_OK, nsnull);
// don't leak proxy!
proxy->Close();

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

@ -28,7 +28,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkxmldoc_s
REQUIRES = xpcom js dom locale widget caps htmlparser necko view docshell webshell uriloader pref xpconnect uconv chardet expat lwbrk exthandler mime
REQUIRES = xpcom js dom locale widget caps htmlparser necko view docshell webshell uriloader pref xpconnect uconv chardet expat lwbrk
CPPSRCS = \
nsXMLContentSink.cpp \

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

@ -1669,11 +1669,7 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
if (NS_OK == aStatus) {
{ // scope in block so nsCOMPtr released at one point
nsCOMPtr<nsIChannel> channel;
nsCOMPtr<nsIRequest> request;
aLoader->GetRequest(getter_AddRefs(request));
if (request)
channel = do_QueryInterface(request);
aLoader->GetChannel(getter_AddRefs(channel));
nsCOMPtr<nsIURI> url;
if (channel) {
channel->GetURI(getter_AddRefs(url));

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

@ -74,11 +74,6 @@
#include "nsIPrincipal.h"
#include "nsIAggregatePrincipal.h"
#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
// XXX The XML world depends on the html atoms
#include "nsHTMLAtoms.h"
@ -356,7 +351,7 @@ nsXMLDocument::Load(const nsAReadableString& aUrl)
}
// Start an asynchronous read of the XML document
rv = channel->AsyncOpen(listener, nsnull);
rv = channel->AsyncRead(listener, nsnull);
return rv;
}
@ -386,10 +381,8 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
rv = aChannel->GetURI(getter_AddRefs(aUrl));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMIMEService> MIMEService (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
rv = MIMEService->GetTypeFromURI(aUrl, &aContentType);
rv = aChannel->GetContentType(&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* channel,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,

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

@ -342,7 +342,7 @@ NS_IMETHODIMP
nsAbSyncPostEngine::DoContent(const char * aContentType,
nsURILoadCommand aCommand,
const char * aWindowTarget,
nsIRequest *request,
nsIChannel * aOpenedChannel,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{
@ -391,7 +391,7 @@ nsAbSyncPostEngine::StillRunning(PRBool *running)
// Methods for nsIStreamListener...
nsresult
nsAbSyncPostEngine::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
nsAbSyncPostEngine::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength)
{
PRUint32 readLen = aLength;
@ -417,7 +417,7 @@ nsAbSyncPostEngine::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsI
// Methods for nsIStreamObserver
nsresult
nsAbSyncPostEngine::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsAbSyncPostEngine::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
{
if (mAuthenticationRunning)
NotifyListenersOnStartAuthOperation();
@ -427,7 +427,7 @@ nsAbSyncPostEngine::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
}
nsresult
nsAbSyncPostEngine::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_rhp
printf("nsAbSyncPostEngine::OnStopRequest()\n");
@ -441,20 +441,20 @@ nsAbSyncPostEngine::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */,
mStillRunning = PR_FALSE;
// Check the content type!
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (channel)
if (aChannel)
{
char *contentType = nsnull;
char *charset = nsnull;
if (NS_SUCCEEDED(channel->GetContentType(&contentType)) && contentType)
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
{
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
mContentType = contentType;
}
}
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(channel);
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
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->AsyncOpen(this, nsnull);
httpChannel->AsyncRead(this, nsnull);
return NS_OK;
}
@ -844,9 +844,11 @@ nsAbSyncPostEngine::CancelAbSync()
{
rv = mSyncMojo->CancelTheMojo();
}
else if (mChannel)
else
{
rv = mChannel->Cancel(NS_BINDING_ABORTED);
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(mChannel);
if (httpChannel)
rv = httpChannel->Cancel(NS_BINDING_ABORTED);
}
return rv;

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

@ -109,6 +109,7 @@ private:
PRBool mAuthenticationRunning;
nsCOMPtr<nsIAbSyncMojo> mSyncMojo;
nsCOMPtr<nsIChannel> mChannel;
char *mSyncProtocolRequest;
char *mSyncProtocolRequestPrefix;

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

@ -44,7 +44,7 @@ interface nsIMsgFilterList;
interface nsIMsgFolderCacheElement;
interface nsAutoString;
interface nsITransport;
interface nsIFileChannel;
typedef long nsMsgBiffState;
// enumerated type for determining if a message has been replied to, forwarded, etc.
@ -344,7 +344,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);
nsITransport getOfflineFileTransport(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size);
nsIFileChannel getOfflineFileChannel(in nsMsgKey msgKey);
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(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
nsresult rv;
rv = mDestination->CopyData(aIStream, aLength);
return rv;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request, nsISupports *ctxt)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
{
nsCOMPtr<nsIMessage> message;
nsresult rv = NS_OK;
@ -154,7 +154,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request,
return rv;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIChannel * aChannel, 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(nsIRequest* request, nsISupports* aSupport)
nsSaveMsgListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aSupport)
{
nsresult rv = NS_OK;
if (m_fileSpec)
@ -1612,7 +1612,7 @@ nsSaveMsgListener::OnStartRequest(nsIRequest* request, nsISupports* aSupport)
}
NS_IMETHODIMP
nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
nsSaveMsgListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aSupport,
nsresult status, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
@ -1710,7 +1710,7 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
}
NS_IMETHODIMP
nsSaveMsgListener::OnDataAvailable(nsIRequest* request,
nsSaveMsgListener::OnDataAvailable(nsIChannel* aChannel,
nsISupports* aSupport,
nsIInputStream* inStream,
PRUint32 srcOffset,

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

@ -281,7 +281,7 @@ nsFolderCompactState::GetMessage(nsIMessage **message)
NS_IMETHODIMP
nsFolderCompactState::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsFolderCompactState::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
{
nsresult rv = NS_ERROR_FAILURE;
NS_ASSERTION(m_fileStream, "Fatal, null m_fileStream...\n");
@ -296,7 +296,7 @@ nsFolderCompactState::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
}
NS_IMETHODIMP
nsFolderCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsFolderCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
{
@ -355,7 +355,7 @@ done:
}
NS_IMETHODIMP
nsFolderCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
nsFolderCompactState::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count)
{
@ -397,7 +397,7 @@ nsOfflineStoreCompactState::InitDB(nsIMsgDatabase *db)
}
NS_IMETHODIMP
nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsOfflineStoreCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
{

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

@ -72,7 +72,7 @@ public:
virtual ~nsOfflineStoreCompactState(void);
virtual nsresult InitDB(nsIMsgDatabase *db);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt,
NS_IMETHOD OnStopRequest(nsIChannel *channel, 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, nsIRequest *request, PRUint32 aStatus)
nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChannel, PRUint32 aStatus)
{
// Now, fire off the print operation!
nsresult rv = NS_ERROR_FAILURE;
@ -107,12 +107,10 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIRequest *reque
PR_FREEIF(msg);
NS_ASSERTION(mDocShell,"can't print, there is no docshell");
if ( (!mDocShell) || (!request) )
if ( (!mDocShell) || (!aChannel) )
{
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;
@ -160,25 +158,25 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIRequest *reque
}
NS_IMETHODIMP
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request)
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIChannel *channel)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIRequest *request, nsString & aMsg)
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIChannel *channel, nsString & aMsg)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aStatus)
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aStatus)
{
return NS_OK;
}

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

@ -245,15 +245,15 @@ NS_IMETHODIMP nsMsgStatusFeedback::SetDocShell(nsIDocShell *shell, nsIDOMWindowI
return NS_OK;
}
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIRequest *request, nsISupports* ctxt,
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIChannel* channel, nsISupports* ctxt,
PRUint32 aProgress, PRUint32 aProgressMax)
{
// XXX: What should the nsIWebProgress be?
return OnProgressChange(nsnull, request, aProgress, aProgressMax,
return OnProgressChange(nsnull, channel, aProgress, aProgressMax,
aProgress /* current total progress */, aProgressMax /* max total progress */);
}
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ctxt,
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIChannel* channel, 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,
nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
nsIChannel *aChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
{
if (aContentType)
{
@ -408,9 +408,6 @@ 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...
@ -422,7 +419,7 @@ NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand
if (mailnewsUrl)
mailnewsUrl->SetMsgWindow(this);
}
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, request, aContentHandler, aAbortProcess);
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, aChannel, aContentHandler, aAbortProcess);
}
}
return NS_OK;

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

@ -35,8 +35,6 @@
#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
@ -589,12 +587,10 @@ nsresult nsMsgDBFolder::GetOfflineStoreInputStream(nsIInputStream **stream)
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **aFileChannel)
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel)
{
NS_ENSURE_ARG(aFileChannel);
*offset = *size = 0;
nsresult rv;
rv = nsComponentManager::CreateInstance(NS_LOCALFILECHANNEL_CONTRACTID, nsnull,
@ -608,14 +604,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *
rv = NS_NewLocalFile(nativePath, PR_TRUE, getter_AddRefs(localStore));
if (NS_SUCCEEDED(rv) && localStore)
{
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);
rv = (*aFileChannel)->Init(localStore, PR_CREATE_FILE | PR_RDWR, 0);
if (NS_SUCCEEDED(rv))
{
@ -623,8 +612,12 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *
rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(hdr));
if (hdr && NS_SUCCEEDED(rv))
{
hdr->GetMessageOffset(offset);
hdr->GetOfflineMessageSize(size);
PRUint32 messageOffset;
PRUint32 messageSize;
hdr->GetMessageOffset(&messageOffset);
hdr->GetOfflineMessageSize(&messageSize);
(*aFileChannel)->SetTransferOffset(messageOffset);
(*aFileChannel)->SetTransferCount(messageSize);
}
}
}
@ -644,6 +637,11 @@ 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)
@ -651,7 +649,8 @@ nsresult nsMsgDBFolder::GetOfflineStoreOutputStream(nsIOutputStream **outputStre
rv = fileChannel->Init(localStore, PR_CREATE_FILE | PR_RDWR, 0);
if (NS_FAILED(rv))
return rv;
rv = fileChannel->Open(outputStream);
fileChannel->SetTransferOffset(fileSize);
rv = fileChannel->OpenOutputStream(outputStream);
if (NS_FAILED(rv))
return rv;
}
@ -697,6 +696,7 @@ 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 GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **_retval);
NS_IMETHOD GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel);
NS_IMETHOD HasMsgOffline(nsMsgKey msgKey, PRBool *result);
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages);
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);

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

@ -2456,7 +2456,6 @@ 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,9 +28,7 @@
#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"
@ -39,11 +37,7 @@
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_ISUPPORTS4(nsMsgProtocol,
nsIStreamListener,
nsIStreamObserver,
nsIChannel,
nsIRequest)
NS_IMPL_ISUPPORTS3(nsMsgProtocol, nsIStreamListener, nsIStreamObserver, nsIChannel)
nsMsgProtocol::nsMsgProtocol(nsIURI * aURL)
{
@ -89,7 +83,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_transport));
rv = socketService->CreateTransportOfType(connectionType, aHostName, aGetPort, nsnull, -1, 0, 0, getter_AddRefs(m_channel));
if (NS_FAILED(rv)) return rv;
m_socketIsOpen = PR_FALSE;
@ -126,28 +120,11 @@ nsresult nsMsgProtocol::OpenFileSocket(nsIURI * aURL, const nsFileSpec * aFileSp
aURL->GetPath(getter_Copies(filePath));
char * urlSpec = PR_smprintf("file://%s", (const char *) filePath);
// 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));
rv = netService->NewChannel(urlSpec,
nsnull, // null base URI
getter_AddRefs(m_channel));
PR_FREEIF(urlSpec);
m_socketIsOpen = PR_FALSE;
m_socketIsOpen = PR_FALSE;
}
return rv;
@ -157,9 +134,9 @@ nsresult nsMsgProtocol::SetupTransportState()
{
nsresult rv = NS_OK;
if (!m_socketIsOpen && m_transport)
if (!m_socketIsOpen && m_channel)
{
rv = m_transport->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream));
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create an output stream");
// we want to open the stream
@ -177,11 +154,10 @@ 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_request) {
rv = m_request->Cancel(NS_BINDING_ABORTED);
if (m_channel) {
rv = m_channel->Cancel(NS_BINDING_ABORTED);
}
m_request = 0;
m_transport = 0;
m_channel = null_nsCOMPtr();
return rv;
}
@ -211,14 +187,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(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIChannel * /* aChannel */, 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(nsIRequest *request, nsISupports *ctxt)
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
{
nsresult rv = NS_OK;
nsCOMPtr <nsIMsgMailNewsUrl> aMsgUrl = do_QueryInterface(ctxt, &rv);
@ -226,7 +202,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIRequest *request, nsISupports *ct
{
rv = aMsgUrl->SetUrlState(PR_TRUE, NS_OK);
if (m_loadGroup)
m_loadGroup->AddRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull /* context isupports */);
m_loadGroup->AddChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull /* context isupports */);
}
// if we are set up as a channel, we should notify our channel listener that we are starting...
@ -243,7 +219,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIRequest *request, nsISupports *ct
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
@ -258,7 +234,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctx
{
rv = msgUrl->SetUrlState(PR_FALSE, aStatus);
if (m_loadGroup)
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, aStatus, nsnull);
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, 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()
@ -336,10 +312,19 @@ nsresult nsMsgProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
if (!m_socketIsOpen)
{
nsCOMPtr<nsISupports> urlSupports = do_QueryInterface(aURL);
if (m_transport)
if (m_channel)
{
// 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_transport->AsyncRead(this, urlSupports, m_startPosition, m_readCount, 0, getter_AddRefs(m_request));
rv = m_channel->AsyncRead(this /* stream observer */, urlSupports);
NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncRead failed");
m_socketIsOpen = PR_TRUE; // mark the channel as open
}
@ -393,13 +378,19 @@ NS_IMETHODIMP nsMsgProtocol::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsMsgProtocol::Open(nsIInputStream **_retval)
NS_IMETHODIMP nsMsgProtocol::OpenInputStream(nsIInputStream **_retval)
{
NS_NOTREACHED("Open");
NS_NOTREACHED("OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsMsgProtocol::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
{
// set the stream listener and then load the url
m_channelContext = ctxt;
@ -426,6 +417,12 @@ NS_IMETHODIMP nsMsgProtocol::AsyncOpen(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;
@ -464,18 +461,6 @@ 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)
{
@ -483,6 +468,83 @@ 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;
@ -529,10 +591,26 @@ 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;
@ -541,8 +619,8 @@ NS_IMETHODIMP nsMsgProtocol::IsPending(PRBool *result)
NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
{
if (m_request)
return m_request->GetStatus(status);
if (m_channel)
return m_channel->GetStatus(status);
*status = NS_ERROR_FAILURE;
return *status;
@ -550,12 +628,12 @@ NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
NS_IMETHODIMP nsMsgProtocol::Cancel(nsresult status)
{
NS_ASSERTION(m_request,"no channel");
if (!m_request) {
NS_ASSERTION(m_channel,"no channel");
if (!m_channel) {
return NS_ERROR_FAILURE;
}
return m_request->Cancel(status);
return m_channel->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,9 +42,7 @@ 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);
@ -103,10 +101,8 @@ protected:
virtual nsresult InitFromURI(nsIURI *aUrl);
// Ouput stream for writing commands to the socket
nsCOMPtr<nsITransport> m_transport;
nsCOMPtr<nsIRequest> m_request;
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
nsCOMPtr<nsIChannel> m_channel;
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

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

@ -1168,12 +1168,12 @@ QuotingOutputStreamListener::ConvertToPlainText(PRBool formatflowed /* = PR_FALS
return rv;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIRequest *request, nsISupports * /* ctxt */)
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIChannel * /* aChannel */, nsISupports * /* ctxt */)
{
return NS_OK;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
{
nsresult rv = NS_OK;
nsAutoString aCharset;
@ -1369,7 +1369,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
return rv;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIRequest *request,
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIChannel * /* aChannel */,
nsISupports *ctxt, nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count)
{

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

@ -42,18 +42,15 @@ nsMsgComposeContentHandler::~nsMsgComposeContentHandler()
}
NS_IMETHODIMP nsMsgComposeContentHandler::HandleContent(const char * aContentType, const char * aCommand,
const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
{
nsresult rv = NS_OK;
if (!request)
if (!aChannel)
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->AsyncOpen(convertedListener, ctxt);
rv = mQuoteChannel->AsyncRead(convertedListener, ctxt);
ReleaseMessageServiceFromURI(aMsgUri, msgService);
return rv;

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

@ -141,7 +141,7 @@ nsMsgSendLater::~nsMsgSendLater()
// Stream is done...drive on!
nsresult
nsMsgSendLater::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
nsresult rv;
@ -179,9 +179,6 @@ nsMsgSendLater::OnStopRequest(nsIRequest *request, 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;
@ -263,7 +260,7 @@ nsMsgSendLater::BuildNewBuffer(const char* aBuf, PRUint32 aCount, PRUint32 *tota
// Got data?
nsresult
nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
nsMsgSendLater::OnDataAvailable(nsIChannel *channel, 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
@ -319,7 +316,7 @@ nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInput
}
nsresult
nsMsgSendLater::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsMsgSendLater::OnStartRequest(nsIChannel *channel, 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(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
nsMsgProtocol::OnStopRequest(nsnull, ctxt, aStatus, aMsg);
@ -765,8 +765,7 @@ PRInt32 nsSmtpProtocol::SendTLSResponse()
{
nsCOMPtr<nsISupports> secInfo;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(m_request);
rv = channel->GetSecurityInfo(getter_AddRefs(secInfo));
rv = m_channel->GetSecurityInfo(getter_AddRefs(secInfo));
if (NS_SUCCEEDED(rv) && secInfo) {
nsCOMPtr<nsISSLSocketControl> sslControl = do_QueryInterface(secInfo, &rv);

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

@ -117,7 +117,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
private:
// logon redirection related variables and methods

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

@ -251,7 +251,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNEL
NS_DECL_NSIREQUEST
nsMailtoChannel(nsIURI * aURI);
virtual ~nsMailtoChannel();
@ -293,6 +293,13 @@ 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;
@ -317,17 +324,29 @@ NS_IMETHODIMP nsMailtoChannel::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::Open(nsIInputStream **_retval)
NS_IMETHODIMP nsMailtoChannel::OpenInputStream(nsIInputStream **_retval)
{
NS_NOTREACHED("Open");
NS_NOTREACHED("OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsMailtoChannel::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::AsyncRead(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;
@ -363,6 +382,83 @@ 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");
@ -375,19 +471,13 @@ 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
////////////////////////////////////////////////////////////////////////////////
/* readonly attribute wstring name; */
NS_IMETHODIMP nsMailtoChannel::GetName(PRUnichar * *aName)
NS_IMETHODIMP nsMailtoChannel::GetName(PRUnichar* *result)
{
NS_NOTREACHED("nsMailtoChannel::GetName");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -421,6 +511,7 @@ 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)
@ -778,7 +869,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,
nsIRequest *request,
nsIChannel * aOpenedChannel,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{
@ -230,7 +230,7 @@ nsURLFetcher::StillRunning(PRBool *running)
// Methods for nsIStreamListener...
nsresult
nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength)
{
PRUint32 readLen = aLength;
@ -263,13 +263,13 @@ nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputS
// Methods for nsIStreamObserver
nsresult
nsURLFetcher::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsURLFetcher::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
{
return NS_OK;
}
nsresult
nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_rhp
printf("nsURLFetcher::OnStopRequest()\n");
@ -294,30 +294,29 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsres
mOutStream = nsnull;
}
// Check the content type!
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)
if (aChannel)
{
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
mContentType = contentType;
}
}
char *contentType = nsnull;
char *charset = nsnull;
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel)
{
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
{
mCharset = charset;
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
mContentType = contentType;
}
}
}
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel)
{
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
{
mCharset = charset;
}
}
}
// Now if there is a callback, we need to call it...
if (mCallback)
@ -403,7 +402,10 @@ nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
// the url....
if (NS_FAILED(aStatus))
OnStopRequest(aRequest, nsnull, aStatus, nsnull);
{
nsCOMPtr<nsIChannel> channel (do_QueryInterface(aRequest));
OnStopRequest(channel, 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,10 +478,7 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
if (NS_SUCCEEDED(aImapUrl->GetMockChannel(getter_AddRefs(mockChannel))) && mockChannel)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request)
return NS_ERROR_FAILURE;
request->GetStatus(&rv);
mockChannel->GetStatus(&rv);
if (!NS_SUCCEEDED(rv))
{
nsresult res;

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

@ -1033,7 +1033,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
if (empytingOnExit)
{
nsCOMPtr<nsIImapIncomingServer> imapServer;
rv = GetImapIncomingServer(getter_AddRefs(imapServer));
nsresult rv = GetImapIncomingServer(getter_AddRefs(imapServer));
if (NS_SUCCEEDED(rv) && imapServer)
{
@ -3644,18 +3644,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(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsImapMailFolder::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
nsresult rv = NS_OK;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
{
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
return NS_OK;
}
@ -4207,9 +4207,7 @@ nsresult nsImapMailFolder::DisplayStatusMsg(nsIImapUrl *aImapUrl, const PRUnicha
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
if (progressSink)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request) return NS_ERROR_FAILURE;
progressSink->OnStatus(request, nsnull, NS_OK, msg); // XXX i18n message
progressSink->OnStatus(mockChannel, nsnull, NS_OK, msg); // XXX i18n message
}
}
return NS_OK;
@ -4272,12 +4270,9 @@ nsImapMailFolder::PercentProgress(nsIImapProtocol* aProtocol,
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
if (progressSink)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request) return NS_ERROR_FAILURE;
progressSink->OnProgress(request, nsnull, aInfo->currentProgress, aInfo->maxProgress);
progressSink->OnProgress(mockChannel, nsnull, aInfo->currentProgress, aInfo->maxProgress);
if (aInfo->message)
progressSink->OnStatus(request, nsnull, NS_OK, aInfo->message); // XXX i18n message
progressSink->OnStatus(mockChannel, 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(0, -1, 0, getter_AddRefs(m_outputStream));
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
}
} // if m_runningUrl
@ -616,12 +616,7 @@ 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));
if (callbacks) {
nsCOMPtr<nsIProgressEventSink> progressSink;
(void)callbacks->GetInterface(NS_GET_IID(nsIProgressEventSink),
getter_AddRefs(progressSink));
m_channel->SetProgressEventSink(progressSink);
}
m_channel->SetNotificationCallbacks(callbacks);
// 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.
@ -1009,8 +1004,7 @@ PRBool nsImapProtocol::ProcessCurrentURL()
if (!TestFlag(IMAP_CONNECTION_IS_OPEN) && m_channel)
{
nsCOMPtr<nsIRequest> request;
m_channel->AsyncRead(this /* stream observer */, nsnull, 0,-1,0, getter_AddRefs(request));
m_channel->AsyncRead(this /* stream observer */, nsnull);
SetFlag(IMAP_CONNECTION_IS_OPEN);
}
#ifdef DEBUG_bienvenu
@ -1042,10 +1036,9 @@ 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) {
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
m_channelListener->OnStartRequest(request, m_channelContext);
}
if (m_channelListener)
m_channelListener->OnStartRequest(m_mockChannel, 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
@ -1130,13 +1123,9 @@ 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)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
if (!request) return NS_ERROR_FAILURE;
if (m_channelListener)
rv = m_channelListener->OnStopRequest(m_mockChannel, m_channelContext, NS_OK, nsnull);
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()
@ -1200,7 +1189,7 @@ void nsImapProtocol::ParseIMAPandCheckForNewMail(const char* commandString, PRBo
/////////////////////////////////////////////////////////////////////////////////////////////
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
{
nsresult res = NS_OK;
@ -1224,7 +1213,7 @@ NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIRequest *request, nsISupports *
return res;
}
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, 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
@ -1241,7 +1230,7 @@ NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIRequest *request, nsISupports *c
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
{
PRBool killThread = PR_FALSE;
@ -2820,11 +2809,8 @@ nsImapProtocol::PostLineDownLoadEvent(msg_line_info *downloadLineDontDelete)
{
nsresult rv = m_channelOutputStream->Write(line, PL_strlen(line), &count);
if (NS_SUCCEEDED(rv))
{
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
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
}
if (m_imapMessageSink)
m_imapMessageSink->GetNotifyDownloadedLines(&echoLineToMessageSink);
@ -3523,11 +3509,8 @@ 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)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
if (request)
request->GetStatus(&returnValue);
}
m_mockChannel->GetStatus(&returnValue);
if (NS_SUCCEEDED(returnValue)) // check the other way of cancelling.
{
PR_EnterMonitor(m_threadDeathMonitor);
@ -6726,23 +6709,23 @@ nsresult nsImapCacheStreamListener::Init(nsIStreamListener * aStreamListener, ns
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
nsImapCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
{
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->AddRequest(request, nsnull /* context isupports */);
return mListener->OnStartRequest(request, aCtxt);
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
return mListener->OnStartRequest(mChannelToUse, aCtxt);
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
nsImapCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = mListener->OnStopRequest(request, aCtxt, aStatus, aMsg);
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->RemoveRequest(request, nsnull, aStatus, nsnull);
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
mListener = nsnull;
mChannelToUse = nsnull;
@ -6750,9 +6733,9 @@ nsImapCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtx
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
nsImapCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
{
return mListener->OnDataAvailable(request, aCtxt, aInStream, aSourceOffset, aCount);
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
}
NS_IMPL_THREADSAFE_ADDREF(nsImapMockChannel)
@ -6784,6 +6767,12 @@ 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;
@ -6866,13 +6855,19 @@ NS_IMETHODIMP nsImapMockChannel::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsImapMockChannel::Open(nsIInputStream **_retval)
NS_IMETHODIMP nsImapMockChannel::OpenInputStream(nsIInputStream **_retval)
{
NS_NOTREACHED("nsImapMockChannel::Open");
NS_NOTREACHED("nsImapMockChannel::OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsImapMockChannel::OpenOutputStream(nsIOutputStream **_retval)
{
NS_NOTREACHED("nsImapMockChannel::OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
{
nsCOMPtr<nsICachedNetData> cacheEntry;
PRUint32 contentLength = 0;
@ -6940,16 +6935,15 @@ NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISuppo
if (NS_SUCCEEDED(rv) && annotationLength == nsCRT::strlen("Not Modified")
&& annotation && !nsCRT::strncmp(annotation, "Not Modified", annotationLength))
{
nsCOMPtr<nsITransport> cacheChannel;
rv = cacheEntry->NewTransport(m_loadGroup, getter_AddRefs(cacheChannel));
nsCOMPtr<nsIChannel> cacheChannel;
rv = cacheEntry->NewChannel(m_loadGroup, getter_AddRefs(cacheChannel));
if (NS_SUCCEEDED(rv))
{
// if we are going to read from the cache, then create a mock stream listener class and use it
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
nsCOMPtr<nsIRequest> request;
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext, 0, -1, 0, getter_AddRefs(request));
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
NS_RELEASE(cacheListener);
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
@ -6966,6 +6960,7 @@ NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISuppo
nsCOMPtr<nsISupports> securityInfo;
cacheEntry->GetSecurityInfo(getter_AddRefs(securityInfo));
SetSecurityInfo(securityInfo);
return rv;
}
}
@ -6984,17 +6979,14 @@ NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISuppo
if (folder && NS_SUCCEEDED(rv))
{
// we want to create a file channel and read the msg from there.
nsCOMPtr<nsITransport> fileChannel;
nsCOMPtr<nsIFileChannel> fileChannel;
nsMsgKey msgKey = atoi(messageIdString);
PRUint32 size, offset;
rv = folder->GetOfflineFileTransport(msgKey, &offset, &size, getter_AddRefs(fileChannel));
rv = folder->GetOfflineFileChannel(msgKey, 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))
{
// dougt - This may break the ablity to "cancel" a read from offline mail reading.
// fileChannel->SetLoadGroup(m_loadGroup);
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);
@ -7003,8 +6995,7 @@ NS_IMETHODIMP nsImapMockChannel::AsyncOpen(nsIStreamListener *listener, nsISuppo
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
nsCOMPtr<nsIRequest> request;
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, 0, getter_AddRefs(request));
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
NS_RELEASE(cacheListener);
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
@ -7040,6 +7031,12 @@ NS_IMETHODIMP nsImapMockChannel::AsyncOpen(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;
@ -7081,6 +7078,83 @@ 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;
@ -7094,22 +7168,13 @@ 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;
}
@ -7169,3 +7234,10 @@ nsImapMockChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
return NS_OK;
}
NS_IMETHODIMP
nsImapMockChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
*aSecurityInfo = mSecurityInfo;
NS_IF_ADDREF(*aSecurityInfo);
return NS_OK;
}

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

@ -35,7 +35,6 @@
#include "nsString.h"
#include "nsIProgressEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsITransport.h"
// imap event sinks
#include "nsIImapMailFolderSink.h"
@ -316,7 +315,7 @@ private:
PRUint32 m_curReadIndex; // current read index
// Ouput stream for writing commands to the socket
nsCOMPtr<nsITransport> m_channel;
nsCOMPtr<nsIChannel> 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->AsyncOpen(aStreamListener, aCtxt);
// now try to open the channel passing in our display consumer as the listener
rv = aChannel->AsyncRead(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->AsyncOpen(aStreamListener, aCtxt);
rv = aChannel->AsyncRead(aStreamListener, aCtxt);
}
else // do what we used to do before
{

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

@ -1132,8 +1132,7 @@ NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
if (loadGroup)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
loadGroup->AddRequest(request, nsnull /* context isupports */);
loadGroup->AddChannel(m_mockChannel, nsnull /* context isupports */);
}
}
return NS_OK;
@ -1151,8 +1150,7 @@ NS_IMETHODIMP nsImapUrl::RemoveChannel(nsresult status)
GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
loadGroup->RemoveRequest(request, nsnull, status, nsnull);
loadGroup->RemoveChannel(m_mockChannel, nsnull, status, nsnull);
}
// break deadly embrace between mock channel and url
SetMockChannel(nsnull);

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

@ -82,13 +82,11 @@ 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_request)
if (m_channel)
return m_channel->GetContentLength(aContentLength);
else
return NS_OK;
nsCOMPtr<nsIChannel> info = do_QueryInterface(m_request);
if (info) info->GetContentLength(aContentLength);
return NS_OK;
}
else if (m_runningUrl)
{
@ -146,7 +144,7 @@ void nsMailboxProtocol::Initialize(nsIURI * aURL)
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIChannel * aChannel, 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
@ -154,19 +152,19 @@ NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIRequest *request, nsISupports
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
{
// we need to inform our mailbox parser that it's time to start...
m_mailboxParser->OnStartRequest(request, ctxt);
m_mailboxParser->OnStartRequest(aChannel, ctxt);
}
return nsMsgProtocol::OnStartRequest(request, ctxt);
return nsMsgProtocol::OnStartRequest(aChannel, ctxt);
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, 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(request, ctxt, aStatus, nsnull);
m_mailboxParser->OnStopRequest(aChannel, ctxt, aStatus, nsnull);
}
else if (m_nextState == MAILBOX_READ_MESSAGE)
{
@ -198,7 +196,7 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIRequest *request, nsISupports
*/
if (aStatus == NS_BINDING_ABORTED)
aStatus = NS_OK;
nsMsgProtocol::OnStopRequest(request, ctxt, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(aChannel, ctxt, aStatus, aMsg);
return CloseSocket();
}
@ -481,8 +479,8 @@ nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream *
case MAILBOX_DONE:
case MAILBOX_ERROR_DONE:
{
nsCOMPtr <nsIMsgMailNewsUrl> anotherUrl = do_QueryInterface(m_runningUrl);
anotherUrl->SetUrlState(PR_FALSE, m_nextState == MAILBOX_DONE ?
nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningUrl);
url->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(nsIRequest *request, nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
NS_IMETHOD OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
NS_IMETHOD GetContentLength(PRInt32 * aContentLength);
private:
@ -127,9 +127,3 @@ 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(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset,
NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIChannel * /* aChannel */, 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(nsIRequest *request, nsISuppor
return rv;
}
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, nsISupports *ctxt)
{
nsTime currentTime;
m_startTime = currentTime;
@ -143,7 +143,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupport
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
DoneParsingFolder(aStatus);
// what can we do? we can close the stream?

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

@ -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(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsPop3Protocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
nsresult rv = nsMsgProtocol::OnStopRequest(aChannel, 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(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD Cancel(nsresult status);
// for nsMsgLineBuffer
virtual PRInt32 HandleLine(char *line, PRUint32 line_length);

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

@ -268,10 +268,7 @@ NS_IMETHODIMP nsMimeBaseEmitter::OnFull(nsIOutputStream* out)
PRUint32 bytesAvailable = 0;
rv = mInputStream->Available(&bytesAvailable);
NS_ASSERTION(NS_SUCCEEDED(rv), "Available failed");
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
rv = mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, bytesAvailable);
rv = mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0, bytesAvailable);
}
else
rv = NS_ERROR_NULL_POINTER;
@ -286,7 +283,7 @@ NS_IMETHODIMP nsMimeBaseEmitter::OnClose(nsIInputStream* in)
///////////////////////////////////////////////////////////////////////////
// nsMimeBaseEmitter Interface
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
nsMimeBaseEmitter::SetPipe(nsIInputStream * aInputStream, nsIOutputStream *outStream)
{
@ -865,8 +862,7 @@ nsMimeBaseEmitter::Complete()
PRUint32 bytesInStream;
nsresult rv2 = mInputStream->Available(&bytesInStream);
NS_ASSERTION(NS_SUCCEEDED(rv2), "Available failed");
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
rv2 = mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, bytesInStream);
rv2 = mOutListener->OnDataAvailable(mChannel, 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,6 +59,7 @@
#include "nsICharsetConverterManager.h"
#include "nsICharsetAlias.h"
#include "nsMimeTypes.h"
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsIMsgWindow.h"

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

@ -49,7 +49,6 @@
#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"
@ -611,7 +610,6 @@ 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);
@ -818,7 +816,7 @@ nsStreamConverter::SetIdentity(nsIMsgIdentity * aIdentity)
// networking library...
//
nsresult
nsStreamConverter::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
nsStreamConverter::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt,
nsIInputStream *aIStream,
PRUint32 sourceOffset,
PRUint32 aLength)
@ -889,7 +887,7 @@ char *output = "\
// called only once, at the beginning of a URL load.
//
nsresult
nsStreamConverter::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
{
#ifdef DEBUG_rhp
printf("nsStreamConverter::OnStartRequest()\n");
@ -902,21 +900,25 @@ nsStreamConverter::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
// here's a little bit of hackery....
// since the mime converter is now between the channel
// and the
if (request)
nsresult rv = NS_OK;
if (aChannel)
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (channel)
{
nsXPIDLCString contentType;
GetContentType(getter_Copies(contentType));
channel->SetContentType(contentType);
}
nsXPIDLCString contentType;
GetContentType(getter_Copies(contentType));
aChannel->SetContentType(contentType);
}
// forward the start rquest to any listeners
// forward the start request to any listeners
if (mOutListener)
mOutListener->OnStartRequest(request, ctxt);
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);
return NS_OK;
}
@ -925,7 +927,7 @@ nsStreamConverter::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
// called once when the networking library has finished processing the
//
nsresult
nsStreamConverter::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
#ifdef DEBUG_rhp
printf("nsStreamConverter::OnStopRequest()\n");
@ -1004,7 +1006,7 @@ nsStreamConverter::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresul
// forward on top request to any listeners
if (mOutListener)
mOutListener->OnStopRequest(request, ctxt, status, errorMsg);
mOutListener->OnStopRequest(/* mOutgoingChannel */ aChannel, ctxt, status, errorMsg);
mAlreadyKnowOutputType = PR_FALSE;
@ -1068,6 +1070,7 @@ 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* channel, nsIMsgMailNewsUrl *aRunningUrl);
nsresult Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse, nsIMsgMailNewsUrl *aRunningUrl);
protected:
nsCOMPtr<nsIChannel> mChannelToUse;
nsCOMPtr<nsIChannel> mChannelToUse;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIMsgMailNewsUrl> mRunningUrl;
};
@ -718,37 +718,36 @@ nsNntpCacheStreamListener::nsNntpCacheStreamListener()
nsNntpCacheStreamListener::~nsNntpCacheStreamListener()
{}
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel* channel,
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse,
nsIMsgMailNewsUrl *aRunningUrl)
{
NS_ENSURE_ARG(aStreamListener);
NS_ENSURE_ARG(channel);
mChannelToUse = channel;
NS_ENSURE_ARG(aChannelToUse);
mChannelToUse = aChannelToUse;
mListener = aStreamListener;
mRunningUrl = aRunningUrl;
return NS_OK;
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
nsNntpCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
{
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->AddRequest(request, nsnull /* context isupports */);
return mListener->OnStartRequest(request, aCtxt);
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
return mListener->OnStartRequest(mChannelToUse, aCtxt);
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
nsNntpCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = mListener->OnStopRequest(request, aCtxt, aStatus, aMsg);
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->RemoveRequest(request, nsnull, aStatus, nsnull);
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
// clear out mem cache entry so we're not holding onto it.
if (mRunningUrl)
@ -760,13 +759,13 @@ nsNntpCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtx
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
nsNntpCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
{
return mListener->OnDataAvailable(request, aCtxt, aInStream, aSourceOffset, aCount);
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
}
NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
{
nsresult rv;
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningURL, &rv);
@ -794,22 +793,18 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(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<nsITransport> fileChannel;
PRUint32 offset=0, size=0;
rv = folder->GetOfflineFileTransport(key, &offset, &size, getter_AddRefs(fileChannel));
nsCOMPtr<nsIFileChannel> fileChannel;
rv = folder->GetOfflineFileChannel(key, 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))
{
// dougt - This may break the ablity to "cancel" a read from offline mail reading.
// fileChannel->SetLoadGroup(m_loadGroup);
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);
nsCOMPtr<nsIRequest> request;
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, 0, getter_AddRefs(request));
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
NS_RELEASE(cacheListener);
MarkCurrentMsgRead();
@ -845,11 +840,10 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports
{
// we're going to fill up this cache entry,
// do we have a listener here?
nsIStreamListener *anotherListener = m_channelListener;
rv = cacheEntry->InterceptAsyncRead(anotherListener, 0, getter_AddRefs(m_channelListener));
nsCOMPtr<nsIRequest> request;
nsIStreamListener *listener = m_channelListener;
rv = cacheEntry->InterceptAsyncRead(listener, 0, getter_AddRefs(m_channelListener));
if (NS_SUCCEEDED(rv))
return nsMsgProtocol::AsyncOpen(m_channelListener, ctxt);
return nsMsgProtocol::AsyncRead(m_channelListener, ctxt);
}
}
}
@ -857,8 +851,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports
// to really load the msg with a protocol connection...
if (cacheEntry && contentLength > 0 && !partialFlag)
{
nsCOMPtr<nsITransport> cacheChannel;
rv = cacheEntry->NewTransport(m_loadGroup, getter_AddRefs(cacheChannel));
nsCOMPtr<nsIChannel> cacheChannel;
rv = cacheEntry->NewChannel(m_loadGroup, getter_AddRefs(cacheChannel));
if (NS_SUCCEEDED(rv))
{
nsNntpCacheStreamListener * cacheListener = new nsNntpCacheStreamListener();
@ -866,8 +860,7 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports
SetLoadGroup(m_loadGroup);
m_typeWanted = ARTICLE_WANTED;
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);
nsCOMPtr<nsIRequest> request;
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext, 0, -1, 0, getter_AddRefs(request));
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
NS_RELEASE(cacheListener);
MarkCurrentMsgRead();
@ -882,8 +875,7 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncOpen(nsIStreamListener *listener, nsISupports
}
}
nsCOMPtr<nsIRequest> parentRequest;
return nsMsgProtocol::AsyncOpen(listener, ctxt);
return nsMsgProtocol::AsyncRead(listener, ctxt);
}
nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
@ -1219,9 +1211,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(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
{
nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(aChannel, aContext, aStatus, aMsg);
// nsMsgProtocol::OnStopRequest() has called m_channelListener. There is
// no need to be called again in CloseSocket(). Let's clear it here.
@ -5417,7 +5409,7 @@ nsresult nsNNTPProtocol::CleanupAfterRunningUrl()
rv = m_channelListener->OnStopRequest(this, m_channelContext, NS_OK, nsnull);
if (m_loadGroup)
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, NS_OK, nsnull);
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, 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(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, 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 AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt);
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt);
nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer);
private:

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

@ -1610,12 +1610,9 @@ NS_IMETHODIMP nsNntpService::GetChromeUrlForTask(char **aChromeUrlForTask)
NS_IMETHODIMP
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
{
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) {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше