Added nsIURL argument to the nsIStreamListener interface

This commit is contained in:
rpotts%netscape.com 1998-07-15 22:38:01 +00:00
parent 8f8e2e233f
commit 646e80db63
18 changed files with 149 additions and 132 deletions

View File

@ -79,14 +79,16 @@ public:
ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext); ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext);
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg); NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
void Interrupt(); void Interrupt();
static void KeepPumpingStream(nsITimer *aTimer, void *aClosure);
protected: protected:
~ImageConsumer(); ~ImageConsumer();
ilIURL *mURL; ilIURL *mURL;
@ -118,19 +120,19 @@ NS_DEFINE_IID(kIStreamNotificationIID, NS_ISTREAMLISTENER_IID);
NS_IMPL_ISUPPORTS(ImageConsumer,kIStreamNotificationIID); NS_IMPL_ISUPPORTS(ImageConsumer,kIStreamNotificationIID);
NS_IMETHODIMP NS_IMETHODIMP
ImageConsumer::GetBindInfo(void) ImageConsumer::GetBindInfo(nsIURL* aURL)
{ {
return 0; return 0;
} }
NS_IMETHODIMP NS_IMETHODIMP
ImageConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) ImageConsumer::OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg)
{ {
return 0; return 0;
} }
NS_IMETHODIMP NS_IMETHODIMP
ImageConsumer::OnStartBinding(const char *aContentType) ImageConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
if (mInterrupted) { if (mInterrupted) {
mStatus = MK_INTERRUPTED; mStatus = MK_INTERRUPTED;
@ -158,7 +160,7 @@ ImageConsumer::OnStartBinding(const char *aContentType)
NS_IMETHODIMP NS_IMETHODIMP
ImageConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length) ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length)
{ {
PRInt32 max_read; PRInt32 max_read;
PRInt32 bytes_read = 0; PRInt32 bytes_read = 0;
@ -232,17 +234,23 @@ ImageConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length)
return NS_OK; return NS_OK;
} }
static void void
KeepPumpingStream(nsITimer *aTimer, void *aClosure) ImageConsumer::KeepPumpingStream(nsITimer *aTimer, void *aClosure)
{ {
nsIURL* url = nsnull;
ImageConsumer *consumer = (ImageConsumer *)aClosure; ImageConsumer *consumer = (ImageConsumer *)aClosure;
nsAutoString status; nsAutoString status;
consumer->OnStopBinding(NS_BINDING_SUCCEEDED, status); if (consumer->mURL) {
consumer->mURL->QueryInterface(kIURLIID, (void**)&url);
}
consumer->OnStopBinding(url, NS_BINDING_SUCCEEDED, status);
NS_IF_RELEASE(url);
} }
NS_IMETHODIMP NS_IMETHODIMP
ImageConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg) ImageConsumer::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
if (mTimer != nsnull) { if (mTimer != nsnull) {
NS_RELEASE(mTimer); NS_RELEASE(mTimer);
@ -251,12 +259,12 @@ ImageConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg)
// Since we're still holding on to the stream, there's still data // Since we're still holding on to the stream, there's still data
// that needs to be read. So, pump the stream ourselves. // that needs to be read. So, pump the stream ourselves.
if((mStream != nsnull) && (status == NS_BINDING_SUCCEEDED)) { if((mStream != nsnull) && (status == NS_BINDING_SUCCEEDED)) {
nsresult err = OnDataAvailable(mStream, mStream->GetLength()); nsresult err = OnDataAvailable(aURL, mStream, mStream->GetLength());
// If we still have the stream, there's still data to be // If we still have the stream, there's still data to be
// pumped, so we set a timer to call us back again. // pumped, so we set a timer to call us back again.
if (mStream != nsnull) { if (mStream != nsnull) {
if ((NS_OK != NS_NewTimer(&mTimer)) || if ((NS_OK != NS_NewTimer(&mTimer)) ||
(NS_OK != mTimer->Init(KeepPumpingStream, this, 0))) { (NS_OK != mTimer->Init(ImageConsumer::KeepPumpingStream, this, 0))) {
mStatus = MK_IMAGE_LOSSAGE; mStatus = MK_IMAGE_LOSSAGE;
NS_RELEASE(mStream); NS_RELEASE(mStream);
} }

View File

@ -124,12 +124,12 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; } NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(const char *aContentType) { return NS_OK; } NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
}; };
NS_IMETHODIMP CStreamListener::OnStopBinding(PRInt32 status, const nsString& aMsg) NS_IMETHODIMP CStreamListener::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
fputs("done.\n",stdout); fputs("done.\n",stdout);
g_bReadyForNextUrl = PR_TRUE; g_bReadyForNextUrl = PR_TRUE;

View File

@ -655,7 +655,7 @@ PRInt32 nsParser::CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount) {
* @param * @param
* @return * @return
*/ */
nsresult nsParser::GetBindInfo(void){ nsresult nsParser::GetBindInfo(nsIURL* aURL){
nsresult result=0; nsresult result=0;
return result; return result;
} }
@ -668,12 +668,12 @@ nsresult nsParser::GetBindInfo(void){
* @return * @return
*/ */
nsresult nsresult
nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, nsParser::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
nsresult result=0; nsresult result=0;
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnProgress(aProgress, aProgressMax, aMsg); mObserver->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
return result; return result;
} }
@ -685,9 +685,9 @@ nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
* @param * @param
* @return * @return
*/ */
nsresult nsParser::OnStartBinding(const char *aSourceType){ nsresult nsParser::OnStartBinding(nsIURL* aURL, const char *aSourceType){
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnStartBinding(aSourceType); mObserver->OnStartBinding(aURL, aSourceType);
} }
mParserContext->mAutoDetectStatus=eUnknownDetect; mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mDTD=0; mParserContext->mDTD=0;
@ -703,7 +703,7 @@ nsresult nsParser::OnStartBinding(const char *aSourceType){
* @param length is the number of bytes waiting input * @param length is the number of bytes waiting input
* @return error code (usually 0) * @return error code (usually 0)
*/ */
nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){ nsresult nsParser::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length){
/* if (nsnull != mListener) { /* if (nsnull != mListener) {
//Rick potts removed this. //Rick potts removed this.
//Does it need to be here? //Does it need to be here?
@ -747,10 +747,10 @@ nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
* @param * @param
* @return * @return
*/ */
nsresult nsParser::OnStopBinding(PRInt32 status, const nsString& aMsg){ nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg){
nsresult result=DidBuildModel(status); nsresult result=DidBuildModel(status);
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnStopBinding(status, aMsg); mObserver->OnStopBinding(aURL, status, aMsg);
} }
return result; return result;
} }

