Renamed OnStartBinding/OnStopBinding to OnStartRequest/OnStopRequest (removing the redundant ones from necko). Numerous necko fixes. Necko now using nsIPrompt interface instead of nsINetSupport.

This commit is contained in:
warren%netscape.com 1999-07-01 19:30:20 +00:00
Родитель 03a78c217d
Коммит bd73f68e8b
147 изменённых файлов: 1781 добавлений и 1176 удалений

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

@ -31,6 +31,9 @@
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIViewManager.h"
#ifdef NECKO
#include "nsIChannel.h"
#endif
// XXX TODO:
@ -79,17 +82,15 @@ public:
NS_DECL_ISUPPORTS
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus,
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream* aStream,
@ -117,15 +118,23 @@ NS_IMPL_ISUPPORTS(ImageListener, kIStreamListenerIID)
NS_IMETHODIMP
#ifdef NECKO
ImageListener::OnStartBinding(nsISupports *ctxt)
ImageListener::OnStartRequest(nsISupports *ctxt)
#else
ImageListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
ImageListener::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
#ifdef NECKO
nsresult rv;
nsIChannel* channel;
rv = ctxt->QueryInterface(nsIChannel::GetIID(), (void**)&channel);
if (NS_FAILED(rv)) return rv;
nsIURI* uri;
rv = channel->GetURI(&uri);
if (NS_FAILED(rv)) return rv;
mDocument->StartImageLoad(uri, mNextStream);
NS_RELEASE(uri);
NS_RELEASE(channel);
#else
mDocument->StartImageLoad(aURL, mNextStream);
#endif
@ -133,9 +142,9 @@ ImageListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStartBinding(ctxt);
return mNextStream->OnStartRequest(ctxt);
#else
return mNextStream->OnStartBinding(aURL, aContentType);
return mNextStream->OnStartRequest(aURL, aContentType);
#endif
}
@ -162,10 +171,10 @@ ImageListener::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
ImageListener::OnStopBinding(nsISupports *ctxt, nsresult status,
ImageListener::OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg)
#else
ImageListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
ImageListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
@ -173,9 +182,9 @@ ImageListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStopBinding(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
return mNextStream->OnStopBinding(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}

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

@ -1299,6 +1299,7 @@ nsXMLContentSink::ProcessCSSStyleLink(nsIContent* aElement,
if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
nsIURI* url = nsnull;
#ifdef NECKO // XXX we need to get passed in the nsILoadGroup here!
// nsILoadGroup* group = mDocument->GetDocumentLoadGroup();
result = NS_NewURI(&url, aHref, mDocumentBaseURL/*, group*/);
#else
nsILoadGroup* LoadGroup = nsnull;
@ -1842,11 +1843,11 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
nsAutoString absURL;
nsIURI* docURL = mDocument->GetDocumentURL();
#ifdef NECKO
// XXX we need to be passed the nsILoadGroup here
#ifdef NECKO // XXX we need to get passed in the nsILoadGroup here!
// nsILoadGroup* group = mDocument->GetDocumentLoadGroup();
rv = NS_NewURI(&url, absURL/*, group*/);
#else
nsIURI* docURL = mDocument->GetDocumentURL();
nsILoadGroup* group = nsnull;
rv = docURL->GetLoadGroup(&group);
if ((NS_OK == rv) && group) {
@ -1856,8 +1857,8 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
else {
rv = NS_NewURL(&url, absURL);
}
#endif
NS_RELEASE(docURL);
#endif
if (NS_OK != rv) {
return rv;
}

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

@ -24,7 +24,9 @@
#include "nsIDeviceContext.h"
#include "nsILinkHandler.h"
#include "nsIStreamListener.h"
#ifndef NECKO
#ifdef NECKO
#include "nsIPrompt.h"
#else
#include "nsINetSupport.h"
#include "nsIRefreshUrl.h"
#endif
@ -133,7 +135,9 @@ class nsWebShell : public nsIWebShell,
public nsILinkHandler,
public nsIScriptContextOwner,
public nsIDocumentLoaderObserver,
#ifndef NECKO
#ifdef NECKO
public nsIPrompt,
#else
public nsIRefreshUrl,
public nsINetSupport,
#endif
@ -216,7 +220,7 @@ public:
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE,
#ifdef NECKO
PRUint32 aType = nsIChannel::LOAD_NORMAL,
nsLoadFlags aType = nsIChannel::LOAD_NORMAL,
#else
nsURLReloadType aType = nsURLReload,
#endif
@ -226,7 +230,7 @@ public:
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE,
#ifdef NECKO
PRUint32 aType = nsIChannel::LOAD_NORMAL,
nsLoadFlags aType = nsIChannel::LOAD_NORMAL,
#else
nsURLReloadType aType = nsURLReload,
#endif
@ -234,7 +238,7 @@ public:
NS_IMETHOD Stop(void);
#ifdef NECKO
NS_IMETHOD Reload(PRUint32 aType);
NS_IMETHOD Reload(nsLoadFlags aType);
#else
NS_IMETHOD Reload(nsURLReloadType aType);
#endif
@ -352,13 +356,21 @@ public:
#if 0
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
#endif /* 0 */
#ifdef NECKO
// nsIPrompt
NS_IMETHOD Alert(const PRUnichar *text);
NS_IMETHOD Confirm(const PRUnichar *text, PRBool *_retval);
NS_IMETHOD ConfirmCheck(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval);
NS_IMETHOD Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval);
NS_IMETHOD PromptUsernameAndPassword(const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval);
NS_IMETHOD PromptPassword(const PRUnichar *text, PRUnichar **pwd, PRBool *_retval);
#else
// nsINetSupport interface methods
NS_IMETHOD_(void) Alert(const nsString &aText);
NS_IMETHOD_(PRBool) Confirm(const nsString &aText);
@ -370,6 +382,7 @@ public:
nsString &aPassword);
NS_IMETHOD_(PRBool) PromptPassword(const nsString &aText,
nsString &aPassword);
#endif
// nsIClipboardCommands
NS_IMETHOD CanCutSelection (PRBool* aResult);
@ -437,7 +450,9 @@ protected:
nsIWidget* mWindow;
nsIDocumentLoader* mDocLoader;
nsIDocumentLoaderObserver* mDocLoaderObserver;
#ifndef NECKO
#ifdef NECKO
nsIPrompt* mPrompter;
#else
nsINetSupport* mNetSupport;
#endif
@ -475,7 +490,7 @@ protected:
const char* aCommand,
nsIPostData* aPostData,
#ifdef NECKO
PRUint32 aType,
nsLoadFlags aType,
#else
nsURLReloadType aType,
#endif
@ -617,6 +632,11 @@ nsWebShell::nsWebShell()
mHintCharsetSource = kCharsetUninitialized;
mForceCharacterSet = "";
mHistoryService = nsnull;
#ifdef NECKO
mPrompter = nsnull;
#else
mNetSupport = nsnull;
#endif
}
nsWebShell::~nsWebShell()
@ -646,7 +666,9 @@ nsWebShell::~nsWebShell()
NS_IF_RELEASE(mPrefs);
NS_IF_RELEASE(mContainer);
NS_IF_RELEASE(mObserver);
#ifndef NECKO
#ifdef NECKO
NS_IF_RELEASE(mPrompter);
#else
NS_IF_RELEASE(mNetSupport);
#endif
@ -787,6 +809,14 @@ nsWebShell::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
#endif
#ifdef NECKO
if (aIID.Equals(nsIPrompt::GetIID())) {
*aInstancePtr = (void*) ((nsIPrompt*)this);
NS_ADDREF_THIS();
return NS_OK;
}
#else
if (aIID.Equals(kINetSupportIID)) {
*aInstancePtr = (void*) ((nsINetSupport*)this);
NS_ADDREF_THIS();
@ -1243,13 +1273,17 @@ NS_IMETHODIMP
nsWebShell::SetObserver(nsIStreamObserver* anObserver)
{
NS_IF_RELEASE(mObserver);
#ifndef NECKO
#ifdef NECKO
NS_IF_RELEASE(mPrompter);
#else
NS_IF_RELEASE(mNetSupport);
#endif
mObserver = anObserver;
if (nsnull != mObserver) {
#ifndef NECKO
#ifdef NECKO
mObserver->QueryInterface(nsIPrompt::GetIID(), (void**)&mPrompter);
#else
mObserver->QueryInterface(kINetSupportIID, (void **) &mNetSupport);
#endif
NS_ADDREF(mObserver);
@ -1700,7 +1734,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData,
PRBool aModifyHistory,
#ifdef NECKO
PRUint32 aType,
nsLoadFlags aType,
#else
nsURLReloadType aType,
#endif
@ -1718,7 +1752,7 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec,
const char* aCommand,
nsIPostData* aPostData,
#ifdef NECKO
PRUint32 aType,
nsLoadFlags aType,
#else
nsURLReloadType aType,
#endif
@ -1833,7 +1867,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData,
PRBool aModifyHistory,
#ifdef NECKO
PRUint32 aType,
nsLoadFlags aType,
#else
nsURLReloadType aType,
#endif
@ -1966,7 +2000,7 @@ NS_IMETHODIMP nsWebShell::Stop(void)
}
#ifdef NECKO
NS_IMETHODIMP nsWebShell::Reload(PRUint32 aType)
NS_IMETHODIMP nsWebShell::Reload(nsLoadFlags aType)
#else
NS_IMETHODIMP nsWebShell::Reload(nsURLReloadType aType)
#endif
@ -3160,12 +3194,12 @@ nsresult nsWebShell::CheckForTrailingSlash(nsIURI* aURL)
#if 0
NS_IMETHODIMP
nsWebShell::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsWebShell::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
nsresult rv = NS_OK;
if (nsnull != mObserver) {
rv = mObserver->OnStartBinding(aURL, aContentType);
rv = mObserver->OnStartRequest(aURL, aContentType);
}
return rv;
}
@ -3216,12 +3250,12 @@ nsWebShell::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
nsWebShell::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsWebShell::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
if (nsnull != mObserver) {
rv = mObserver->OnStopBinding(aURL, aStatus, aMsg);
rv = mObserver->OnStopRequest(aURL, aStatus, aMsg);
}
return rv;
}
@ -3230,11 +3264,18 @@ nsWebShell::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
//----------------------------------------------------------------------
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::Alert(const PRUnichar *text)
#else
NS_IMETHODIMP_(void)
nsWebShell::Alert(const nsString &aText)
#endif
{
#ifdef NECKO
NS_ASSERTION(0, "help");
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->Alert(text);
#else
if (nsnull != mNetSupport) {
mNetSupport->Alert(aText);
@ -3242,69 +3283,117 @@ nsWebShell::Alert(const nsString &aText)
#endif
}
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::Confirm(const PRUnichar *text,
PRBool *result)
#else
NS_IMETHODIMP_(PRBool)
nsWebShell::Confirm(const nsString &aText)
#endif
{
#ifdef NECKO
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->Confirm(text, result);
#else
PRBool bResult = PR_FALSE;
#ifdef NECKO
NS_ASSERTION(0, "help");
#else
if (nsnull != mNetSupport) {
bResult = mNetSupport->Confirm(aText);
}
#endif
return bResult;
#endif
}
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::ConfirmCheck(const PRUnichar *text,
const PRUnichar *checkMsg,
PRBool *checkValue,
PRBool *result)
{
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->ConfirmCheck(text, checkMsg, checkValue, result);
}
#endif
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::Prompt(const PRUnichar *text,
const PRUnichar *defaultText,
PRUnichar **result,
PRBool *_retval)
#else
NS_IMETHODIMP_(PRBool)
nsWebShell::Prompt(const nsString &aText,
const nsString &aDefault,
nsString &aResult)
#endif
{
PRBool bResult = PR_FALSE;
#ifdef NECKO
NS_ASSERTION(0, "help");
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->Prompt(text, defaultText, result, _retval);
#else
PRBool bResult = PR_FALSE;
if (nsnull != mNetSupport) {
bResult = mNetSupport->Prompt(aText, aDefault, aResult);
}
#endif
return bResult;
#endif
}
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::PromptUsernameAndPassword(const PRUnichar *text,
PRUnichar **user,
PRUnichar **pwd,
PRBool *_retval)
#else
NS_IMETHODIMP_(PRBool)
nsWebShell::PromptUserAndPassword(const nsString &aText,
nsString &aUser,
nsString &aPassword)
#endif
{
PRBool bResult = PR_FALSE;
#ifdef NECKO
NS_ASSERTION(0, "help");
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->PromptUsernameAndPassword(text, user, pwd, _retval);
#else
PRBool bResult = PR_FALSE;
if (nsnull != mNetSupport) {
bResult = mNetSupport->PromptUserAndPassword(aText, aUser, aPassword);
}
#endif
return bResult;
#endif
}
#ifdef NECKO
NS_IMETHODIMP
nsWebShell::PromptPassword(const PRUnichar *text,
PRUnichar **pwd,
PRBool *_retval)
#else
NS_IMETHODIMP_(PRBool)
nsWebShell::PromptPassword(const nsString &aText,
nsString &aPassword)
#endif
{
#ifdef NECKO
if (mPrompter == nsnull)
return NS_OK;
return mPrompter->PromptPassword(text, pwd, _retval);
#else
PRBool bResult = PR_FALSE;
#ifdef NECKO
NS_ASSERTION(0, "help");
#else
if (nsnull != mNetSupport) {
bResult = mNetSupport->PromptPassword(aText, aPassword);
}
#endif
return bResult;
#endif
}
//----------------------------------------------------

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

@ -28,6 +28,7 @@
#include "nsIEditorShell.h"
#include "nsIDocumentLoaderObserver.h"
#ifdef NECKO
#include "nsIPrompt.h"
#else
#include "nsINetSupport.h"
#endif

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

@ -28,6 +28,7 @@
#include "nsIEditorShell.h"
#include "nsIDocumentLoaderObserver.h"
#ifdef NECKO
#include "nsIPrompt.h"
#else
#include "nsINetSupport.h"
#endif

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

@ -147,9 +147,9 @@ static int cookie_lock_count = 0;
PRIVATE char*
cookie_Localize(char* genericString) {
#ifdef newI18NFinished
nsresult ret;
nsAutoString v("");
#ifdef newI18NFinished
/* create a URL for the string resource file *//*
nsINetService* pNetService = nsnull;
ret = nsServiceManager::GetService(kNetServiceCID, kINetServiceIID,

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

@ -172,8 +172,34 @@ SI_GetBoolPref(const char * prefname, PRBool defaultvalue) {
}
PRBool
si_PromptUsernameAndPassword
(char *szMessage, char **szUsername, char **szPassword) {
si_PromptUsernameAndPassword(char *szMessage, char **szUsername, char **szPassword)
{
#ifdef NECKO
nsString username;
nsString password;
PRBool retval;
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
const nsString message = szMessage;
PRUnichar* usr;
PRUnichar* pwd;
res = dialog->PromptUsernameAndPassword(message.GetUnicode(), &usr, &pwd, &retval);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
username = usr;
delete[] usr;
password = pwd;
delete[] pwd;
*szUsername = username.ToNewCString();
*szPassword = password.ToNewCString();
return retval;
#else
nsString username;
nsString password;
PRBool retval;
@ -191,10 +217,37 @@ si_PromptUsernameAndPassword
*szUsername = username.ToNewCString();
*szPassword = password.ToNewCString();
return retval;
#endif
}
char*
si_PromptPassword (char *szMessage) {
si_PromptPassword(char *szMessage)
{
#ifdef NECKO
nsString password;
PRBool retval;
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
const nsString message = szMessage;
PRUnichar* pwd;
res = dialog->PromptPassword(message.GetUnicode(), &pwd, &retval);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
password = pwd;
delete[] pwd;
if (retval) {
return password.ToNewCString();
} else {
return NULL; /* user pressed cancel */
}
#else
nsString password;
PRBool retval;
nsINetSupportDialogService* dialog = NULL;
@ -213,10 +266,39 @@ si_PromptPassword (char *szMessage) {
} else {
return NULL; /* user pressed cancel */
}
#endif
}
char*
si_Prompt(char *szMessage, char* szDefaultUsername) {
si_Prompt(char *szMessage, char* szDefaultUsername)
{
#ifdef NECKO
nsString defaultUsername = szDefaultUsername;
nsString username;
PRBool retval;
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
const nsString message = szMessage;
PRUnichar* usr;
res = dialog->Prompt(message.GetUnicode(), defaultUsername.GetUnicode(),
&usr, &retval);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
username = usr;
delete[] usr;
if (retval) {
return username.ToNewCString();
} else {
return NULL; /* user pressed cancel */
}
#else
nsString defaultUsername = szDefaultUsername;
nsString username;
PRBool retval;
@ -236,12 +318,38 @@ si_Prompt(char *szMessage, char* szDefaultUsername) {
} else {
return NULL; /* user pressed cancel */
}
#endif
}
PRBool
si_SelectDialog
(const char* szMessage, char** pList, int16* pCount)
si_SelectDialog(const char* szMessage, char** pList, int16* pCount)
{
#ifdef NECKO
PRBool retval = PR_TRUE; /* default value */
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return NULL; /* failure value */
}
const nsString message = szMessage;
#ifdef xxx
dialog->Select(message, pList, pCount, &retval);
#else
for (int i=0; i<*pCount; i++) {
nsString msg = "user = ";
msg += pList[i];
msg += "?";
res = dialog->Confirm(msg.GetUnicode(), &retval);
if (NS_SUCCEEDED(res) && retval) {
*pCount = i;
break;
}
}
#endif
return retval;
#else
PRBool retval = PR_TRUE; /* default value */
nsINetSupportDialogService* dialog = NULL;
nsresult res = nsServiceManager::GetService(kNetSupportDialogCID,
@ -268,6 +376,7 @@ si_SelectDialog
}
nsServiceManager::ReleaseService(kNetSupportDialogCID, dialog);
return retval;
#endif
}
/*

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

@ -420,7 +420,25 @@ Wallet_Localize(char* genericString) {
/**********************/
PUBLIC PRBool
Wallet_Confirm(char * szMessage) {
Wallet_Confirm(char * szMessage)
{
#ifdef NECKO
PRBool retval = PR_TRUE; /* default value */
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return retval;
}
const nsString message = szMessage;
res = dialog->Confirm(message.GetUnicode(), &retval);
if (NS_FAILED(res)) {
return retval;
}
return retval;
#else
PRBool retval = PR_TRUE; /* default value */
nsINetSupportDialogService* dialog = NULL;
nsresult res = nsServiceManager::GetService(kNetSupportDialogCID,
@ -434,10 +452,23 @@ Wallet_Confirm(char * szMessage) {
}
nsServiceManager::ReleaseService(kNetSupportDialogCID, dialog);
return retval;
#endif
}
PUBLIC void
Wallet_Alert(char * szMessage) {
Wallet_Alert(char * szMessage)
{
#ifdef NECKO
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return; // XXX should return the error
}
const nsString message = szMessage;
res = dialog->Alert(message.GetUnicode());
return; // XXX should return the error
#else
nsINetSupportDialogService* dialog = NULL;
nsresult res = nsServiceManager::GetService(kNetSupportDialogCID,
nsINetSupportDialogService::GetIID(), (nsISupports**)&dialog);
@ -450,10 +481,33 @@ Wallet_Alert(char * szMessage) {
}
nsServiceManager::ReleaseService(kNetSupportDialogCID, dialog);
return;
#endif
}
PUBLIC PRBool
Wallet_CheckConfirm(char * szMessage, char * szCheckMessage, PRBool* checkValue) {
Wallet_CheckConfirm(char * szMessage, char * szCheckMessage, PRBool* checkValue)
{
#ifdef NECKO
PRBool retval = PR_TRUE; /* default value */
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
*checkValue = 0;
return retval;
}
const nsString message = szMessage;
const nsString checkMessage = szCheckMessage;
res = dialog->ConfirmCheck(message.GetUnicode(), checkMessage.GetUnicode(), checkValue, &retval);
if (NS_FAILED(res)) {
*checkValue = 0;
}
if (*checkValue!=0 && *checkValue!=1) {
*checkValue = 0; /* this should never happen but it is happening!!! */
}
return retval;
#else
PRBool retval = PR_TRUE; /* default value */
nsINetSupportDialogService* dialog = NULL;
nsresult res = nsServiceManager::GetService(kNetSupportDialogCID,
@ -471,9 +525,36 @@ Wallet_CheckConfirm(char * szMessage, char * szCheckMessage, PRBool* checkValue)
}
nsServiceManager::ReleaseService(kNetSupportDialogCID, dialog);
return retval;
#endif
}
char * wallet_GetString(char * szMessage) {
char * wallet_GetString(char * szMessage)
{
#ifdef NECKO
nsString password;
PRBool retval;
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return NULL; // XXX should return the error
}
const nsString message = szMessage;
PRUnichar* pwd;
res = dialog->PromptPassword(message.GetUnicode(), &pwd, &retval);
if (NS_FAILED(res)) {
return NULL;
}
password = pwd;
delete[] pwd;
if (retval) {
return password.ToNewCString();
} else {
return NULL; /* user pressed cancel */
}
#else
nsString password;
PRBool retval;
nsINetSupportDialogService* dialog = NULL;
@ -492,6 +573,7 @@ char * wallet_GetString(char * szMessage) {
} else {
return NULL; /* user pressed cancel */
}
#endif
}
/**********************************************************************************/

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

@ -110,19 +110,17 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRUint32 length);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
void Interrupt();
@ -185,9 +183,9 @@ ImageConsumer::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
ImageConsumer::OnStartBinding(nsISupports* aContext)
ImageConsumer::OnStartRequest(nsISupports* aContext)
#else
ImageConsumer::OnStartBinding(nsIURI* aURL, const char *aContentType)
ImageConsumer::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
if (mInterrupted) {
@ -311,16 +309,16 @@ ImageConsumer::KeepPumpingStream(nsITimer *aTimer, void *aClosure)
if (consumer->mURL) {
consumer->mURL->QueryInterface(kIURLIID, (void**)&url);
}
consumer->OnStopBinding(url, NS_BINDING_SUCCEEDED, status.GetUnicode());
consumer->OnStopRequest(url, NS_BINDING_SUCCEEDED, status.GetUnicode());
NS_IF_RELEASE(url);
}
NS_IMETHODIMP
#ifdef NECKO
ImageConsumer::OnStopBinding(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
ImageConsumer::OnStopRequest(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
#else
ImageConsumer::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
ImageConsumer::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
if (mTimer != nsnull) {

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

@ -134,22 +134,20 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
#else
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 Progress, PRUint32 ProgressMax) { return NS_OK; }
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
};
#ifdef NECKO
NS_IMETHODIMP CStreamListener::OnStopBinding(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
NS_IMETHODIMP CStreamListener::OnStopRequest(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
#else
NS_IMETHODIMP CStreamListener::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
NS_IMETHODIMP CStreamListener::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
fputs("done.\n",stdout);

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

@ -51,7 +51,7 @@ static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID);
static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
static const char* kNullURL = "Error: Null URL given";
static const char* kOnStartNotCalled = "Error: OnStartBinding() must be called before OnDataAvailable()";
static const char* kOnStartNotCalled = "Error: OnStartRequest() must be called before OnDataAvailable()";
static const char* kBadListenerInit = "Error: Parser's IStreamListener API was not setup correctly in constructor.";
//-------------------------------------------------------------------
@ -1035,18 +1035,18 @@ nsParser::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
* @return error code -- 0 if ok, non-zero if error.
*/
#ifdef NECKO
nsresult nsParser::OnStartBinding(nsISupports* aContext)
nsresult nsParser::OnStartRequest(nsISupports* aContext)
#else
nsresult nsParser::OnStartBinding(nsIURI* aURL, const char *aSourceType)
nsresult nsParser::OnStartRequest(nsIURI* aURL, const char *aSourceType)
#endif
{
NS_PRECONDITION((eNone==mParserContext->mStreamListenerState),kBadListenerInit);
if (nsnull != mObserver) {
#ifdef NECKO
mObserver->OnStartBinding(aContext);
mObserver->OnStartRequest(aContext);
#else
mObserver->OnStartBinding(aURL, aSourceType);
mObserver->OnStartRequest(aURL, aSourceType);
#endif
}
mParserContext->mStreamListenerState=eOnStart;
@ -1077,20 +1077,6 @@ nsresult nsParser::OnStartBinding(nsIURI* aURL, const char *aSourceType)
return NS_OK;
}
#ifdef NECKO
NS_IMETHODIMP
nsParser::OnStartRequest(nsISupports *ctxt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsParser::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif // NECKO
/**
*
*
@ -1173,9 +1159,9 @@ nsresult nsParser::OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRUin
* @return
*/
#ifdef NECKO
nsresult nsParser::OnStopBinding(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
nsresult nsParser::OnStopRequest(nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
#else
nsresult nsParser::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
nsresult nsParser::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
mParserContext->mStreamListenerState=eOnStop;
@ -1193,9 +1179,9 @@ nsresult nsParser::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar*
// parser isn't yet enabled?
if (nsnull != mObserver) {
#ifdef NECKO
mObserver->OnStopBinding(aContext, status, aMsg);
mObserver->OnStopRequest(aContext, status, aMsg);
#else
mObserver->OnStopBinding(aURL, status, aMsg);
mObserver->OnStopRequest(aURL, status, aMsg);
#endif
}

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

@ -244,8 +244,6 @@ friend class CTokenHandler;
NS_IMETHOD OnProgress(nsISupports* context, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsISupports* context, const PRUnichar* aMmsg);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
@ -254,9 +252,9 @@ friend class CTokenHandler;
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMmsg);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRUint32 length);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
void PushContext(CParserContext& aContext);

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

@ -53,9 +53,9 @@ public:
NS_IMETHOD GetBindInfo(nsIURI* aURL);
NS_IMETHOD OnProgress(nsIURI* aURL, PRInt32 Progress, PRInt32 ProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(nsIURI* aURL, PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, PRInt32 status, const nsString& aMsg);
PRBool IsDone() const { return mDone; }
PRBool HaveError() const { return mError; }
@ -104,7 +104,7 @@ StreamToFile::OnStatus(nsIURI* aURL, const nsString& aMsg)
}
NS_IMETHODIMP
StreamToFile::OnStartBinding(nsIURI* aURL, const char *aContentType)
StreamToFile::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
return 0;
}
@ -128,7 +128,7 @@ StreamToFile::OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream,
NS_IMETHODIMP
StreamToFile::OnStopBinding(nsIURI* aURL, PRInt32 status, const nsString& aMsg)
StreamToFile::OnStopRequest(nsIURI* aURL, PRInt32 status, const nsString& aMsg)
{
mDone = PR_TRUE;
if (0 != status) {

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

@ -64,18 +64,16 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
// nsIStreamListener
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus,
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream* aStream,
@ -607,9 +605,9 @@ NS_IMPL_ISUPPORTS(PluginListener, kIStreamListenerIID)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStartBinding(nsISupports *ctxt)
PluginListener::OnStartRequest(nsISupports *ctxt)
#else
PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
PluginListener::OnStartRequest(nsIURI* aURL, const char *contentType)
#endif
{
#ifdef NECKO
@ -634,9 +632,9 @@ PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStartBinding(ctxt);
return mNextStream->OnStartRequest(ctxt);
#else
return mNextStream->OnStartBinding(aURL, contentType);
return mNextStream->OnStartRequest(aURL, contentType);
#endif
}
@ -663,9 +661,9 @@ PluginListener::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
PluginListener::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
#else
PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
PluginListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
@ -673,9 +671,9 @@ PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStopBinding(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
return mNextStream->OnStopBinding(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}

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

@ -77,16 +77,14 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
#else
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
protected:
@ -1107,9 +1105,9 @@ TempObserver::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
TempObserver::OnStartBinding(nsISupports *ctxt)
TempObserver::OnStartRequest(nsISupports *ctxt)
#else
TempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
TempObserver::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
#if 0
@ -1122,9 +1120,9 @@ TempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP
#ifdef NECKO
TempObserver::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
TempObserver::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
#else
TempObserver::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
TempObserver::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
#if 0

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

@ -77,16 +77,14 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
#else
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
protected:
@ -1107,9 +1105,9 @@ TempObserver::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
TempObserver::OnStartBinding(nsISupports *ctxt)
TempObserver::OnStartRequest(nsISupports *ctxt)
#else
TempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
TempObserver::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
#if 0
@ -1122,9 +1120,9 @@ TempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP
#ifdef NECKO
TempObserver::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
TempObserver::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
#else
TempObserver::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
TempObserver::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
#if 0

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

@ -31,6 +31,9 @@
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIViewManager.h"
#ifdef NECKO
#include "nsIChannel.h"
#endif
// XXX TODO:
@ -79,17 +82,15 @@ public:
NS_DECL_ISUPPORTS
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus,
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream* aStream,
@ -117,15 +118,23 @@ NS_IMPL_ISUPPORTS(ImageListener, kIStreamListenerIID)
NS_IMETHODIMP
#ifdef NECKO
ImageListener::OnStartBinding(nsISupports *ctxt)
ImageListener::OnStartRequest(nsISupports *ctxt)
#else
ImageListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
ImageListener::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
#ifdef NECKO
nsresult rv;
nsIChannel* channel;
rv = ctxt->QueryInterface(nsIChannel::GetIID(), (void**)&channel);
if (NS_FAILED(rv)) return rv;
nsIURI* uri;
rv = channel->GetURI(&uri);
if (NS_FAILED(rv)) return rv;
mDocument->StartImageLoad(uri, mNextStream);
NS_RELEASE(uri);
NS_RELEASE(channel);
#else
mDocument->StartImageLoad(aURL, mNextStream);
#endif
@ -133,9 +142,9 @@ ImageListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStartBinding(ctxt);
return mNextStream->OnStartRequest(ctxt);
#else
return mNextStream->OnStartBinding(aURL, aContentType);
return mNextStream->OnStartRequest(aURL, aContentType);
#endif
}
@ -162,10 +171,10 @@ ImageListener::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
ImageListener::OnStopBinding(nsISupports *ctxt, nsresult status,
ImageListener::OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg)
#else
ImageListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
ImageListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
@ -173,9 +182,9 @@ ImageListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStopBinding(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
return mNextStream->OnStopBinding(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}

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

@ -1632,9 +1632,9 @@ EnderTempObserver::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
EnderTempObserver::OnStartBinding(nsISupports *ctxt)
EnderTempObserver::OnStartRequest(nsISupports *ctxt)
#else
EnderTempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
EnderTempObserver::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
return NS_OK;
@ -1642,10 +1642,10 @@ EnderTempObserver::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP
#ifdef NECKO
EnderTempObserver::OnStopBinding(nsISupports *ctxt, nsresult status,
EnderTempObserver::OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg)
#else
EnderTempObserver::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
EnderTempObserver::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
if (PR_TRUE==mFirstCall)

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

@ -55,16 +55,14 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
#else
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
#endif
protected:

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

@ -1299,6 +1299,7 @@ nsXMLContentSink::ProcessCSSStyleLink(nsIContent* aElement,
if ((0 == mimeType.Length()) || mimeType.EqualsIgnoreCase("text/css")) {
nsIURI* url = nsnull;
#ifdef NECKO // XXX we need to get passed in the nsILoadGroup here!
// nsILoadGroup* group = mDocument->GetDocumentLoadGroup();
result = NS_NewURI(&url, aHref, mDocumentBaseURL/*, group*/);
#else
nsILoadGroup* LoadGroup = nsnull;
@ -1842,11 +1843,11 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
// Use the SRC attribute value to load the URL
nsIURI* url = nsnull;
nsAutoString absURL;
nsIURI* docURL = mDocument->GetDocumentURL();
#ifdef NECKO
// XXX we need to be passed the nsILoadGroup here
#ifdef NECKO // XXX we need to get passed in the nsILoadGroup here!
// nsILoadGroup* group = mDocument->GetDocumentLoadGroup();
rv = NS_NewURI(&url, absURL/*, group*/);
#else
nsIURI* docURL = mDocument->GetDocumentURL();
nsILoadGroup* group = nsnull;
rv = docURL->GetLoadGroup(&group);
if ((NS_OK == rv) && group) {
@ -1856,8 +1857,8 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
else {
rv = NS_NewURL(&url, absURL);
}
#endif
NS_RELEASE(docURL);
#endif
if (NS_OK != rv) {
return rv;
}

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

@ -167,7 +167,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIURI* aURL, nsIInpu
rv = mDestination->CopyData(aIStream, aLength);
return rv;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
nsCOMPtr<nsIMessage> message;
nsresult rv;
@ -190,7 +190,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnStatus(nsIURI* aURL, const PRUnicha
return NS_OK;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
PRBool copySucceeded = (aStatus == NS_BINDING_SUCCEEDED);

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

@ -40,13 +40,13 @@ public:
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream,
PRUint32 aLength);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
protected:
nsCOMPtr<nsICopyMessageListener> mDestination;

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

@ -142,14 +142,14 @@ NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStr
return ProcessProtocolState(aURL, aIStream, aLength);
}
NS_IMETHODIMP nsMsgProtocol::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
nsCOMPtr <nsIMsgMailNewsUrl> aMsgUrl = do_QueryInterface(aURL);
return aMsgUrl->SetUrlState(PR_TRUE, NS_OK);
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgProtocol::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsCOMPtr <nsIMsgMailNewsUrl> aMsgUrl = do_QueryInterface(aURL);
return aMsgUrl->SetUrlState(PR_FALSE, aStatus);

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

@ -48,11 +48,11 @@ public:
// I expect most protocols to override this method AND call into the base class
// the base class takes the url and sets the state of the url passed in to be running
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
// the base class implementation takes the url and sets the url state to NOT running.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
// Ideally, a protocol should only have to support the stream listener methods covered above.
// However, we don't have this nsIStreamListenerLite interface defined yet. Until then, we are using

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

@ -33,7 +33,11 @@ nsMsgDisplayMessageByID(PRInt32 msgID)
if (!msg)
return NS_ERROR_FAILURE;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
@ -61,7 +65,11 @@ nsMsgDisplayMessageByString(char *msg)
if ((!msg) || (!*msg))
return NS_ERROR_FAILURE;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
@ -90,7 +98,11 @@ nsMsgAskBooleanQuestionByID(PRInt32 msgID, PRBool *answer)
if (!msg)
return NS_ERROR_FAILURE;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
@ -121,7 +133,11 @@ nsMsgAskBooleanQuestionByID(char *msg, PRBool *answer)
if ((!msg) || (!*msg))
return NS_ERROR_FAILURE;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;

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

@ -243,7 +243,7 @@ SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
}
// Assuming this is an RFC822 message...
mimeParser->OnStartBinding(aURL, MESSAGE_RFC822);
mimeParser->OnStartRequest(aURL, MESSAGE_RFC822);
// Just pump all of the data from the file into libmime...
while (NS_SUCCEEDED(fileStream->PumpFileStream()))
@ -253,7 +253,7 @@ SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
mimeParser->OnDataAvailable(aURL, in, len);
}
mimeParser->OnStopBinding(aURL, NS_OK, nsnull);
mimeParser->OnStopRequest(aURL, NS_OK, nsnull);
in->Close();
ptr->mTmpFileSpec->Delete(PR_FALSE);
NS_RELEASE(ptr);

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

@ -293,9 +293,9 @@ const char * nsSmtpProtocol::GetUserDomainName()
////////////////////////////////////////////////////////////////////////////////////////////
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsSmtpProtocol::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsMsgProtocol::OnStopBinding(aURL, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(aURL, aStatus, aMsg);
// okay, we've been told that the send is done and the connection is going away. So
// we need to release all of our state

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

@ -81,7 +81,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
private:
// Smtp Event Sinks

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

@ -163,10 +163,10 @@ nsURLFetcher::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream,
* used to cancel the URL load..
*/
nsresult
nsURLFetcher::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsURLFetcher::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
#ifdef NS_DEBUG_richie
printf("nsURLFetcher::OnStartBinding() for Content-Type: %s\n", aContentType);
printf("nsURLFetcher::OnStartRequest() for Content-Type: %s\n", aContentType);
#endif
if (aContentType)
@ -216,10 +216,10 @@ nsURLFetcher::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
* @return The return value is currently ignored.
*/
nsresult
nsURLFetcher::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsURLFetcher::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_richie
printf("nsURLFetcher::OnStopBinding()\n");
printf("nsURLFetcher::OnStopRequest()\n");
#endif
//

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

@ -81,7 +81,7 @@ public:
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
/**
* Notify the observer that progress as occurred for the URL load.<BR>
@ -104,7 +104,7 @@ public:
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
private:

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

@ -155,10 +155,10 @@ nsURLFetcher::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream,
* used to cancel the URL load..
*/
nsresult
nsURLFetcher::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsURLFetcher::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
#ifdef NS_DEBUG_richie
printf("nsURLFetcher::OnStartBinding() for Content-Type: %s\n", aContentType);
printf("nsURLFetcher::OnStartRequest() for Content-Type: %s\n", aContentType);
#endif
return NS_OK;
@ -205,10 +205,10 @@ nsURLFetcher::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
* @return The return value is currently ignored.
*/
nsresult
nsURLFetcher::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsURLFetcher::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_richie
printf("nsURLFetcher::OnStopBinding()\n");
printf("nsURLFetcher::OnStopRequest()\n");
#endif
//

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

@ -78,7 +78,7 @@ public:
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
/**
* Notify the observer that progress as occurred for the URL load.<BR>
@ -101,7 +101,7 @@ public:
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
private:

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

@ -945,7 +945,7 @@ NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIURI* aURL, nsIInputStream *aISt
return res;
}
NS_IMETHODIMP nsImapProtocol::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
PR_CEnterMonitor(this);
nsresult rv = NS_OK;
@ -957,7 +957,7 @@ NS_IMETHODIMP nsImapProtocol::OnStartBinding(nsIURI* aURL, const char *aContentT
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsImapProtocol::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
PR_CEnterMonitor(this);
nsresult rv = NS_OK;

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

@ -87,10 +87,10 @@ public:
// OnDataAvailable. We then read and process the incoming data from the input stream.
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
// Ideally, a protocol should only have to support the stream listener methods covered above.
// However, we don't have this nsIStreamListenerLite interface defined yet. Until then, we are using

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

@ -92,7 +92,7 @@ void nsMailboxProtocol::Initialize(nsIURI * aURL)
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsMailboxProtocol::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
// 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
@ -101,26 +101,26 @@ NS_IMETHODIMP nsMailboxProtocol::OnStartBinding(nsIURI* aURL, const char *aConte
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
{
// we need to inform our mailbox parser that it's time to start...
m_mailboxParser->OnStartBinding(aURL, aContentType);
m_mailboxParser->OnStartRequest(aURL, aContentType);
}
else if(m_mailboxCopyHandler)
m_mailboxCopyHandler->OnStartBinding(aURL, aContentType);
m_mailboxCopyHandler->OnStartRequest(aURL, aContentType);
return NS_OK;
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMailboxProtocol::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIURI* aURL, 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->OnStopBinding(aURL, 0, nsnull);
m_mailboxParser->OnStopRequest(aURL, 0, nsnull);
}
else if (m_mailboxCopyHandler)
m_mailboxCopyHandler->OnStopBinding(aURL, 0, nsnull);
m_mailboxCopyHandler->OnStopRequest(aURL, 0, nsnull);
else if (m_nextState == MAILBOX_READ_MESSAGE)
{
DoneReadingMessage();
@ -148,7 +148,7 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopBinding(nsIURI* aURL, nsresult aStatus, c
// is coming from netlib so they are never going to ping us again with on data available. This means
// we'll never be going through the Process loop...
nsMsgProtocol::OnStopBinding(aURL, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(aURL, aStatus, aMsg);
return CloseSocket();
}
@ -293,7 +293,7 @@ PRInt32 nsMailboxProtocol::ReadFolderResponse(nsIInputStream * inputStream, PRUi
// leave our state alone so when the next chunk of the mailbox comes in we jump to this state
// and repeat....how does this process end? Well when the file is done being read in, core net lib
// will issue an ::OnStopBinding to us...we'll use that as our sign to drop out of this state and to
// will issue an ::OnStopRequest to us...we'll use that as our sign to drop out of this state and to
// close the protocol instance...
return 0;

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

@ -86,10 +86,10 @@ public:
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
////////////////////////////////////////////////////////////////////////////////////////

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

@ -59,14 +59,14 @@ NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIURI* aURL, nsIInputStream *
return NS_OK;
}
NS_IMETHODIMP nsMsgMailboxParser::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
// extract the appropriate event sinks from the url and initialize them in our protocol data
// the URL should be queried for a nsIMailboxURL. If it doesn't support a mailbox URL interface then
// we have an error.
nsresult rv = NS_OK;
nsCOMPtr<nsIMailboxUrl> runningUrl = do_QueryInterface(aURL, &rv);
printf("\n+++ nsMsgMailboxParser::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
printf("\n+++ nsMsgMailboxParser::OnStartRequest: URL: %p, Content type: %s\n", aURL, aContentType);
if (NS_SUCCEEDED(rv) && runningUrl)
{
@ -99,7 +99,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartBinding(nsIURI* aURL, const char *aCont
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgMailboxParser::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
DoneParsingFolder();
// what can we do? we can close the stream?
@ -1361,7 +1361,7 @@ nsParseNewMailState::Init(nsIFolder *rootFolder, nsFileSpec &folder, nsIOFileStr
m_inboxFileStream = inboxFileStream;
#endif
// the new mail parser isn't going to get the stream input, it seems, so we can't use
// the OnStartBinding mechanism the mailbox parser uses. So, let's open the db right now.
// the OnStartRequest mechanism the mailbox parser uses. So, let's open the db right now.
nsCOMPtr<nsIMsgDatabase> mailDB;
rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, nsIMsgDatabase::GetIID(), (void **) getter_AddRefs(mailDB));
if (NS_SUCCEEDED(rv) && mailDB)

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

@ -176,10 +176,10 @@ public:
// OnDataAvailable. We then read and process the incoming data from the input stream.
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
// Ideally, a protocol should only have to support the stream listener methods covered above.
// However, we don't have this nsIStreamListenerLite interface defined yet. Until then, we are using

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

@ -2648,7 +2648,7 @@ nsresult nsPop3Protocol::ProcessProtocolState (nsIURI* aURL, nsIInputStream* aIn
m_nsIPop3Sink->EndMailDelivery();
if (m_transport)
m_transport->OnStopBinding(mailnewsurl, 0, nsnull);
m_transport->OnStopRequest(mailnewsurl, 0, nsnull);
if (mailnewsurl)
mailnewsurl->SetUrlState(PR_FALSE, NS_OK);
@ -2715,7 +2715,7 @@ nsresult nsPop3Protocol::ProcessProtocolState (nsIURI* aURL, nsIInputStream* aIn
m_pop3ConData->next_state = POP3_FREE;
if (m_transport)
m_transport->OnStopBinding(mailnewsurl, 0, nsnull);
m_transport->OnStopRequest(mailnewsurl, 0, nsnull);
if (mailnewsurl)
mailnewsurl->SetUrlState(PR_FALSE, NS_ERROR_FAILURE);

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

@ -168,7 +168,7 @@ nsPop3Sink::EndMailDelivery()
{
if (m_outFileStream)
m_outFileStream->flush(); // try this.
m_newMailParser->OnStopBinding(nsnull, NS_OK, nsnull);
m_newMailParser->OnStopRequest(nsnull, NS_OK, nsnull);
delete m_newMailParser;
m_newMailParser = NULL;
}

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

@ -39,7 +39,7 @@
// Oh one more thing. Data is passed from the mailbox protocol to the mailbox parse
// through calls to ::OnDataAvailable which provides the mailbox parser with the url,
// stream and the number of bytes available to be read.
// A call to ::OnStopBinding is a signal to the mailbox parser that you've reached
// A call to ::OnStopRequest is a signal to the mailbox parser that you've reached
// the end of the file.
//////////////////////////////////////////////////////////////////////////////////
@ -203,8 +203,8 @@ public:
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo) { return NS_OK;}
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
////////////////////////////////////////////////////////////////////////////////////////
// End of nsIStreamListenerSupport
@ -597,7 +597,7 @@ NS_IMETHODIMP nsMailboxTestDriver::OnDataAvailable(nsIURI* aURL, nsIInputStream
return NS_OK;
}
NS_IMETHODIMP nsMailboxTestDriver::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsMailboxTestDriver::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
nsIMailboxUrl * mailboxUrl = nsnull;
if (aURL)
@ -615,7 +615,7 @@ NS_IMETHODIMP nsMailboxTestDriver::OnStartBinding(nsIURI* aURL, const char *aCon
return NS_OK;
}
NS_IMETHODIMP nsMailboxTestDriver::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMailboxTestDriver::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsIMailboxUrl * mailboxUrl = nsnull;
if (aURL)

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

@ -45,9 +45,9 @@ public:
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* info);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream *pIStream, PRUint32 length);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg);
protected:
~nsMsgMailboxParserStub();
@ -88,9 +88,9 @@ NS_IMETHODIMP nsMsgMailboxParserStub::OnStatus(nsIURI* aURL, const PRUnichar* aM
return 0;
}
NS_IMETHODIMP nsMsgMailboxParserStub::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsMsgMailboxParserStub::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
printf("\n+++ nsMsgMailboxParserStub::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
printf("\n+++ nsMsgMailboxParserStub::OnStartRequest: URL: %p, Content type: %s\n", aURL, aContentType);
return 0;
}
@ -127,11 +127,11 @@ NS_IMETHODIMP nsMsgMailboxParserStub::OnDataAvailable(nsIURI* aURL, nsIInputStre
}
NS_IMETHODIMP nsMsgMailboxParserStub::OnStopBinding(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
NS_IMETHODIMP nsMsgMailboxParserStub::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
{
// on stop binding is called by the mailbox protocol when there is no more data forthcoming...
printf("\n+++ nsMsgMailboxParserStub::OnStopBinding... URL: %p status: %d\n", aURL, status);
printf("\n+++ nsMsgMailboxParserStub::OnStopRequest... URL: %p status: %d\n", aURL, status);
/* The document has been loaded, so drop out of the message pump... */
return 0;

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

@ -339,10 +339,10 @@ nsStreamConverter::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream,
* used to cancel the URL load..
*/
nsresult
nsStreamConverter::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsStreamConverter::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
#ifdef NS_DEBUG
// printf("nsStreamConverter::OnStartBinding() for Content-Type: %s\n", aContentType);
// printf("nsStreamConverter::OnStartRequest() for Content-Type: %s\n", aContentType);
#endif
return NS_OK;
@ -386,10 +386,10 @@ nsStreamConverter::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
* @return The return value is currently ignored.
*/
nsresult
nsStreamConverter::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsStreamConverter::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG
// printf("nsStreamConverter::OnStopBinding()\n");
// printf("nsStreamConverter::OnStopRequest()\n");
#endif
//

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

@ -84,7 +84,7 @@ public:
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
/**
* Notify the observer that progress as occurred for the URL load.<BR>
@ -107,7 +107,7 @@ public:
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
////////////////////////////////////////////////////////////////////////////
// nsStreamConverter specific methods:

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

@ -442,7 +442,7 @@ DoRFC822toHTMLConversion(char *filename)
}
// Assuming this is an RFC822 message...
mimeParser->OnStartBinding(aURL, MESSAGE_RFC822);
mimeParser->OnStartRequest(aURL, MESSAGE_RFC822);
// Just pump all of the data from the file into libmime...
while (NS_SUCCEEDED(in->PumpFileStream()))
@ -452,7 +452,7 @@ DoRFC822toHTMLConversion(char *filename)
mimeParser->OnDataAvailable(aURL, in, len);
}
mimeParser->OnStopBinding(aURL, NS_OK, nsnull);
mimeParser->OnStopRequest(aURL, NS_OK, nsnull);
NS_RELEASE(aURL);
return NS_OK;
}

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

@ -797,9 +797,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::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
{
nsMsgProtocol::OnStopBinding(aURL, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(aURL, aStatus, aMsg);
// okay, we've been told that the send is done and the connection is going away. So
// we need to release all of our state
@ -3728,7 +3728,11 @@ PRInt32 nsNNTPProtocol::Cancel()
old_from = m_cancelFromHdr;
id = m_cancelID;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kCNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService,dialog,kCNetSupportDialogCID,&rv);
#endif
if (NS_FAILED(rv)) return -1; /* unable to get the dialog service */
PR_ASSERT (id && newsgroups);
@ -4883,9 +4887,9 @@ nsresult nsNNTPProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inp
// cache so we aren't creating new connections to process each request...
// but until that time, we always want to properly shutdown the connection
// SendData(m_runningURL, "quit"CRLF); // this will cause OnStopBinding to get called
// SendData(m_runningURL, "quit"CRLF); // this will cause OnStopRequest to get called
if (m_transport)
m_transport->OnStopBinding(mailnewsurl, 0, nsnull);
m_transport->OnStopRequest(mailnewsurl, 0, nsnull);
CloseSocket();
return NS_OK;
//SetFlag(NNTP_PAUSE_FOR_READ);

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

@ -164,7 +164,7 @@ public:
virtual nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer = nsnull);
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
char * m_ProxyServer; /* proxy server hostname */

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

@ -743,7 +743,11 @@ NS_IMETHODIMP nsNntpService::CancelMessages(const char *hostname, const char *ne
if (!hostname) return NS_ERROR_NULL_POINTER;
if (PL_strlen(hostname) == 0) return NS_ERROR_FAILURE;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kCNetSupportDialogCID, &rv);
#else
NS_WITH_SERVICE(nsINetSupportDialogService,dialog,kCNetSupportDialogCID,&rv);
#endif
if (NS_FAILED(rv)) return rv;
if (!messages) {

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

@ -25,7 +25,11 @@
#include "nsIFactory.h"
#include "nsIComponentManager.h"
#ifdef XP_MAC
#ifdef NECKO
#include "nsIPrompt.h"
#else
#include "nsINetSupport.h"
#endif
#include "nsIStreamListener.h"
#endif /* XP_MAC */
#include "nsIServiceManager.h"

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

@ -392,23 +392,21 @@ public:
NS_IMETHOD OnProgress(nsISupports* context, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsISupports* context, const PRUnichar* aMmsg);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
//nsIStreamObserver interface
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
//nsIStreamListener interface
@ -449,10 +447,10 @@ private:
nsPluginStreamType mStreamType;
nsIPluginHost *mHost;
PRBool mGotProgress;
PRBool mOnStartBinding;
PRBool mOnStartRequest;
PRBool mCacheDone;
PRBool mOnStopBinding;
PRBool mOnStopRequest;
nsresult mStatus;
#ifdef USE_CACHE
@ -480,27 +478,24 @@ public:
NS_IMETHOD OnStatus(nsISupports* context, const PRUnichar* aMsg);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg) { return NS_OK; }
const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count);
PRUint32 sourceOffset, PRUint32 count);
#else
//nsIStreamObserver interface
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
//nsIStreamListener interface
@ -564,7 +559,7 @@ NS_IMPL_ISUPPORTS(nsPluginCacheListener, kIStreamListenerIID);
#ifdef NECKO
NS_IMETHODIMP
nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
nsPluginCacheListener::OnStartRequest(nsISupports* ctxt)
{
char* aContentType = nsnull;
nsIURI* aURL = nsnull;
@ -579,7 +574,7 @@ nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
}
// I have delibrately left out the remaining processing.
// which should just be copied over from the other version of
// OnStartBinding.
// OnStartRequest.
if (aContentType)
nsCRT::free(aContentType);
@ -588,7 +583,7 @@ nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
}
#else
NS_IMETHODIMP
nsPluginCacheListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsPluginCacheListener::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
#ifdef USE_CACHE
nsString urlString;
@ -697,11 +692,11 @@ nsPluginCacheListener::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream, P
NS_IMETHODIMP
#ifdef NECKO
nsPluginCacheListener::OnStopBinding(nsISupports* aContext,
nsPluginCacheListener::OnStopRequest(nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aMsg)
#else
nsPluginCacheListener::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsPluginCacheListener::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
#endif // NECKO
{
#ifdef USE_CACHE
@ -772,10 +767,10 @@ nsPluginStreamListenerPeer::nsPluginStreamListenerPeer()
mSetUpListener = PR_FALSE;
mHost = nsnull;
mGotProgress = PR_FALSE;
mOnStartBinding = PR_FALSE;
mOnStartRequest = PR_FALSE;
mStreamType = nsPluginStreamType_Normal;
mOnStopBinding = PR_FALSE;
mOnStopRequest = PR_FALSE;
mCacheDone = PR_FALSE;
mStatus = NS_OK;
}
@ -935,9 +930,9 @@ nsresult nsPluginStreamListenerPeer::InitializeFullPage(nsIPluginInstance *aInst
#ifdef NECKO
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsISupports* aContext)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsISupports* aContext)
#else
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
nsresult rv = NS_OK;
@ -993,7 +988,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsIURI* aURL, const cha
if(mGotProgress == PR_TRUE && mSetUpListener == PR_FALSE)
rv = SetUpStreamListener(aURL);
mOnStartBinding = PR_TRUE;
mOnStartRequest = PR_TRUE;
#ifdef NECKO
nsCRT::free(aContentType);
#endif //NECKO
@ -1021,7 +1016,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIURI* aURL, PRUint32 aPro
if (NS_FAILED(rv)) return rv;
#endif
mPluginStreamInfo->SetLength(aProgressMax);
if(mOnStartBinding == PR_TRUE && mSetUpListener == PR_FALSE)
if(mOnStartRequest == PR_TRUE && mSetUpListener == PR_FALSE)
rv = SetUpStreamListener(aURL);
mGotProgress = PR_TRUE;
@ -1097,7 +1092,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIURI* aURL, nsIInput
}
else
{
// if we don't read from the stream, OnStopBinding will never be called
// if we don't read from the stream, OnStopRequest will never be called
char* buffer = new char[aLength];
PRUint32 amountRead;
rv = aIStream->Read(buffer, aLength, &amountRead);
@ -1107,12 +1102,12 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIURI* aURL, nsIInput
}
#ifdef NECKO
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(
nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aMsg)
#else
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
#endif // NECKO
{
nsresult rv = NS_OK;
@ -1146,7 +1141,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(nsIURI* aURL, nsresult a
mStatus = aStatus;
}
mOnStopBinding = PR_TRUE;
mOnStopRequest = PR_TRUE;
#ifdef NECKO
}
#endif
@ -1222,9 +1217,9 @@ nsPluginStreamListenerPeer::OnFileAvailable(const char* aFilename)
if((rv = mPStreamListener->OnFileAvailable((nsIPluginStreamInfo*)mPluginStreamInfo, aFilename)) != NS_OK)
return rv;
// if OnStopBinding has already been called, we need to make sure the plugin gets notified
// we do this here because OnStopBinding must always be called after OnFileAvailable
if(mOnStopBinding)
// if OnStopRequest has already been called, we need to make sure the plugin gets notified
// we do this here because OnStopRequest must always be called after OnFileAvailable
if(mOnStopRequest)
rv = mPStreamListener->OnStopBinding((nsIPluginStreamInfo*)mPluginStreamInfo, mStatus);
mCacheDone = PR_TRUE;
@ -2068,7 +2063,7 @@ nsPluginHostImpl::GetPlugins(PRUint32 aPluginCount, nsIDOMPlugin* aPluginArray[]
LoadPlugins();
nsPluginTag* plugin = mPlugins;
for (int i = 0; i < aPluginCount && plugin != nsnull; i++, plugin = plugin->mNext) {
for (PRUint32 i = 0; i < aPluginCount && plugin != nsnull; i++, plugin = plugin->mNext) {
nsIDOMPlugin* domPlugin = new DOMPluginImpl(plugin);
NS_IF_ADDREF(domPlugin);
aPluginArray[i] = domPlugin;

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

@ -64,18 +64,16 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
// nsIStreamListener
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus,
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream* aStream,
@ -607,9 +605,9 @@ NS_IMPL_ISUPPORTS(PluginListener, kIStreamListenerIID)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStartBinding(nsISupports *ctxt)
PluginListener::OnStartRequest(nsISupports *ctxt)
#else
PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
PluginListener::OnStartRequest(nsIURI* aURL, const char *contentType)
#endif
{
#ifdef NECKO
@ -634,9 +632,9 @@ PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStartBinding(ctxt);
return mNextStream->OnStartRequest(ctxt);
#else
return mNextStream->OnStartBinding(aURL, contentType);
return mNextStream->OnStartRequest(aURL, contentType);
#endif
}
@ -663,9 +661,9 @@ PluginListener::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
PluginListener::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
#else
PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
PluginListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
@ -673,9 +671,9 @@ PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStopBinding(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
return mNextStream->OnStopBinding(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}

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

@ -392,23 +392,21 @@ public:
NS_IMETHOD OnProgress(nsISupports* context, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsISupports* context, const PRUnichar* aMmsg);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
//nsIStreamObserver interface
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
//nsIStreamListener interface
@ -449,10 +447,10 @@ private:
nsPluginStreamType mStreamType;
nsIPluginHost *mHost;
PRBool mGotProgress;
PRBool mOnStartBinding;
PRBool mOnStartRequest;
PRBool mCacheDone;
PRBool mOnStopBinding;
PRBool mOnStopRequest;
nsresult mStatus;
#ifdef USE_CACHE
@ -480,27 +478,24 @@ public:
NS_IMETHOD OnStatus(nsISupports* context, const PRUnichar* aMsg);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_OK; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg) { return NS_OK; }
const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count);
PRUint32 sourceOffset, PRUint32 count);
#else
//nsIStreamObserver interface
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg);
//nsIStreamListener interface
@ -564,7 +559,7 @@ NS_IMPL_ISUPPORTS(nsPluginCacheListener, kIStreamListenerIID);
#ifdef NECKO
NS_IMETHODIMP
nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
nsPluginCacheListener::OnStartRequest(nsISupports* ctxt)
{
char* aContentType = nsnull;
nsIURI* aURL = nsnull;
@ -579,7 +574,7 @@ nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
}
// I have delibrately left out the remaining processing.
// which should just be copied over from the other version of
// OnStartBinding.
// OnStartRequest.
if (aContentType)
nsCRT::free(aContentType);
@ -588,7 +583,7 @@ nsPluginCacheListener::OnStartBinding(nsISupports* ctxt)
}
#else
NS_IMETHODIMP
nsPluginCacheListener::OnStartBinding(nsIURI* aURL, const char *aContentType)
nsPluginCacheListener::OnStartRequest(nsIURI* aURL, const char *aContentType)
{
#ifdef USE_CACHE
nsString urlString;
@ -697,11 +692,11 @@ nsPluginCacheListener::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream, P
NS_IMETHODIMP
#ifdef NECKO
nsPluginCacheListener::OnStopBinding(nsISupports* aContext,
nsPluginCacheListener::OnStopRequest(nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aMsg)
#else
nsPluginCacheListener::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
nsPluginCacheListener::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
#endif // NECKO
{
#ifdef USE_CACHE
@ -772,10 +767,10 @@ nsPluginStreamListenerPeer::nsPluginStreamListenerPeer()
mSetUpListener = PR_FALSE;
mHost = nsnull;
mGotProgress = PR_FALSE;
mOnStartBinding = PR_FALSE;
mOnStartRequest = PR_FALSE;
mStreamType = nsPluginStreamType_Normal;
mOnStopBinding = PR_FALSE;
mOnStopRequest = PR_FALSE;
mCacheDone = PR_FALSE;
mStatus = NS_OK;
}
@ -935,9 +930,9 @@ nsresult nsPluginStreamListenerPeer::InitializeFullPage(nsIPluginInstance *aInst
#ifdef NECKO
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsISupports* aContext)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsISupports* aContext)
#else
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsIURI* aURL, const char *aContentType)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartRequest(nsIURI* aURL, const char *aContentType)
#endif
{
nsresult rv = NS_OK;
@ -993,7 +988,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStartBinding(nsIURI* aURL, const cha
if(mGotProgress == PR_TRUE && mSetUpListener == PR_FALSE)
rv = SetUpStreamListener(aURL);
mOnStartBinding = PR_TRUE;
mOnStartRequest = PR_TRUE;
#ifdef NECKO
nsCRT::free(aContentType);
#endif //NECKO
@ -1021,7 +1016,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIURI* aURL, PRUint32 aPro
if (NS_FAILED(rv)) return rv;
#endif
mPluginStreamInfo->SetLength(aProgressMax);
if(mOnStartBinding == PR_TRUE && mSetUpListener == PR_FALSE)
if(mOnStartRequest == PR_TRUE && mSetUpListener == PR_FALSE)
rv = SetUpStreamListener(aURL);
mGotProgress = PR_TRUE;
@ -1097,7 +1092,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIURI* aURL, nsIInput
}
else
{
// if we don't read from the stream, OnStopBinding will never be called
// if we don't read from the stream, OnStopRequest will never be called
char* buffer = new char[aLength];
PRUint32 amountRead;
rv = aIStream->Read(buffer, aLength, &amountRead);
@ -1107,12 +1102,12 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIURI* aURL, nsIInput
}
#ifdef NECKO
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(
nsISupports* aContext,
nsresult aStatus,
const PRUnichar* aMsg)
#else
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIURI* aURL, nsresult aStatus, const PRUnichar* aMsg)
#endif // NECKO
{
nsresult rv = NS_OK;
@ -1146,7 +1141,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopBinding(nsIURI* aURL, nsresult a
mStatus = aStatus;
}
mOnStopBinding = PR_TRUE;
mOnStopRequest = PR_TRUE;
#ifdef NECKO
}
#endif
@ -1222,9 +1217,9 @@ nsPluginStreamListenerPeer::OnFileAvailable(const char* aFilename)
if((rv = mPStreamListener->OnFileAvailable((nsIPluginStreamInfo*)mPluginStreamInfo, aFilename)) != NS_OK)
return rv;
// if OnStopBinding has already been called, we need to make sure the plugin gets notified
// we do this here because OnStopBinding must always be called after OnFileAvailable
if(mOnStopBinding)
// if OnStopRequest has already been called, we need to make sure the plugin gets notified
// we do this here because OnStopRequest must always be called after OnFileAvailable
if(mOnStopRequest)
rv = mPStreamListener->OnStopBinding((nsIPluginStreamInfo*)mPluginStreamInfo, mStatus);
mCacheDone = PR_TRUE;
@ -2068,7 +2063,7 @@ nsPluginHostImpl::GetPlugins(PRUint32 aPluginCount, nsIDOMPlugin* aPluginArray[]
LoadPlugins();
nsPluginTag* plugin = mPlugins;
for (int i = 0; i < aPluginCount && plugin != nsnull; i++, plugin = plugin->mNext) {
for (PRUint32 i = 0; i < aPluginCount && plugin != nsnull; i++, plugin = plugin->mNext) {
nsIDOMPlugin* domPlugin = new DOMPluginImpl(plugin);
NS_IF_ADDREF(domPlugin);
aPluginArray[i] = domPlugin;

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

@ -64,18 +64,16 @@ public:
#ifdef NECKO
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports *ctxt);
NS_IMETHOD OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count);
#else
// nsIStreamListener
NS_IMETHOD OnStartBinding(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURI* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
NS_IMETHOD OnStatus(nsIURI* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStopBinding(nsIURI* aURL, nsresult aStatus,
NS_IMETHOD OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo);
NS_IMETHOD OnDataAvailable(nsIURI* aURL, nsIInputStream* aStream,
@ -607,9 +605,9 @@ NS_IMPL_ISUPPORTS(PluginListener, kIStreamListenerIID)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStartBinding(nsISupports *ctxt)
PluginListener::OnStartRequest(nsISupports *ctxt)
#else
PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
PluginListener::OnStartRequest(nsIURI* aURL, const char *contentType)
#endif
{
#ifdef NECKO
@ -634,9 +632,9 @@ PluginListener::OnStartBinding(nsIURI* aURL, const char *contentType)
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStartBinding(ctxt);
return mNextStream->OnStartRequest(ctxt);
#else
return mNextStream->OnStartBinding(aURL, contentType);
return mNextStream->OnStartRequest(aURL, contentType);
#endif
}
@ -663,9 +661,9 @@ PluginListener::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
NS_IMETHODIMP
#ifdef NECKO
PluginListener::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
PluginListener::OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
#else
PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
PluginListener::OnStopRequest(nsIURI* aURL, nsresult aStatus,
const PRUnichar* aMsg)
#endif
{
@ -673,9 +671,9 @@ PluginListener::OnStopBinding(nsIURI* aURL, nsresult aStatus,
return NS_ERROR_FAILURE;
}
#ifdef NECKO
return mNextStream->OnStopBinding(ctxt, status, errorMsg);
return mNextStream->OnStopRequest(ctxt, status, errorMsg);
#else
return mNextStream->OnStopBinding(aURL, aStatus, aMsg);
return mNextStream->OnStopRequest(aURL, aStatus, aMsg);
#endif
}

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

@ -24,6 +24,8 @@ interface nsIOutputStream;
interface nsIStreamObserver;
interface nsIStreamListener;
typedef unsigned long nsLoadFlags;
/**
* nsIChannel is the abstract base class for transports and URLs.
* It's abstract in that it doesn't provide a means to specify the
@ -100,7 +102,7 @@ interface nsIChannel : nsIRequest
* attributes with the LOAD_QUIET bit set causes the loading process to
* not deliver status notifications to the program performing the load.
*/
attribute unsigned long LoadAttributes;
attribute nsLoadFlags LoadAttributes;
/**
* Returns the content MIME type of the channel if available. Note that the

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

@ -139,7 +139,7 @@ interface nsIIOService : nsISupports
* their use is not required by other parts of the system, they are primarily
* a convenience for the caller.
*/
nsILoadGroup NewLoadGroup();
nsILoadGroup NewLoadGroup(in nsILoadGroup parent);
};
%{C++

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

@ -20,10 +20,16 @@
interface nsIChannel;
interface nsISimpleEnumerator;
interface nsIStreamObserver;
/**
* A load group maintains a collection of active URL requests.
*/
[scriptable, uuid(19845248-29ab-11d3-8cce-0060b0fc14a3)]
interface nsILoadGroup : nsIRequest
{
void Init(in nsILoadGroup parent);
/**
* Accesses the default load attributes for the group, returned as
* a flag word. Setting the default load attributes will cause them
@ -48,6 +54,23 @@ interface nsILoadGroup : nsIRequest
*/
readonly attribute nsISimpleEnumerator Channels;
/**
* Adds an observer to the group. The observer's methods will be
* called for each channel in the group.
*/
void AddObserver(in nsIStreamObserver observer);
/**
* Removes an observer from the group.
*/
void RemoveObserver(in nsIStreamObserver observer);
/**
* Returns the observers contained directly in this group.
* Enumerator element type: nsIStreamObserver.
*/
readonly attribute nsISimpleEnumerator Observers;
/**
* Adds a new sub-group to the group.
*/

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

@ -21,14 +21,46 @@
[scriptable, uuid(a63f70c0-148b-11d3-9333-00104ba0fd40)]
interface nsIPrompt : nsISupports
{
boolean Confirm(in nsISupports ctxt, in wstring text);
/**
* Puts up an alert dialog with an OK button.
*/
void Alert(in wstring text);
boolean Prompt(in nsISupports ctxt, in wstring text,
in wstring defaultText, out wstring result);
/**
* Puts up a dialog with OK and Cancel buttons.
* @return true for OK, false for Cancel
*/
boolean Confirm(in wstring text);
boolean PromptUsernameAndPassword(in nsISupports ctxt, in wstring text,
out wstring user, out wstring pwd);
/**
* Puts up a dialog with OK and Cancel buttons, and
* a message with a single checkbox.
* @return true for OK, false for Cancel
*/
boolean ConfirmCheck(in wstring text,
in wstring checkMsg,
out boolean checkValue);
boolean PromptPassword(in nsISupports ctxt, in wstring text,
/**
* Puts up a text input dialog with OK and Cancel buttons.
* @return true for OK, false for Cancel
*/
boolean Prompt(in wstring text,
in wstring defaultText,
out wstring result);
/**
* Puts up a username/password dialog with OK and Cancel buttons.
* @return true for OK, false for Cancel
*/
boolean PromptUsernameAndPassword(in wstring text,
out wstring user,
out wstring pwd);
/**
* Puts up a password dialog with OK and Cancel buttons.
* @return true for OK, false for Cancel
*/
boolean PromptPassword(in wstring text,
out wstring pwd);
};

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

@ -21,6 +21,13 @@
[scriptable, uuid(F2CAABA0-2F25-11d3-A164-0050041CAF44)]
interface nsIRequest : nsISupports
{
/**
* Returns true if the request is pending (active). Returns false
* after completion or successful calling Cancel. Suspended requests
* are still considered pending.
*/
boolean IsPending();
/**
* Cancels the current request. This will close any open input or
* output streams and terminate any async requests.

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

@ -23,20 +23,9 @@ interface nsIEventQueue;
[scriptable, uuid(fd91e2e0-1481-11d3-9333-00104ba0fd40)]
interface nsIStreamObserver : nsISupports
{
void OnStartBinding(in nsISupports ctxt);
void OnStopBinding(in nsISupports ctxt,
in nsresult status,
in wstring errorMsg);
/**
* Called after the stream is opened for reading or writing.
* The content type or headers may be accessed after this method
* is called.
*/
void OnStartRequest(in nsISupports ctxt);
void OnStopRequest(in nsISupports ctxt,
void OnStopRequest(in nsISupports ctxt,
in nsresult status,
in wstring errorMsg);
};
@ -51,7 +40,7 @@ NS_NewAsyncStreamObserver(nsIStreamObserver* *result,
nsIEventQueue* eventQueue,
nsIStreamObserver* receiver);
// Generic status codes for OnStopBinding:
// Generic status codes for OnStopRequest:
#define NS_BINDING_SUCCEEDED NS_OK
#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)

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

@ -116,12 +116,34 @@ interface nsIURI : nsISupports
* channel is opened the URI may get redirected to a new location.
*/
nsIURI Clone();
/**
* Returns a new URI string that merges the relative part with defaults
* from the current URI's location. If the relative part actually
* specifies an absolute URI, the string is returned as is.
*/
string MakeAbsolute(in string relativePart);
};
%{C++
/**
* Protocol writers can obtain a very basic (ok, degenerate) implementation
* of nsIURI by calling the component manager with NS_SIMPLEURI_CID. The
* implementation returned will only parse things of the form:
*
* about:cache
* \ / \ /
* --- ---
* | |
* Scheme Path
*
* where the path is everything after the colon. Note that this is probably
* only useful for cases like about: or javascript: URIs.
*
* *** What you most likely will want is NS_STANDARDURL_CID which is much more
* full featured. Look at nsIURL.idl for more details on it.
*/
#define NS_SIMPLEURI_CID \
{ /* e0da1d70-2f7b-11d3-8cd0-0060b0fc14a3 */ \
0xe0da1d70, \
0x2f7b, \
0x11d3, \
{0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
}
%}

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

@ -63,7 +63,6 @@ interface nsIURL : nsIURI
%{C++
/**
* Protocol writers can obtain a default nsIURL implementation by calling the
* component manager with NS_STANDARDURL_CID. The implementation returned will

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

@ -32,6 +32,7 @@ CPPSRCS = \
nsSocketTransport.cpp \
nsSocketTransportService.cpp \
nsStandardUrl.cpp \
nsSimpleURI.cpp \
nsNetModuleMgr.cpp \
nsNetModRegEntry.cpp \
nsLoadGroup.cpp \

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

@ -34,6 +34,7 @@ CPP_OBJS = \
.\$(OBJDIR)\nsSocketTransport.obj \
.\$(OBJDIR)\nsSocketTransportService.obj \
.\$(OBJDIR)\nsStandardUrl.obj \
.\$(OBJDIR)\nsSimpleURI.obj \
.\$(OBJDIR)\nsNetModuleMgr.obj \
.\$(OBJDIR)\nsNetModRegEntry.obj \
.\$(OBJDIR)\nsLoadGroup.obj \

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

@ -29,10 +29,6 @@ public:
NS_DECL_ISUPPORTS
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
@ -72,18 +68,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIStreamListener methods:
NS_IMETHOD OnStartBinding(nsISupports* context)
{
return nsAsyncStreamObserver::OnStartBinding(context);
}
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
return nsAsyncStreamObserver::OnStopBinding(context, aStatus, aMsg);
}
NS_IMETHOD OnStartRequest(nsISupports* context)
{
return nsAsyncStreamObserver::OnStartRequest(context);
@ -194,128 +178,6 @@ NS_IMPL_ISUPPORTS_INHERITED(nsAsyncStreamListener,
nsAsyncStreamObserver,
nsIStreamListener);
////////////////////////////////////////////////////////////////////////////////
//
// OnStartBinding...
//
////////////////////////////////////////////////////////////////////////////////
class nsOnStartBindingEvent : public nsStreamListenerEvent
{
public:
nsOnStartBindingEvent(nsAsyncStreamObserver* listener,
nsISupports* context)
: nsStreamListenerEvent(listener, context), mContentType(nsnull) {}
virtual ~nsOnStartBindingEvent();
NS_IMETHOD HandleEvent();
protected:
char* mContentType;
};
nsOnStartBindingEvent::~nsOnStartBindingEvent()
{
if (mContentType)
delete[] mContentType;
}
NS_IMETHODIMP
nsOnStartBindingEvent::HandleEvent()
{
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
return receiver->OnStartBinding(mContext);
}
NS_IMETHODIMP
nsAsyncStreamObserver::OnStartBinding(nsISupports* context)
{
nsresult rv = GetStatus();
if (NS_FAILED(rv)) return rv;
nsOnStartBindingEvent* event =
new nsOnStartBindingEvent(this, context);
if (event == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
rv = event->Fire(mEventQueue);
if (NS_FAILED(rv)) goto failed;
return rv;
failed:
delete event;
return rv;
}
////////////////////////////////////////////////////////////////////////////////
//
// OnStopBinding
//
////////////////////////////////////////////////////////////////////////////////
class nsOnStopBindingEvent : public nsStreamListenerEvent
{
public:
nsOnStopBindingEvent(nsAsyncStreamObserver* listener,
nsISupports* context)
: nsStreamListenerEvent(listener, context),
mStatus(NS_OK), mMessage(nsnull) {}
virtual ~nsOnStopBindingEvent();
nsresult Init(nsresult status, const PRUnichar* aMsg);
NS_IMETHOD HandleEvent();
protected:
nsresult mStatus;
PRUnichar* mMessage;
};
nsOnStopBindingEvent::~nsOnStopBindingEvent()
{
}
nsresult
nsOnStopBindingEvent::Init(nsresult status, const PRUnichar* aMsg)
{
mStatus = status;
mMessage = (PRUnichar*)aMsg;
return NS_OK;
}
NS_IMETHODIMP
nsOnStopBindingEvent::HandleEvent()
{
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
return receiver->OnStopBinding(mContext, mStatus, mMessage);
}
NS_IMETHODIMP
nsAsyncStreamObserver::OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
nsresult rv;
//
// The OnStopBindiong event should always be fired, so do not
// check the status...
//
nsOnStopBindingEvent* event =
new nsOnStopBindingEvent(this, context);
if (event == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
rv = event->Init(aStatus, aMsg);
if (NS_FAILED(rv)) goto failed;
rv = event->Fire(mEventQueue);
if (NS_FAILED(rv)) goto failed;
return rv;
failed:
delete event;
return rv;
}
////////////////////////////////////////////////////////////////////////////////
//
// OnStartRequest...

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

@ -121,6 +121,13 @@ nsFileTransport::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
NS_IMETHODIMP
nsFileTransport::IsPending(PRBool *result)
{
*result = mState != ENDED;
return NS_OK;
}
NS_IMETHODIMP
nsFileTransport::Cancel(void)
{
@ -265,7 +272,7 @@ nsFileTransport::Process(void)
nsISupports* fs;
nsFileSpec spec(mPath);
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
mStatus = mListener->OnStartRequest(mContext); // always send the start notification
if (NS_FAILED(mStatus)) goto error;
mStatus = NS_NewTypicalInputFileStream(&fs, spec);
@ -312,7 +319,7 @@ nsFileTransport::Process(void)
nsISupports* fs;
nsFileSpec spec(mPath);
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
mStatus = mListener->OnStartRequest(mContext); // always send the start notification
if (NS_FAILED(mStatus)) goto error;
mStatus = NS_NewTypicalOutputFileStream(&fs, spec);
@ -342,7 +349,7 @@ nsFileTransport::Process(void)
mFileStream = nsnull;
// XXX where do we get the error message?
(void)mListener->OnStopBinding(mContext, mStatus, nsnull);
(void)mListener->OnStopRequest(mContext, mStatus, nsnull);
mState = ENDED;
break;

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

@ -37,6 +37,7 @@ public:
NS_DECL_ISUPPORTS
// nsIRequest methods:
NS_IMETHOD IsPending(PRBool *result);
NS_IMETHOD Cancel(void);
NS_IMETHOD Suspend(void);
NS_IMETHOD Resume(void);

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

@ -93,10 +93,7 @@ nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
progID += scheme;
progID.ToCString(buf, MAX_NET_PROGID_LENGTH);
nsIProtocolHandler* handler;
rv = nsServiceManager::GetService(buf, nsCOMTypeInfo<nsIProtocolHandler>::GetIID(),
(nsISupports**)&handler);
NS_WITH_SERVICE(nsIProtocolHandler, handler, buf, &rv);
if (NS_FAILED(rv)) return rv;
*result = handler;
@ -328,10 +325,21 @@ nsIOService::NewChannelFromNativePath(const char *nativePath, nsIFileChannel **r
}
NS_IMETHODIMP
nsIOService::NewLoadGroup(nsILoadGroup **result)
nsIOService::NewLoadGroup(nsILoadGroup* parent, nsILoadGroup **result)
{
return nsLoadGroup::Create(nsnull, nsCOMTypeInfo<nsILoadGroup>::GetIID(),
(void**)result);
nsresult rv;
nsILoadGroup* group;
rv = nsLoadGroup::Create(nsnull, nsCOMTypeInfo<nsILoadGroup>::GetIID(),
(void**)&group);
if (NS_FAILED(rv)) return rv;
rv = group->Init(parent);
if (NS_FAILED(rv)) {
NS_RELEASE(group);
return rv;
}
*result = group;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -52,7 +52,7 @@ public:
NS_IMETHOD NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue, nsIStreamListener **_retval);
NS_IMETHOD NewSyncStreamListener(nsIInputStream **inStream, nsIBufferOutputStream **outStream, nsIStreamListener **_retval);
NS_IMETHOD NewChannelFromNativePath(const char *nativePath, nsIFileChannel **_retval);
NS_IMETHOD NewLoadGroup(nsILoadGroup **result);
NS_IMETHOD NewLoadGroup(nsILoadGroup* parent, nsILoadGroup **result);
// nsIOService methods:
nsIOService();

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

@ -24,6 +24,7 @@
#include "nsEnumeratorUtils.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
////////////////////////////////////////////////////////////////////////////////
@ -36,6 +37,8 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
nsLoadGroup::~nsLoadGroup()
{
nsresult rv = Cancel();
NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");
NS_IF_RELEASE(mChannels);
NS_IF_RELEASE(mSubGroups);
}
@ -72,7 +75,7 @@ nsLoadGroup::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
// nsIRequest methods:
nsresult
nsLoadGroup::Iterate(IterateFun fun)
nsLoadGroup::PropagateDown(PropagateDownFun fun)
{
nsresult rv;
PRUint32 i;
@ -101,6 +104,38 @@ nsLoadGroup::Iterate(IterateFun fun)
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::IsPending(PRBool *result)
{
nsresult rv;
PRUint32 count;
rv = mChannels->Count(&count);
if (count > 0) {
*result = PR_FALSE;
return NS_OK;
}
PRUint32 i;
rv = mSubGroups->Count(&count);
if (NS_FAILED(rv)) return rv;
for (i = 0; i < count; i++) {
nsIRequest* req = NS_STATIC_CAST(nsIRequest*, mSubGroups->ElementAt(i));
if (req == nsnull)
return NS_ERROR_FAILURE;
PRBool pending;
rv = req->IsPending(&pending);
NS_RELEASE(req);
if (NS_FAILED(rv)) return rv;
if (pending) {
*result = PR_FALSE;
return NS_OK;
}
}
*result = PR_TRUE;
return NS_OK;
}
static nsresult
CancelFun(nsIRequest* req)
{
@ -110,7 +145,7 @@ CancelFun(nsIRequest* req)
NS_IMETHODIMP
nsLoadGroup::Cancel()
{
return Iterate(CancelFun);
return PropagateDown(CancelFun);
}
static nsresult
@ -122,7 +157,7 @@ SuspendFun(nsIRequest* req)
NS_IMETHODIMP
nsLoadGroup::Suspend()
{
return Iterate(SuspendFun);
return PropagateDown(SuspendFun);
}
static nsresult
@ -134,11 +169,19 @@ ResumeFun(nsIRequest* req)
NS_IMETHODIMP
nsLoadGroup::Resume()
{
return Iterate(ResumeFun);
return PropagateDown(ResumeFun);
}
////////////////////////////////////////////////////////////////////////////////
// nsILoadGroup methods:
NS_IMETHODIMP
nsLoadGroup::Init(nsILoadGroup *parent)
{
// mParent = parent; // weak ref
parent->AddSubGroup(this); // XXX
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::GetDefaultLoadAttributes(PRUint32 *aDefaultLoadAttributes)
@ -176,15 +219,35 @@ nsLoadGroup::GetChannels(nsISimpleEnumerator * *aChannels)
return NS_NewArrayEnumerator(aChannels, mChannels);
}
NS_IMETHODIMP
nsLoadGroup::AddObserver(nsIStreamObserver *observer)
{
return mObservers->AppendElement(observer);
}
NS_IMETHODIMP
nsLoadGroup::RemoveObserver(nsIStreamObserver *observer)
{
return mObservers->RemoveElement(observer);
}
NS_IMETHODIMP
nsLoadGroup::GetObservers(nsISimpleEnumerator * *aObservers)
{
return NS_NewArrayEnumerator(aObservers, mObservers);
}
NS_IMETHODIMP
nsLoadGroup::AddSubGroup(nsILoadGroup *group)
{
// group->mParent = this; // XXX
return mSubGroups->AppendElement(group);
}
NS_IMETHODIMP
nsLoadGroup::RemoveSubGroup(nsILoadGroup *group)
{
// group->mParent = nsnull; // XXX
return mSubGroups->RemoveElement(group);
}
@ -195,3 +258,99 @@ nsLoadGroup::GetSubGroups(nsISimpleEnumerator * *aSubGroups)
}
////////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver methods:
nsresult
nsLoadGroup::PropagateUp(PropagateUpFun fun, void* closure)
{
nsresult rv;
PRUint32 i;
PRUint32 count;
for (nsLoadGroup* group = this; group != nsnull; group = group->mParent) {
rv = group->mObservers->Count(&count);
if (NS_FAILED(rv)) return rv;
for (i = 0; i < count; i++) {
nsIStreamObserver* obs =
NS_STATIC_CAST(nsIStreamObserver*, group->mObservers->ElementAt(i));
if (obs == nsnull)
return NS_ERROR_FAILURE;
rv = fun(obs, closure);
NS_RELEASE(obs);
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}
static nsresult
OnStartRequestFun(nsIStreamObserver* obs, void* closure)
{
nsISupports* ctxt = (nsISupports*)closure;
return obs->OnStartRequest(ctxt);
}
NS_IMETHODIMP
nsLoadGroup::OnStartRequest(nsISupports *ctxt)
{
return PropagateUp(OnStartRequestFun, ctxt);
}
struct OnStopRequestArgs {
nsISupports* ctxt;
nsresult status;
const PRUnichar* errorMsg;
};
static nsresult
OnStopRequestFun(nsIStreamObserver* obs, void* closure)
{
OnStopRequestArgs* args = (OnStopRequestArgs*)closure;
return obs->OnStopRequest(args->ctxt, args->status, args->errorMsg);
}
NS_IMETHODIMP
nsLoadGroup::OnStopRequest(nsISupports *ctxt, nsresult status,
const PRUnichar *errorMsg)
{
OnStopRequestArgs args;
args.ctxt = ctxt;
args.status = status;
args.errorMsg = errorMsg;
return PropagateUp(OnStartRequestFun, &args);
}
////////////////////////////////////////////////////////////////////////////////
// nsIStreamListener methods:
struct OnDataAvailableArgs {
nsISupports* ctxt;
nsIInputStream *inStr;
PRUint32 sourceOffset;
PRUint32 count;
};
static nsresult
OnDataAvailableFun(nsIStreamObserver* obs, void* closure)
{
OnDataAvailableArgs* args = (OnDataAvailableArgs*)closure;
nsIStreamListener* l = NS_STATIC_CAST(nsIStreamListener*, obs);
return l->OnDataAvailable(args->ctxt, args->inStr,
args->sourceOffset, args->count);
}
NS_IMETHODIMP
nsLoadGroup::OnDataAvailable(nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset,
PRUint32 count)
{
OnDataAvailableArgs args;
args.ctxt = ctxt;
args.inStr = inStr;
args.sourceOffset = sourceOffset;
args.count = count;
return PropagateUp(OnDataAvailableFun, &args);
}
////////////////////////////////////////////////////////////////////////////////

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

@ -20,17 +20,21 @@
#define nsLoadGroup_h__
#include "nsILoadGroup.h"
#include "nsIStreamListener.h"
#include "nsAgg.h"
class nsISupportsArray;
class nsLoadGroup : public nsILoadGroup
class nsLoadGroup : public nsILoadGroup, public nsIStreamListener
{
public:
NS_DECL_AGGREGATED
////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
/* boolean IsPending (); */
NS_IMETHOD IsPending(PRBool *result);
/* void Cancel (); */
NS_IMETHOD Cancel();
@ -44,6 +48,9 @@ public:
////////////////////////////////////////////////////////////////////////////
// nsILoadGroup methods:
/* void Init (in nsILoadGroup parent); */
NS_IMETHOD Init(nsILoadGroup *parent);
/* attribute unsigned long DefaultLoadAttributes; */
NS_IMETHOD GetDefaultLoadAttributes(PRUint32 *aDefaultLoadAttributes);
NS_IMETHOD SetDefaultLoadAttributes(PRUint32 aDefaultLoadAttributes);
@ -57,6 +64,15 @@ public:
/* readonly attribute nsISimpleEnumerator Channels; */
NS_IMETHOD GetChannels(nsISimpleEnumerator * *aChannels);
/* void AddObserver (in nsIStreamObserver observer); */
NS_IMETHOD AddObserver(nsIStreamObserver *observer);
/* void RemoveObserver (in nsIStreamObserver observer); */
NS_IMETHOD RemoveObserver(nsIStreamObserver *observer);
/* readonly attribute nsISimpleEnumerator Observers; */
NS_IMETHOD GetObservers(nsISimpleEnumerator * *aObservers);
/* void AddSubGroup (in nsILoadGroup group); */
NS_IMETHOD AddSubGroup(nsILoadGroup *group);
@ -66,6 +82,20 @@ public:
/* readonly attribute nsISimpleEnumerator SubGroups; */
NS_IMETHOD GetSubGroups(nsISimpleEnumerator * *aSubGroups);
////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver methods:
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
////////////////////////////////////////////////////////////////////////////
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset,
PRUint32 count);
////////////////////////////////////////////////////////////////////////////
// nsLoadGroup methods:
@ -76,13 +106,18 @@ public:
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:
typedef nsresult (*IterateFun)(nsIRequest* request);
nsresult Iterate(IterateFun fun);
typedef nsresult (*PropagateDownFun)(nsIRequest* request);
nsresult PropagateDown(PropagateDownFun fun);
typedef nsresult (*PropagateUpFun)(nsIStreamObserver* obs, void* closure);
nsresult PropagateUp(PropagateUpFun fun, void* closure);
protected:
PRUint32 mDefaultLoadAttributes;
nsISupportsArray* mChannels;
nsISupportsArray* mObservers;
nsISupportsArray* mSubGroups;
nsLoadGroup* mParent; // weak ref
nsIStreamObserver* mObserver; // might be an nsIStreamListener too
};
#endif // nsLoadGroup_h__

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

@ -294,11 +294,11 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
case eSocketState_Connected:
// Fire a notification for read...
if (mReadListener) {
mReadListener->OnStartBinding(mReadContext);
mReadListener->OnStartRequest(mReadContext);
}
// Fire a notification for write...
if (mWriteObserver) {
mWriteObserver->OnStartBinding(mWriteContext);
mWriteObserver->OnStartRequest(mWriteContext);
}
break;
@ -312,7 +312,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
// Fire a notification that the read has finished...
if (eSocketState_DoneWrite != mCurrentState) {
if (mReadListener) {
mReadListener->OnStopBinding(mReadContext, rv, nsnull);
mReadListener->OnStopRequest(mReadContext, rv, nsnull);
NS_RELEASE(mReadListener);
NS_IF_RELEASE(mReadContext);
}
@ -324,7 +324,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
// Fire a notification that the write has finished...
if (eSocketState_DoneRead != mCurrentState) {
if (mWriteObserver) {
mWriteObserver->OnStopBinding(mWriteContext, rv, nsnull);
mWriteObserver->OnStopRequest(mWriteContext, rv, nsnull);
NS_RELEASE(mWriteObserver);
NS_IF_RELEASE(mWriteContext);
}
@ -912,6 +912,14 @@ nsSocketTransport::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
// nsIRequest implementation...
// --------------------------------------------------------------------------
//
NS_IMETHODIMP
nsSocketTransport::IsPending(PRBool *result)
{
*result = mCurrentState != eSocketState_Created
&& mCurrentState != eSocketState_Closed;
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::Cancel(void)
{

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

@ -75,6 +75,7 @@ public:
NS_DECL_ISUPPORTS
// nsIRequest methods:
NS_IMETHOD IsPending(PRBool *result);
NS_IMETHOD Cancel(void);
NS_IMETHOD Suspend(void);
NS_IMETHOD Resume(void);

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

@ -48,6 +48,7 @@ nsStandardURL::~nsStandardURL()
if (mScheme) delete[] mScheme;
if (mPreHost) delete[] mPreHost;
if (mHost) delete[] mHost;
if (mPath) delete[] mPath;
if (mRef) delete[] mRef;
if (mQuery) delete[] mQuery;
if (mSpec) delete[] mSpec;
@ -250,12 +251,6 @@ nsStandardURL::Clone(nsIURI* *result)
return NS_OK;
}
NS_IMETHODIMP
nsStandardURL::MakeAbsolute(const char *relativePart, char **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// XXX recode to use nsString api's
@ -597,7 +592,7 @@ nsStandardURL::ReconstructSpec()
}
////////////////////////////////////////////////////////////////////////////////
// nsIURI methods:
// nsIURL methods:
NS_IMETHODIMP
nsStandardURL::GetDirectory(char * *aDirectory)

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

@ -68,11 +68,8 @@ public:
/* nsIURI Clone (); */
NS_IMETHOD Clone(nsIURI **_retval);
/* string MakeAbsolute (in string relativePart); */
NS_IMETHOD MakeAbsolute(const char *relativePart, char **_retval);
////////////////////////////////////////////////////////////////////////////
// nsIURI methods:
// nsIURL methods:
/* attribute string Directory; */
NS_IMETHOD GetDirectory(char * *aDirectory);

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

@ -30,10 +30,6 @@ public:
NS_DECL_ISUPPORTS
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
@ -101,21 +97,6 @@ nsSyncStreamListener::QueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_NOINTERFACE;
}
NS_IMETHODIMP
nsSyncStreamListener::OnStartBinding(nsISupports* context)
{
return NS_OK;
}
NS_IMETHODIMP
nsSyncStreamListener::OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
// XXX what do we do with the status and error message?
return mOutputStream->Close();
}
NS_IMETHODIMP
nsSyncStreamListener::OnStartRequest(nsISupports* context)
{

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

@ -82,9 +82,9 @@ public:
NS_IMETHOD GetBindInfo(nsIURL* aURL, nsStreamBindingInfo* info);
NS_IMETHOD OnProgress(nsIURL* aURL, PRUint32 Progress, PRUint32 ProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const PRUnichar* aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnStartRequest(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRUint32 length);
NS_IMETHOD OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIURL* aURL, nsresult status, const PRUnichar* aMsg);
protected:
~TestConsumer();
@ -142,10 +142,10 @@ NS_IMETHODIMP TestConsumer::OnStatus(nsIURL* aURL, const PRUnichar* aMsg)
return 0;
}
NS_IMETHODIMP TestConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
NS_IMETHODIMP TestConsumer::OnStartRequest(nsIURL* aURL, const char *aContentType)
{
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
printf("\n+++ TestConsumer::OnStartRequest: URL: %p, Content type: %s\n", aURL, aContentType);
}
return 0;
@ -177,10 +177,10 @@ NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStre
}
NS_IMETHODIMP TestConsumer::OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg)
NS_IMETHODIMP TestConsumer::OnStopRequest(nsIURL* aURL, nsresult status, const PRUnichar* aMsg)
{
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStopBinding... URL: %p status: %d\n", aURL, status);
printf("\n+++ TestConsumer::OnStopRequest... URL: %p status: %d\n", aURL, status);
}
if (NS_FAILED(status)) {

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

@ -46,6 +46,7 @@ class nsDNSRequest : public nsIRequest
nsDNSLookup* mHostNameLookup;
// nsIRequest methods:
NS_IMETHOD IsPending(PRBool *result);
NS_IMETHOD Cancel(void);
NS_IMETHOD Suspend(void);
NS_IMETHOD Resume(void);

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

@ -26,6 +26,7 @@ MODULE = necko
include $(DEPTH)/config/autoconf.mk
DIRS= \
about \
file \
resource \
ftp \

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

@ -139,6 +139,13 @@ nsFileChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
// From nsIRequest
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
nsFileChannel::IsPending(PRBool *result)
{
*result = mState != QUIESCENT;
return NS_OK;
}
NS_IMETHODIMP
nsFileChannel::Cancel()
{
@ -490,7 +497,7 @@ nsFileChannel::Process(void)
NS_ASSERTION(mSourceOffset == 0, "implement seek");
if (mListener) {
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
mStatus = mListener->OnStartRequest(mContext); // always send the start notification
if (NS_FAILED(mStatus)) goto error;
}
@ -532,7 +539,7 @@ nsFileChannel::Process(void)
nsISupports* fs;
if (mListener) {
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
mStatus = mListener->OnStartRequest(mContext); // always send the start notification
if (NS_FAILED(mStatus)) goto error;
}
@ -566,7 +573,7 @@ nsFileChannel::Process(void)
mBufferOutputStream->Flush();
if (mListener) {
// XXX where do we get the error message?
(void)mListener->OnStopBinding(mContext, mStatus, nsnull);
(void)mListener->OnStopRequest(mContext, mStatus, nsnull);
}
NS_IF_RELEASE(mBufferOutputStream);

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

@ -41,6 +41,9 @@ public:
////////////////////////////////////////////////////////////////////////////
// from nsIRequest:
/* boolean IsPending (); */
NS_IMETHOD IsPending(PRBool *result);
/* void Cancel (); */
NS_IMETHOD Cancel();

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

@ -125,6 +125,12 @@ nsFTPChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
NS_IMETHODIMP
nsFTPChannel::IsPending(PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFTPChannel::Cancel(void)
{
@ -267,19 +273,6 @@ nsFTPChannel::SetStreamListener(nsIStreamListener *aListener) {
////////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver methods:
NS_IMETHODIMP
nsFTPChannel::OnStartBinding(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFTPChannel::OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
// Release the lock so the user get's the data stream
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFTPChannel::OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -37,6 +37,7 @@ public:
NS_DECL_ISUPPORTS
// nsIRequest methods:
NS_IMETHOD IsPending(PRBool *result);
NS_IMETHOD Cancel();
NS_IMETHOD Suspend();
NS_IMETHOD Resume();
@ -63,14 +64,10 @@ public:
NS_IMETHOD SetStreamListener(nsIStreamListener* aListener);
// nsIStreamObserver methods:
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg);
// nsIStreamListener methods:
NS_IMETHOD OnDataAvailable(nsISupports* context,

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

@ -145,8 +145,8 @@ nsFtpConnectionThread::Run() {
// tell the user that we've begun the transaction.
nsFtpOnStartBindingEvent* event =
new nsFtpOnStartBindingEvent(mListener, nsnull);
nsFtpOnStartRequestEvent* event =
new nsFtpOnStartRequestEvent(mListener, nsnull);
if (event == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -197,8 +197,8 @@ nsFtpConnectionThread::Run() {
{
// We have error'd out. Stop binding and pass the error back to the user.
PRUnichar* errorMsg = nsnull;
nsFtpOnStopBindingEvent* event =
new nsFtpOnStopBindingEvent(mListener, nsnull);
nsFtpOnStopRequestEvent* event =
new nsFtpOnStopRequestEvent(mListener, nsnull);
if (!event)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -72,25 +72,25 @@ nsFtpStreamListenerEvent::Fire(nsIEventQueue* aEventQueue)
////////////////////////////////////////////////////////////////////////////////
//
// OnStartBinding...
// OnStartRequest...
//
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
nsFtpOnStartBindingEvent::HandleEvent()
nsFtpOnStartRequestEvent::HandleEvent()
{
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener;
return receiver->OnStartBinding(mContext);
return receiver->OnStartRequest(mContext);
}
/*
NS_IMETHODIMP
nsMarshalingStreamObserver::OnStartBinding(nsISupports* context)
nsMarshalingStreamObserver::OnStartRequest(nsISupports* context)
{
nsresult rv = GetStatus();
if (NS_FAILED(rv)) return rv;
nsOnStartBindingEvent* event =
new nsOnStartBindingEvent(this, context);
nsOnStartRequestEvent* event =
new nsOnStartRequestEvent(this, context);
if (event == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -159,16 +159,16 @@ nsMarshalingStreamListener::OnDataAvailable(nsISupports* context,
*/
////////////////////////////////////////////////////////////////////////////////
//
// OnStopBinding
// OnStopRequest
//
////////////////////////////////////////////////////////////////////////////////
nsFtpOnStopBindingEvent::~nsFtpOnStopBindingEvent()
nsFtpOnStopRequestEvent::~nsFtpOnStopRequestEvent()
{
}
nsresult
nsFtpOnStopBindingEvent::Init(nsresult status, PRUnichar* aMsg)
nsFtpOnStopRequestEvent::Init(nsresult status, PRUnichar* aMsg)
{
mStatus = status;
mMessage = aMsg;
@ -176,22 +176,22 @@ nsFtpOnStopBindingEvent::Init(nsresult status, PRUnichar* aMsg)
}
NS_IMETHODIMP
nsFtpOnStopBindingEvent::HandleEvent()
nsFtpOnStopRequestEvent::HandleEvent()
{
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener;
return receiver->OnStopBinding(mContext, mStatus, mMessage);
return receiver->OnStopRequest(mContext, mStatus, mMessage);
}
/*
NS_IMETHODIMP
nsMarshalingStreamObserver::OnStopBinding(nsISupports* context,
nsMarshalingStreamObserver::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
nsresult rv = GetStatus();
if (NS_FAILED(rv)) return rv;
nsOnStopBindingEvent* event =
new nsOnStopBindingEvent(this, context);
nsOnStopRequestEvent* event =
new nsOnStopRequestEvent(this, context);
if (event == nsnull)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -42,12 +42,12 @@ protected:
nsISupports* mContext;
};
class nsFtpOnStartBindingEvent : public nsFtpStreamListenerEvent
class nsFtpOnStartRequestEvent : public nsFtpStreamListenerEvent
{
public:
nsFtpOnStartBindingEvent(nsIStreamListener* listener, nsISupports* context)
nsFtpOnStartRequestEvent(nsIStreamListener* listener, nsISupports* context)
: nsFtpStreamListenerEvent(listener, context) {}
virtual ~nsFtpOnStartBindingEvent() {}
virtual ~nsFtpOnStartRequestEvent() {}
NS_IMETHOD HandleEvent();
};
@ -71,13 +71,13 @@ protected:
};
class nsFtpOnStopBindingEvent : public nsFtpStreamListenerEvent
class nsFtpOnStopRequestEvent : public nsFtpStreamListenerEvent
{
public:
nsFtpOnStopBindingEvent(nsIStreamListener* listener, nsISupports* context)
nsFtpOnStopRequestEvent(nsIStreamListener* listener, nsISupports* context)
: nsFtpStreamListenerEvent(listener, context),
mStatus(NS_OK), mMessage(nsnull) {}
virtual ~nsFtpOnStopBindingEvent();
virtual ~nsFtpOnStopRequestEvent();
nsresult Init(nsresult status, PRUnichar* aMsg);
NS_IMETHOD HandleEvent();

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

@ -90,6 +90,12 @@ NS_IMPL_RELEASE(nsHTTPChannel);
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
NS_IMETHODIMP
nsHTTPChannel::IsPending(PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTTPChannel::Cancel(void)
{

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

@ -55,6 +55,7 @@ public:
NS_DECL_ISUPPORTS
// nsIRequest methods:
NS_IMETHOD IsPending(PRBool *result);
NS_IMETHOD Cancel();
NS_IMETHOD Suspend();
NS_IMETHOD Resume();

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

@ -922,7 +922,7 @@ nsHTTPRequest::GetInputStream(nsIInputStream* *o_Stream)
}
NS_IMETHODIMP
nsHTTPRequest::OnStartBinding(nsISupports* i_pContext)
nsHTTPRequest::OnStartRequest(nsISupports* i_pContext)
{
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
("nsHTTPRequest [this=%x]. Starting to write request to server.\n",
@ -932,7 +932,7 @@ nsHTTPRequest::OnStartBinding(nsISupports* i_pContext)
}
NS_IMETHODIMP
nsHTTPRequest::OnStopBinding(nsISupports* i_pContext,
nsHTTPRequest::OnStopRequest(nsISupports* i_pContext,
nsresult iStatus,
const PRUnichar* i_pMsg)
{
@ -961,7 +961,7 @@ nsHTTPRequest::OnStopBinding(nsISupports* i_pContext,
//
// An error occurred when trying to write the request to the server!
//
// Call the consumer OnStopBinding(...) to end the request...
// Call the consumer OnStopRequest(...) to end the request...
//
else {
nsCOMPtr<nsIStreamListener> consumer;
@ -975,7 +975,7 @@ nsHTTPRequest::OnStopBinding(nsISupports* i_pContext,
(void) m_pConnection->GetResponseContext(getter_AddRefs(consumerContext));
rv = m_pConnection->GetResponseDataListener(getter_AddRefs(consumer));
if (consumer) {
consumer->OnStopBinding(consumerContext, iStatus, i_pMsg);
consumer->OnStopRequest(consumerContext, iStatus, i_pMsg);
}
rv = iStatus;
@ -984,20 +984,6 @@ nsHTTPRequest::OnStopBinding(nsISupports* i_pContext,
return rv;
}
NS_IMETHODIMP
nsHTTPRequest::OnStartRequest(nsISupports* i_pContext)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTTPRequest::OnStopRequest(nsISupports* i_pContext,
nsresult iStatus,
const PRUnichar* i_pMsg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTTPRequest::SetTransport(nsIChannel* i_pTransport)
{

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

@ -38,7 +38,7 @@ class nsHTTPChannel;
saved for later reuse.
This is also the observer class for writing to the transport. This
receives notifications of OnStartBinding and OnStopBinding as the
receives notifications of OnStartRequest and OnStopRequest as the
request is being written out to the server. Each instance of this
class is tied to the corresponding transport that it writes the
request to.
@ -239,12 +239,10 @@ public:
NS_IMETHOD GetUserAgent(char* *o_Value);
// nsIStreamObserver functions
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
// Finally our own methods...
/*

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

@ -36,19 +36,19 @@ nsHTTPRequestObserver::~nsHTTPRequestObserver()
NS_IMPL_ISUPPORTS(nsHTTPRequestObserver,nsCOMTypeInfo<nsIStreamObserver>::GetIID());
NS_IMETHODIMP
nsHTTPRequestObserver::OnStartBinding(nsISupports* /*i_pContext*/)
nsHTTPRequestObserver::OnStartRequest(nsISupports* /*i_pContext*/)
{
//TODO globally replace printf with trace calls.
//printf("nsHTTPRequestObserver::OnStartBinding...\n");
//printf("nsHTTPRequestObserver::OnStartRequest...\n");
return NS_OK;
}
NS_IMETHODIMP
nsHTTPRequestObserver::OnStopBinding(nsISupports* i_pContext,
nsHTTPRequestObserver::OnStopRequest(nsISupports* i_pContext,
nsresult iStatus,
const PRUnichar* i_pMsg)
{
//printf("nsHTTPRequestObserver::OnStopBinding...\n");
//printf("nsHTTPRequestObserver::OnStopRequest...\n");
// if we could write successfully...
if (NS_SUCCEEDED(iStatus))
{

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

@ -24,7 +24,7 @@ class nsIChannel;
/*
The nsHTTPRequestObserver class is the request writer observer that
receives notifications of OnStartBinding and OnStopBinding as the
receives notifications of OnStartRequest and OnStopRequest as the
request is being written out to the server. Each instance of this
class is tied to the corresponding transport that it writes the
request to.
@ -51,9 +51,9 @@ public:
NS_DECL_ISUPPORTS
// nsIStreamObserver functions
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);

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

@ -30,8 +30,8 @@ class nsIHTTPChannel;
/*
The nsHTTPResponseListener class is the response reader listener that
receives notifications of OnStartBinding, OnDataAvailable and
OnStopBinding as the data is received from the server. Each instance
receives notifications of OnStartRequest, OnDataAvailable and
OnStopRequest as the data is received from the server. Each instance
of this class is tied to the corresponding transport that it reads the
response data stream from.
@ -62,13 +62,11 @@ public:
PRUint32 aLength);
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
protected:
// nsHTTPResponseListener methods...

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

@ -20,6 +20,7 @@ DEPTH = ..\..
MODULE = necko
DIRS= \
about \
file \
resource \
ftp \

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

@ -102,7 +102,7 @@ public:
return NS_OK;
}
NS_IMETHOD OnStartBinding(nsISupports* context) {
NS_IMETHOD OnStartRequest(nsISupports* context) {
PR_EnterMonitor(mMonitor);
printf("start binding\n");
mStartTime = PR_IntervalNow();
@ -128,7 +128,7 @@ public:
return NS_OK;
}
NS_IMETHOD OnStopBinding(nsISupports* context,
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
nsresult rv;
@ -145,16 +145,6 @@ public:
return rv;
}
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
protected:
nsIEventQueue* mEventQueue;
PRIntervalTime mStartTime;
@ -202,7 +192,7 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
nsFileSpec spec(path);
PRUint32 sourceOffset = 0;
rv = reader->OnStartBinding(nsnull);
rv = reader->OnStartRequest(nsnull);
if (NS_FAILED(rv)) goto done; // XXX should this abort the transfer?
rv = NS_NewTypicalInputFileStream(&fs, spec);
@ -242,7 +232,7 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
NS_IF_RELEASE(bufStr);
NS_IF_RELEASE(fileStr);
rv = reader->OnStopBinding(nsnull, rv, nsnull);
rv = reader->OnStopRequest(nsnull, rv, nsnull);
return rv;
}

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

@ -180,27 +180,16 @@ public:
NS_DECL_ISUPPORTS
// IStreamListener interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnDataAvailable(nsISupports* context,
nsIInputStream *aIStream,
PRUint32 aSourceOffset,
PRUint32 aLength);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
};
@ -218,7 +207,7 @@ NS_IMPL_ISUPPORTS(InputTestConsumer,nsCOMTypeInfo<nsIStreamListener>::GetIID());
NS_IMETHODIMP
InputTestConsumer::OnStartBinding(nsISupports* context)
InputTestConsumer::OnStartRequest(nsISupports* context)
{
URLLoadInfo* info = (URLLoadInfo*)context;
if (info) {
@ -274,7 +263,7 @@ InputTestConsumer::OnDataAvailable(nsISupports* context,
NS_IMETHODIMP
InputTestConsumer::OnStopBinding(nsISupports* context,
InputTestConsumer::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{

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

@ -52,26 +52,16 @@ public:
NS_DECL_ISUPPORTS
// IStreamListener interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnDataAvailable(nsISupports* context,
nsIInputStream *aIStream,
PRUint32 aSourceOffset,
PRUint32 aLength);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
};
@ -91,9 +81,9 @@ NS_IMPL_ISUPPORTS(InputTestConsumer,kIStreamListenerIID);
NS_IMETHODIMP
InputTestConsumer::OnStartBinding(nsISupports* context)
InputTestConsumer::OnStartRequest(nsISupports* context)
{
printf("\n+++ InputTestConsumer::OnStartBinding +++\n");
printf("\n+++ InputTestConsumer::OnStartRequest +++\n");
return NS_OK;
}
@ -117,12 +107,12 @@ InputTestConsumer::OnDataAvailable(nsISupports* context,
NS_IMETHODIMP
InputTestConsumer::OnStopBinding(nsISupports* context,
InputTestConsumer::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
gKeepRunning = 0;
printf("\n+++ InputTestConsumer::OnStopBinding (status = %x) +++\n", aStatus);
printf("\n+++ InputTestConsumer::OnStopRequest (status = %x) +++\n", aStatus);
return NS_OK;
}
@ -139,22 +129,11 @@ public:
NS_DECL_ISUPPORTS
// IStreamObserver interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
protected:
nsIChannel* mTransport;
@ -178,19 +157,19 @@ NS_IMPL_ISUPPORTS(TestWriteObserver,nsCOMTypeInfo<nsIStreamObserver>::GetIID());
NS_IMETHODIMP
TestWriteObserver::OnStartBinding(nsISupports* context)
TestWriteObserver::OnStartRequest(nsISupports* context)
{
printf("\n+++ TestWriteObserver::OnStartBinding +++\n");
printf("\n+++ TestWriteObserver::OnStartRequest +++\n");
return NS_OK;
}
NS_IMETHODIMP
TestWriteObserver::OnStopBinding(nsISupports* context,
TestWriteObserver::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
printf("\n+++ TestWriteObserver::OnStopBinding (status = %x) +++\n", aStatus);
printf("\n+++ TestWriteObserver::OnStopRequest (status = %x) +++\n", aStatus);
if (NS_SUCCEEDED(aStatus)) {
mTransport->AsyncRead(0, -1, nsnull, new InputTestConsumer);

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

@ -46,26 +46,16 @@ public:
NS_DECL_ISUPPORTS
// IStreamListener interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnDataAvailable(nsISupports* context,
nsIInputStream *aIStream,
PRUint32 aSourceOffset,
PRUint32 aLength);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
};
@ -85,9 +75,9 @@ NS_IMPL_ISUPPORTS(InputTestConsumer,kIStreamListenerIID);
NS_IMETHODIMP
InputTestConsumer::OnStartBinding(nsISupports* context)
InputTestConsumer::OnStartRequest(nsISupports* context)
{
printf("+++ OnStartBinding +++\n");
printf("+++ OnStartRequest +++\n");
return NS_OK;
}
@ -112,12 +102,12 @@ InputTestConsumer::OnDataAvailable(nsISupports* context,
NS_IMETHODIMP
InputTestConsumer::OnStopBinding(nsISupports* context,
InputTestConsumer::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
gKeepRunning = 0;
printf("+++ OnStopBinding +++\n");
printf("+++ OnStopRequest +++\n");
return NS_OK;
}

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

@ -122,26 +122,16 @@ public:
NS_DECL_ISUPPORTS
// IStreamListener interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnDataAvailable(nsISupports* context,
nsIInputStream *aIStream,
PRUint32 aSourceOffset,
PRUint32 aLength);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
TestConnection* mConnection;
PRInt32 mBytesRead;
@ -168,9 +158,9 @@ NS_IMPL_ISUPPORTS(InputConsumer,nsCOMTypeInfo<nsIStreamListener>::GetIID());
NS_IMETHODIMP
InputConsumer::OnStartBinding(nsISupports* context)
InputConsumer::OnStartRequest(nsISupports* context)
{
printf("\n+++ InputConsumer::OnStartBinding +++. Context = %p\n", context);
printf("\n+++ InputConsumer::OnStartRequest +++. Context = %p\n", context);
return NS_OK;
}
@ -204,11 +194,11 @@ InputConsumer::OnDataAvailable(nsISupports* context,
NS_IMETHODIMP
InputConsumer::OnStopBinding(nsISupports* context,
InputConsumer::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
printf("\n+++ InputConsumer::OnStopBinding (status = %x) +++. Context = %p\n", aStatus, context);
printf("\n+++ InputConsumer::OnStopRequest (status = %x) +++. Context = %p\n", aStatus, context);
mConnection->Lock();
mConnection->Notify();
mConnection->Unlock();
@ -233,21 +223,11 @@ public:
NS_DECL_ISUPPORTS
// IStreamObserver interface...
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg);
NS_IMETHOD OnStartRequest(nsISupports* context) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
const PRUnichar* aMsg);
protected:
TestConnection* mConnection;
@ -272,21 +252,21 @@ NS_IMPL_ISUPPORTS(OutputObserver,nsCOMTypeInfo<nsIStreamObserver>::GetIID());
NS_IMETHODIMP
OutputObserver::OnStartBinding(nsISupports* context)
OutputObserver::OnStartRequest(nsISupports* context)
{
printf("\n+++ OutputObserver::OnStartBinding +++. Context = %p\n", context);
printf("\n+++ OutputObserver::OnStartRequest +++. Context = %p\n", context);
return NS_OK;
}
NS_IMETHODIMP
OutputObserver::OnStopBinding(nsISupports* context,
OutputObserver::OnStopRequest(nsISupports* context,
nsresult aStatus,
const PRUnichar* aMsg)
{
/// mConnection->Lock();
printf("\n+++ OutputObserver::OnStopBinding (status = %x) +++. Context = %p\n", aStatus, context);
printf("\n+++ OutputObserver::OnStopRequest (status = %x) +++. Context = %p\n", aStatus, context);
/// mConnection->Notify();
/// mConnection->Unlock();

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

@ -69,9 +69,9 @@ public:
PRUint32 aLength);
// stream observer methods
NS_IMETHOD OnStartBinding(nsISupports* context);
NS_IMETHOD OnStartRequest(nsISupports* context);
NS_IMETHOD OnStopBinding(nsISupports* context,
NS_IMETHOD OnStopRequest(nsISupports* context,
nsresult aStatus,
nsIString* aMsg);
@ -124,17 +124,17 @@ NS_IMETHODIMP TestConsumer::OnDataAvailable(nsISupports *context,
return 0;
}
NS_IMETHODIMP TestConsumer::OnStartBinding(nsISupports *context) {
NS_IMETHODIMP TestConsumer::OnStartRequest(nsISupports *context) {
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStartBinding: URL: %p, Content type: %s\n", mUrl, "XXX some context");
printf("\n+++ TestConsumer::OnStartRequest: URL: %p, Content type: %s\n", mUrl, "XXX some context");
}
return 0;
}
NS_IMETHODIMP TestConsumer::OnStopBinding(nsISupports *context, nsresult aStatus, nsIString *aMsg) {
NS_IMETHODIMP TestConsumer::OnStopRequest(nsISupports *context, nsresult aStatus, nsIString *aMsg) {
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStopBinding... URL: %p status: %d\n", mUrl, aStatus);
printf("\n+++ TestConsumer::OnStopRequest... URL: %p status: %d\n", mUrl, aStatus);
}
if (NS_FAILED(aStatus)) {

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

@ -52,6 +52,6 @@ extern nsresult
NS_MakeAbsoluteURI(const nsString& spec, nsIURI* baseURI, nsString& result);
extern nsresult
NS_NewLoadGroup(nsILoadGroup* *result);
NS_NewLoadGroup(nsILoadGroup* parent, nsILoadGroup* *result);
#endif // nsNeckoUtil_h__

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