View File

@ -205,11 +205,11 @@ friend class CTokenHandler;
// These methods are callback methods used by // These methods are callback methods used by
// net lib to let us know about our inputstream. // net lib to let us know about our inputstream.
//********************************************* //*********************************************
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg); NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected: protected:

View File

@ -66,10 +66,10 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// nsIStreamObserver // nsIStreamObserver
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg); const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected: protected:
@ -808,7 +808,7 @@ TempObserver::QueryInterface(const nsIID& aIID,
NS_IMETHODIMP NS_IMETHODIMP
TempObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, TempObserver::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
fputs("[progress ", stdout); fputs("[progress ", stdout);
@ -820,7 +820,7 @@ TempObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
} }
NS_IMETHODIMP NS_IMETHODIMP
TempObserver::OnStartBinding(const char *aContentType) TempObserver::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
fputs("Loading ", stdout); fputs("Loading ", stdout);
fputs(mURL, stdout); fputs(mURL, stdout);
@ -829,7 +829,7 @@ TempObserver::OnStartBinding(const char *aContentType)
} }
NS_IMETHODIMP NS_IMETHODIMP
TempObserver::OnStopBinding(PRInt32 status, const nsString& aMsg) TempObserver::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
fputs("Done loading ", stdout); fputs("Done loading ", stdout);
fputs(mURL, stdout); fputs(mURL, stdout);

View File

@ -25,6 +25,7 @@
/* forward declaration */ /* forward declaration */
class nsIInputStream; class nsIInputStream;
class nsString; class nsString;
class nsIURL;
/* 97566110-ff60-11d1-beb9-00805f8a66dc */ /* 97566110-ff60-11d1-beb9-00805f8a66dc */
@ -42,12 +43,12 @@ public:
* @return The return value is currently ignored. In the future it may be * @return The return value is currently ignored. In the future it may be
* used to cancel the URL load.. * used to cancel the URL load..
*/ */
NS_IMETHOD OnStartBinding(const char *aContentType) = 0; NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) = 0;
/** /**
* Notify the client that progress as occurred for the URL load.<BR> * Notify the client that progress as occurred for the URL load.<BR>
*/ */
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString &aMsg) = 0; const nsString &aMsg) = 0;
/** /**
@ -61,7 +62,7 @@ public:
* @param msg A text string describing the error. * @param msg A text string describing the error.
* @return The return value is currently ignored. * @return The return value is currently ignored.
*/ */
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString &aMsg) = 0; NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg) = 0;
}; };
/* Generic status codes for OnStopBinding */ /* Generic status codes for OnStopBinding */
@ -97,7 +98,7 @@ public:
* *
* This method is currently not called. * This method is currently not called.
*/ */
NS_IMETHOD GetBindInfo(void) = 0; NS_IMETHOD GetBindInfo(nsIURL* aURL) = 0;
/** /**
* Notify the client that data is available in the input stream. This * Notify the client that data is available in the input stream. This
@ -109,7 +110,7 @@ public:
* @param length The amount of data that was just pushed into the stream. * @param length The amount of data that was just pushed into the stream.
* @return The return value is currently ignored. * @return The return value is currently ignored.
*/ */
NS_IMETHOD OnDataAvailable(nsIInputStream *aIStream, NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream,
PRInt32 aLength) = 0; PRInt32 aLength) = 0;
}; };

View File

@ -472,7 +472,7 @@ static void bam_exit_routine(URL_Struct *URL_s, int status, MWContext *window_id
if (pConn->pConsumer) { if (pConn->pConsumer) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_FAILED, status); pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_FAILED, status);
pConn->pConsumer->Release(); pConn->pConsumer->Release();
pConn->pConsumer = NULL; pConn->pConsumer = NULL;
} }

View File

@ -63,7 +63,7 @@ PRIVATE void stub_GraphProgressInit(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) { if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnProgress(0, content_length, status); pConn->pConsumer->OnProgress(pConn->pURL, 0, content_length, status);
} }
} }
} }
@ -88,7 +88,8 @@ PRIVATE void stub_GraphProgress(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) { if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnProgress(bytes_received, content_length, status); pConn->pConsumer->OnProgress(pConn->pURL, bytes_received,
content_length, status);
} }
} }
} }
@ -117,7 +118,8 @@ PRIVATE void stub_GraphProgressDestroy(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) { if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnProgress(total_bytes_read, content_length, status); pConn->pConsumer->OnProgress(pConn->pURL, total_bytes_read,
content_length, status);
} }
} }
} }
@ -328,7 +330,7 @@ void stub_complete(NET_StreamClass *stream)
if (pConn->pConsumer) { if (pConn->pConsumer) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_SUCCEEDED, status); pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_SUCCEEDED, status);
pConn->pConsumer->Release(); pConn->pConsumer->Release();
pConn->pConsumer = NULL; pConn->pConsumer = NULL;
} }
@ -358,7 +360,7 @@ void stub_abort(NET_StreamClass *stream, int status)
if (pConn->pConsumer) { if (pConn->pConsumer) {
nsAutoString status; nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_ABORTED, status); pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_ABORTED, status);
pConn->pConsumer->Release(); pConn->pConsumer->Release();
pConn->pConsumer = NULL; pConn->pConsumer = NULL;
} }
@ -390,7 +392,7 @@ int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length)
/* XXX: check return value to abort connection if necessary */ /* XXX: check return value to abort connection if necessary */
if (pConn->pConsumer && (0 < bytesWritten)) { if (pConn->pConsumer && (0 < bytesWritten)) {
pConn->pConsumer->OnDataAvailable(pConn->pNetStream, bytesWritten); pConn->pConsumer->OnDataAvailable(pConn->pURL, pConn->pNetStream, bytesWritten);
} }
return (bytesWritten == length); return (bytesWritten == length);
@ -492,7 +494,7 @@ NET_NGLayoutConverter(FO_Present_Types format_out,
if (pConn->pConsumer) { if (pConn->pConsumer) {
nsresult rv; nsresult rv;
rv = pConn->pConsumer->OnStartBinding(URL_s->content_type); rv = pConn->pConsumer->OnStartBinding(pConn->pURL, URL_s->content_type);
/* /*
* If OnStartBinding fails, then tear down the NET_StreamClass * If OnStartBinding fails, then tear down the NET_StreamClass
* and release all references... * and release all references...

View File

@ -54,11 +54,11 @@ public:
TestConsumer(); TestConsumer();
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg); NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected: protected:
~TestConsumer(); ~TestConsumer();
@ -83,17 +83,17 @@ TestConsumer::~TestConsumer()
} }
NS_IMETHODIMP TestConsumer::GetBindInfo(void) NS_IMETHODIMP TestConsumer::GetBindInfo(nsIURL* aURL)
{ {
if (bTraceEnabled) { if (bTraceEnabled) {
printf("\n+++ TestConsumer::GetBindInfo\n"); printf("\n+++ TestConsumer::GetBindInfo: URL: %p\n", aURL);
} }
return 0; return 0;
} }
NS_IMETHODIMP TestConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax, NS_IMETHODIMP TestConsumer::OnProgress(nsIURL* aURL, PRInt32 Progress,
const nsString& aMsg) PRInt32 ProgressMax, const nsString& aMsg)
{ {
if (bTraceEnabled) { if (bTraceEnabled) {
if (aMsg.Length()) { if (aMsg.Length()) {
@ -101,29 +101,29 @@ NS_IMETHODIMP TestConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax,
fputs(aMsg, stdout); fputs(aMsg, stdout);
fputs("\n", stdout); fputs("\n", stdout);
} else { } else {
printf("\n+++ TestConsumer::OnProgress: %d of total %d\n", Progress, ProgressMax); printf("\n+++ TestConsumer::OnProgress: URL: %p - %d of total %d\n", aURL, Progress, ProgressMax);
} }
} }
return 0; return 0;
} }
NS_IMETHODIMP TestConsumer::OnStartBinding(const char *aContentType) NS_IMETHODIMP TestConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
if (bTraceEnabled) { if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStartBinding: Content type: %s\n", aContentType); printf("\n+++ TestConsumer::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
} }
return 0; return 0;
} }
NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length) NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length)
{ {
PRInt32 len; PRInt32 len;
if (bTraceEnabled) { if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnDataAvailable: %d bytes available...\n", length); printf("\n+++ TestConsumer::OnDataAvailable: URL: %p, %d bytes available...\n", aURL, length);
} }
do { do {
@ -141,10 +141,10 @@ NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 le
} }
NS_IMETHODIMP TestConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg) NS_IMETHODIMP TestConsumer::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
if (bTraceEnabled) { if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStopBinding... status: %d\n", status); printf("\n+++ TestConsumer::OnStopBinding... URL: %p status: %d\n", aURL, status);
} }
/* The document has been loaded, so drop out of the message pump... */ /* The document has been loaded, so drop out of the message pump... */

View File

@ -124,12 +124,12 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; } NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(const char *aContentType) { return NS_OK; } NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
}; };
NS_IMETHODIMP CStreamListener::OnStopBinding(PRInt32 status, const nsString& aMsg) NS_IMETHODIMP CStreamListener::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
fputs("done.\n",stdout); fputs("done.\n",stdout);
g_bReadyForNextUrl = PR_TRUE; g_bReadyForNextUrl = PR_TRUE;

View File

@ -655,7 +655,7 @@ PRInt32 nsParser::CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount) {
* @param * @param
* @return * @return
*/ */
nsresult nsParser::GetBindInfo(void){ nsresult nsParser::GetBindInfo(nsIURL* aURL){
nsresult result=0; nsresult result=0;
return result; return result;
} }
@ -668,12 +668,12 @@ nsresult nsParser::GetBindInfo(void){
* @return * @return
*/ */
nsresult nsresult
nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, nsParser::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
nsresult result=0; nsresult result=0;
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnProgress(aProgress, aProgressMax, aMsg); mObserver->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
return result; return result;
} }
@ -685,9 +685,9 @@ nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
* @param * @param
* @return * @return
*/ */
nsresult nsParser::OnStartBinding(const char *aSourceType){ nsresult nsParser::OnStartBinding(nsIURL* aURL, const char *aSourceType){
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnStartBinding(aSourceType); mObserver->OnStartBinding(aURL, aSourceType);
} }
mParserContext->mAutoDetectStatus=eUnknownDetect; mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mDTD=0; mParserContext->mDTD=0;
@ -703,7 +703,7 @@ nsresult nsParser::OnStartBinding(const char *aSourceType){
* @param length is the number of bytes waiting input * @param length is the number of bytes waiting input
* @return error code (usually 0) * @return error code (usually 0)
*/ */
nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){ nsresult nsParser::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length){
/* if (nsnull != mListener) { /* if (nsnull != mListener) {
//Rick potts removed this. //Rick potts removed this.
//Does it need to be here? //Does it need to be here?
@ -747,10 +747,10 @@ nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
* @param * @param
* @return * @return
*/ */
nsresult nsParser::OnStopBinding(PRInt32 status, const nsString& aMsg){ nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg){
nsresult result=DidBuildModel(status); nsresult result=DidBuildModel(status);
if (nsnull != mObserver) { if (nsnull != mObserver) {
mObserver->OnStopBinding(status, aMsg); mObserver->OnStopBinding(aURL, status, aMsg);
} }
return result; return result;
} }

View File

@ -205,11 +205,11 @@ friend class CTokenHandler;
// These methods are callback methods used by // These methods are callback methods used by
// net lib to let us know about our inputstream. // net lib to let us know about our inputstream.
//********************************************* //*********************************************
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg); NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected: protected:

View File

@ -60,12 +60,12 @@ public:
nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData); nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData);
/* nsIStreamListener interface methods... */ /* nsIStreamListener interface methods... */
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg); const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString& aMsg);
protected: protected:
virtual ~nsDocumentBindInfo(); virtual ~nsDocumentBindInfo();
@ -365,41 +365,42 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
} }
NS_METHOD nsDocumentBindInfo::GetBindInfo(void) NS_METHOD nsDocumentBindInfo::GetBindInfo(nsIURL* aURL)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document"); NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->GetBindInfo(); rv = m_NextStream->GetBindInfo(aURL);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_METHOD nsDocumentBindInfo::OnProgress(nsIURL* aURL, PRInt32 aProgress,
PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
/* Pass the notification out to the next stream listener... */ /* Pass the notification out to the next stream listener... */
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnProgress(aProgress, aProgressMax, aMsg); rv = m_NextStream->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnProgress(aProgress, aProgressMax, aMsg); (void) m_Observer->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType) NS_METHOD nsDocumentBindInfo::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsIDocumentWidget* viewer = nsnull; nsIDocumentWidget* viewer = nsnull;
@ -437,13 +438,13 @@ NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_ASSERTION((nsnull != m_NextStream), "No stream was created!"); NS_ASSERTION((nsnull != m_NextStream), "No stream was created!");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnStartBinding(aContentType); rv = m_NextStream->OnStartBinding(aURL, aContentType);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnStartBinding(aContentType); (void) m_Observer->OnStartBinding(aURL, aContentType);
} }
done: done:
@ -453,32 +454,34 @@ done:
} }
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength) NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
nsIInputStream *aStream, PRInt32 aLength)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document"); NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aStream, aLength); rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnStopBinding(PRInt32 aStatus, const nsString& aMsg) NS_METHOD nsDocumentBindInfo::OnStopBinding(nsIURL* aURL, PRInt32 aStatus,
const nsString& aMsg)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnStopBinding(aStatus, aMsg); rv = m_NextStream->OnStopBinding(aURL, aStatus, aMsg);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnStopBinding(aStatus, aMsg); (void) m_Observer->OnStopBinding(aURL, aStatus, aMsg);
} }
/* /*

View File

@ -60,12 +60,12 @@ public:
nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData); nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData);
/* nsIStreamListener interface methods... */ /* nsIStreamListener interface methods... */
NS_IMETHOD GetBindInfo(void); NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg); const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength); NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString& aMsg);
protected: protected:
virtual ~nsDocumentBindInfo(); virtual ~nsDocumentBindInfo();
@ -365,41 +365,42 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
} }
NS_METHOD nsDocumentBindInfo::GetBindInfo(void) NS_METHOD nsDocumentBindInfo::GetBindInfo(nsIURL* aURL)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document"); NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->GetBindInfo(); rv = m_NextStream->GetBindInfo(aURL);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_METHOD nsDocumentBindInfo::OnProgress(nsIURL* aURL, PRInt32 aProgress,
PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
/* Pass the notification out to the next stream listener... */ /* Pass the notification out to the next stream listener... */
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnProgress(aProgress, aProgressMax, aMsg); rv = m_NextStream->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnProgress(aProgress, aProgressMax, aMsg); (void) m_Observer->OnProgress(aURL, aProgress, aProgressMax, aMsg);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType) NS_METHOD nsDocumentBindInfo::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsIDocumentWidget* viewer = nsnull; nsIDocumentWidget* viewer = nsnull;
@ -437,13 +438,13 @@ NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_ASSERTION((nsnull != m_NextStream), "No stream was created!"); NS_ASSERTION((nsnull != m_NextStream), "No stream was created!");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnStartBinding(aContentType); rv = m_NextStream->OnStartBinding(aURL, aContentType);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnStartBinding(aContentType); (void) m_Observer->OnStartBinding(aURL, aContentType);
} }
done: done:
@ -453,32 +454,34 @@ done:
} }
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength) NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
nsIInputStream *aStream, PRInt32 aLength)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document"); NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aStream, aLength); rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
} }
return rv; return rv;
} }
NS_METHOD nsDocumentBindInfo::OnStopBinding(PRInt32 aStatus, const nsString& aMsg) NS_METHOD nsDocumentBindInfo::OnStopBinding(nsIURL* aURL, PRInt32 aStatus,
const nsString& aMsg)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (nsnull != m_NextStream) { if (nsnull != m_NextStream) {
rv = m_NextStream->OnStopBinding(aStatus, aMsg); rv = m_NextStream->OnStopBinding(aURL, aStatus, aMsg);
} }
/* Pass the notification out to the Observer... */ /* Pass the notification out to the Observer... */
if (nsnull != m_Observer) { if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */ /* XXX: Should we ignore the return value? */
(void) m_Observer->OnStopBinding(aStatus, aMsg); (void) m_Observer->OnStopBinding(aURL, aStatus, aMsg);
} }
/* /*

View File

@ -301,7 +301,7 @@ void nsDocLoader::CancelAll()
NS_IMETHODIMP NS_IMETHODIMP
nsDocLoader::OnStartBinding(const char *aContentType) nsDocLoader::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
nsString* url = (nsString*)mURLList->ElementAt(mDocNum); nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
fputs(*url, stdout); fputs(*url, stdout);
@ -310,7 +310,7 @@ nsDocLoader::OnStartBinding(const char *aContentType)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocLoader::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, nsDocLoader::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
nsString* url = (nsString*)mURLList->ElementAt(mDocNum); nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
@ -324,7 +324,7 @@ nsDocLoader::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocLoader::OnStopBinding(PRInt32 status, const nsString& aMsg) nsDocLoader::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
nsString* url = (nsString*)mURLList->ElementAt(mDocNum); nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
fputs(*url, stdout); fputs(*url, stdout);

View File

@ -43,10 +43,10 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// nsIStreamObserver // nsIStreamObserver
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg); const nsString& aMsg);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
// Add a URL to the doc loader // Add a URL to the doc loader
void AddURL(char* aURL); void AddURL(char* aURL);

View File

@ -497,7 +497,7 @@ DocObserver::StyleSheetAdded(nsIStyleSheet* aStyleSheet)
} }
NS_IMETHODIMP NS_IMETHODIMP
DocObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, DocObserver::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg) const nsString& aMsg)
{ {
fputs(mURL, stdout); fputs(mURL, stdout);
@ -510,7 +510,7 @@ DocObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
} }
NS_IMETHODIMP NS_IMETHODIMP
DocObserver::OnStartBinding(const char *aContentType) DocObserver::OnStartBinding(nsIURL* aURL, const char *aContentType)
{ {
//start the throbber... //start the throbber...
if (nsnull != mViewer) if (nsnull != mViewer)
@ -522,7 +522,7 @@ DocObserver::OnStartBinding(const char *aContentType)
} }
NS_IMETHODIMP NS_IMETHODIMP
DocObserver::OnStopBinding(PRInt32 status, const nsString& aMsg) DocObserver::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{ {
fputs(mURL, stdout); fputs(mURL, stdout);
fputs(": stop\n", stdout); fputs(": stop\n", stdout);

View File

@ -92,10 +92,10 @@ public:
NS_IMETHOD StyleSheetAdded(nsIStyleSheet* aStyleSheet); NS_IMETHOD StyleSheetAdded(nsIStyleSheet* aStyleSheet);
// nsIStreamObserver // nsIStreamObserver
NS_IMETHOD OnStartBinding(const char *aContentType); NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax, NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg); const nsString& aMsg);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg); NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
// nsILinkHandler // nsILinkHandler
NS_IMETHOD Init(nsIWebWidget* aWidget); NS_IMETHOD Init(nsIWebWidget* aWidget);