зеркало из https://github.com/mozilla/pjs.git
Factored string bundles out of necko. Fixes bug 42107 - need to fix string bundle init workaround. Also bug 40506 - nsIWebProgressListener needs status text. Status messages now work in mozilla and viewer with internationalized and parameterized text! Added temporary error architecture until bug 13423 can be fixed. Extended nsIStringBundleService to provide method to format status message. r=valeski,jband,tao. verified=mstoltz
This commit is contained in:
Родитель
03425ff7a3
Коммит
7ac7233df8
|
@ -2308,7 +2308,18 @@ nsDocShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLocationChange(nsIURI *aURI)
|
||||
nsDocShell::OnLocationChange(nsIWebProgress *aProgress,
|
||||
nsIRequest *aRequest,
|
||||
nsIURI *aURI)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3275,7 +3286,7 @@ void nsDocShell::SetCurrentURI(nsIURI* aURI)
|
|||
|
||||
NS_ASSERTION(loader, "No document loader");
|
||||
if (loader) {
|
||||
loader->FireOnLocationChange(aURI);
|
||||
loader->FireOnLocationChange(nsnull, nsnull, aURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,13 +263,23 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
|
||||
|
||||
/* void onLocationChange (in nsIURI location); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIURI *location)
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *location)
|
||||
{
|
||||
// nsXPIDLCString aPath;
|
||||
// location->GetPath(getter_Copies(aPath));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURIContentListener
|
||||
|
|
|
@ -680,7 +680,9 @@ NS_IMETHODIMP GtkMozEmbedChrome::OnStateChange(nsIWebProgress *progress, nsIRequ
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnLocationChange(nsIURI *aLocation)
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *aLocation)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnLocationChange\n"));
|
||||
char *newURIString = NULL;
|
||||
|
@ -694,6 +696,15 @@ NS_IMETHODIMP GtkMozEmbedChrome::OnLocationChange(nsIURI *aLocation)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GtkMozEmbedChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIBaseWindow interface
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::InitWindow(nativeWindow parentNativeWindow,
|
||||
|
|
|
@ -680,7 +680,9 @@ NS_IMETHODIMP MozEmbedChrome::OnStateChange(nsIWebProgress *progress, nsIRequest
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MozEmbedChrome::OnLocationChange(nsIURI *aLocation)
|
||||
NS_IMETHODIMP MozEmbedChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *aLocation)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("MozEmbedChrome::OnLocationChange\n"));
|
||||
char *newURIString = NULL;
|
||||
|
@ -694,6 +696,15 @@ NS_IMETHODIMP MozEmbedChrome::OnLocationChange(nsIURI *aLocation)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MozEmbedChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIBaseWindow interface
|
||||
|
||||
NS_IMETHODIMP MozEmbedChrome::InitWindow(nativeWindow parentNativeWindow,
|
||||
|
|
|
@ -277,7 +277,9 @@ NS_IMETHODIMP CWebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequ
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnLocationChange(nsIURI *location)
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *location)
|
||||
{
|
||||
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -295,6 +297,14 @@ NS_IMETHODIMP CWebBrowserChrome::OnLocationChange(nsIURI *location)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CWebBrowserChrome::nsIBaseWindow
|
||||
|
|
|
@ -452,12 +452,26 @@ nsDocShellTreeOwner::OnStateChange(nsIWebProgress* aProgress,
|
|||
aStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnLocationChange(nsIURI* aURI)
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnLocationChange(aURI);
|
||||
return mOwnerProgressListener->OnLocationChange(aWebProgress, aRequest, aURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -215,11 +215,21 @@ NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIReque
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIURI *location)
|
||||
NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *location)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// WebBrowserChrome::nsIBaseWindow
|
||||
|
|
|
@ -339,7 +339,7 @@ NS_IMETHODIMP
|
|||
nsDateTimeChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
if (mLoadGroup) // if we already had a load group remove ourselves...
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
|
||||
mLoadGroup = aLoadGroup;
|
||||
if (mLoadGroup) {
|
||||
|
@ -394,12 +394,12 @@ nsDateTimeChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
if (mLoadGroup) {
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -443,7 +443,8 @@ nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
#ifdef DEBUG_bryner
|
||||
printf("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n",
|
||||
mActAsObserver);
|
||||
|
@ -453,10 +454,10 @@ nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
|||
|
||||
if (NS_FAILED(aStatus) || !mActAsObserver) {
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
mTransport = 0;
|
||||
return rv;
|
||||
} else {
|
||||
|
|
|
@ -446,7 +446,9 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::OnLocationChange(nsIURI* aLocation)
|
||||
nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aLocation)
|
||||
{
|
||||
mCurrentURI = aLocation;
|
||||
|
||||
|
@ -459,6 +461,14 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIURI* aLocation)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSecureBrowserUIImpl::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSecureBrowserUIImpl::IsURLHTTPS(nsIURI* aURL, PRBool* value)
|
||||
|
|
|
@ -2030,13 +2030,15 @@ nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgr
|
|||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult
|
||||
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext, const PRUnichar* aMsg)
|
||||
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult result=0;
|
||||
nsresult rv;
|
||||
if (nsnull != mProgressEventSink) {
|
||||
mProgressEventSink->OnStatus(channel, aContext, aMsg);
|
||||
rv = mProgressEventSink->OnStatus(channel, aContext, aStatus, aStatusArg);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
return result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef rickgdebug
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsHTMLTags.h"
|
||||
#include "nsDTDUtils.h"
|
||||
#include "nsTimer.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
class IContentSink;
|
||||
class nsIDTD;
|
||||
|
@ -250,9 +251,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser,
|
|||
// These methods are callback methods used by
|
||||
// net lib to let us know about our inputstream.
|
||||
//*********************************************
|
||||
// nsIProgressEventSink methods:
|
||||
NS_IMETHOD OnProgress(nsIChannel* channel, nsISupports* context, PRUint32 Progress, PRUint32 ProgressMax);
|
||||
NS_IMETHOD OnStatus(nsIChannel* channel, nsISupports* context, const PRUnichar* aMmsg);
|
||||
NS_DECL_NSIPROGRESSEVENTSINK
|
||||
|
||||
// nsIStreamObserver methods:
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
|
|
|
@ -73,4 +73,14 @@ interface nsIStringBundleService : nsISupports
|
|||
|
||||
nsIStringBundle CreateExtensibleBundle([const] in string aRegistryKey,
|
||||
in nsILocale aLocale);
|
||||
|
||||
/**
|
||||
* Formats a message string from a status code and status arguments.
|
||||
* @param aStatus - The status code. This is mapped into a string ID and
|
||||
* and used in the string lookup process (see nsIErrorService).
|
||||
* @param aStatusArg - The status message argument(s). Multiple arguments
|
||||
* can be separated by newline ('\n') characters.
|
||||
* @return the formatted message
|
||||
*/
|
||||
wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
|
||||
};
|
||||
|
|
|
@ -49,12 +49,14 @@
|
|||
#include "nsAutoLock.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIErrorService.h"
|
||||
|
||||
#include "nsAcceptLang.h" // for nsIAcceptLang
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
|
||||
|
||||
// XXX investigate need for proper locking in this module
|
||||
//static PRInt32 gLockCount = 0;
|
||||
|
@ -181,7 +183,8 @@ nsStringBundle::FormatStringFromName(const PRUnichar *aName,
|
|||
PRUnichar **aResult)
|
||||
{
|
||||
nsAutoString formatStr;
|
||||
GetStringFromName(aName, formatStr);
|
||||
nsresult rv = GetStringFromName(aName, formatStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return FormatString(formatStr.GetUnicode(), aParams, aLength, aResult);
|
||||
}
|
||||
|
@ -657,6 +660,9 @@ public:
|
|||
private:
|
||||
nsresult getStringBundle(const char *aUrl, nsILocale* aLocale,
|
||||
nsIStringBundle** aResult);
|
||||
nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
|
||||
PRUint32 argCount, PRUnichar** argArray,
|
||||
PRUnichar* *result);
|
||||
|
||||
bundleCacheEntry_t *insertIntoCache(nsIStringBundle *aBundle,
|
||||
nsStringKey *aHashKey);
|
||||
|
@ -669,6 +675,7 @@ private:
|
|||
|
||||
// reuse the same uri structure over and over
|
||||
nsCOMPtr<nsIURI> mScratchUri;
|
||||
nsCOMPtr<nsIErrorService> mErrorService;
|
||||
};
|
||||
|
||||
nsStringBundleService::nsStringBundleService() :
|
||||
|
@ -686,6 +693,8 @@ nsStringBundleService::nsStringBundleService() :
|
|||
|
||||
mScratchUri = do_CreateInstance(kStandardUrlCID);
|
||||
NS_ASSERTION(mScratchUri, "Couldn't create scratch URI");
|
||||
mErrorService = do_GetService(kErrorServiceCID);
|
||||
NS_ASSERTION(mErrorService, "Couldn't get error service");
|
||||
}
|
||||
|
||||
nsStringBundleService::~nsStringBundleService()
|
||||
|
@ -855,6 +864,119 @@ nsStringBundleService::CreateExtensibleBundle(const char* aRegistryKey,
|
|||
return res;
|
||||
}
|
||||
|
||||
#define GLOBAL_PROPERTIES "chrome://global/locale/xpcom.properties"
|
||||
|
||||
nsresult
|
||||
nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
|
||||
PRUint32 argCount, PRUnichar** argArray,
|
||||
PRUnichar* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString key;
|
||||
|
||||
// then find a key into the string bundle for that particular error:
|
||||
rv = mErrorService->GetErrorStringBundleKey(aStatus, getter_Copies(key));
|
||||
|
||||
// first try looking up the error message with the string key:
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString name; name.AssignWithConversion(key);
|
||||
rv = bundle->FormatStringFromName(name.GetUnicode(), (const PRUnichar**)argArray,
|
||||
argCount, result);
|
||||
}
|
||||
|
||||
// if the string key fails, try looking up the error message with the int key:
|
||||
if (NS_FAILED(rv)) {
|
||||
PRUint16 code = NS_ERROR_GET_CODE(aStatus);
|
||||
rv = bundle->FormatStringFromID(code, (const PRUnichar**)argArray, argCount, result);
|
||||
}
|
||||
|
||||
// If the int key fails, try looking up the default error message. E.g. print:
|
||||
// An unknown error has occurred (0x804B0003).
|
||||
if (NS_FAILED(rv)) {
|
||||
nsAutoString statusStr; statusStr.AppendInt(aStatus, 16);
|
||||
const PRUnichar* otherArgArray[1];
|
||||
otherArgArray[0] = statusStr.GetUnicode();
|
||||
PRUint16 code = NS_ERROR_GET_CODE(NS_ERROR_FAILURE);
|
||||
rv = bundle->FormatStringFromID(code, otherArgArray, 1, result);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::FormatStatusMessage(nsresult aStatus,
|
||||
const PRUnichar* aStatusArg,
|
||||
PRUnichar* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 i, argCount = 0;
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsXPIDLCString stringBundleURL;
|
||||
|
||||
// XXX hack for mailnews who has already formatted their messages:
|
||||
if (aStatus == NS_OK && aStatusArg) {
|
||||
*result = nsCRT::strdup(aStatusArg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aStatus == NS_OK) {
|
||||
return NS_ERROR_FAILURE; // no message to format
|
||||
}
|
||||
|
||||
// format the arguments:
|
||||
nsAutoString args(aStatusArg);
|
||||
argCount = args.CountChar('\n') + 1;
|
||||
NS_ENSURE_ARG(argCount <= 10); // enforce 10-parameter limit
|
||||
PRUnichar* argArray[10];
|
||||
|
||||
// convert the aStatusArg into a PRUnichar array
|
||||
if (argCount == 1) {
|
||||
// avoid construction for the simple case:
|
||||
argArray[0] = (PRUnichar*)aStatusArg;
|
||||
}
|
||||
else if (argCount > 1) {
|
||||
PRInt32 offset = 0;
|
||||
for (i = 0; i < argCount; i++) {
|
||||
PRInt32 pos = args.FindChar('\n', PR_FALSE, offset);
|
||||
if (pos = -1)
|
||||
pos = args.Length();
|
||||
nsAutoString arg;
|
||||
args.Mid(arg, offset, pos);
|
||||
argArray[i] = arg.ToNewUnicode();
|
||||
if (argArray[i] == nsnull) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
argCount = i - 1; // don't try to free uninitialized memory
|
||||
goto done;
|
||||
}
|
||||
offset = pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// find the string bundle for the error's module:
|
||||
rv = mErrorService->GetErrorStringBundle(NS_ERROR_GET_MODULE(aStatus),
|
||||
getter_Copies(stringBundleURL));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = getStringBundle(stringBundleURL, nsnull, getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = FormatWithBundle(bundle, aStatus, argCount, argArray, result);
|
||||
}
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = getStringBundle(GLOBAL_PROPERTIES, nsnull, getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = FormatWithBundle(bundle, aStatus, argCount, argArray, result);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (argCount > 1) {
|
||||
for (i = 0; i < argCount; i++) {
|
||||
if (argArray[i])
|
||||
nsMemory::Free(argArray[i]);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewStringBundleService(nsISupports* aOuter, const nsIID& aIID,
|
||||
|
|
|
@ -138,7 +138,18 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnLocationChange(nsIURI* aLocation)
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aLocation)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgStatusFeedback::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -340,7 +351,15 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIChannel* channel, nsISupports*
|
|||
aProgress /* current total progress */, aProgressMax /* max total progress */);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIChannel* channel, nsISupports* ctxt, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIChannel* channel, nsISupports* ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return ShowStatusString(aMsg);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString str;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString msg = str;
|
||||
return ShowStatusString(msg.GetUnicode());
|
||||
}
|
||||
|
|
|
@ -410,7 +410,19 @@ nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsURLFetcher::OnLocationChange(nsIURI *aURI)
|
||||
nsURLFetcher::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *aURI)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsURLFetcher::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -3563,7 +3563,7 @@ nsImapMailFolder::ProgressStatus(nsIImapProtocol* aProtocol,
|
|||
nsTextFormatter::smprintf_free(printfString);
|
||||
}
|
||||
}
|
||||
progressSink->OnStatus(mockChannel, nsnull, progressMsg);
|
||||
progressSink->OnStatus(mockChannel, nsnull, NS_OK, progressMsg); // XXX i18n message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3592,7 +3592,7 @@ nsImapMailFolder::PercentProgress(nsIImapProtocol* aProtocol,
|
|||
{
|
||||
progressSink->OnProgress(mockChannel, nsnull, aInfo->currentProgress, aInfo->maxProgress);
|
||||
if (aInfo->message)
|
||||
progressSink->OnStatus(mockChannel, nsnull, aInfo->message);
|
||||
progressSink->OnStatus(mockChannel, nsnull, NS_OK, aInfo->message); // XXX i18n message
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -481,8 +481,11 @@ void nsPop3Protocol::UpdateStatus(PRInt32 aStatusID)
|
|||
|
||||
void nsPop3Protocol::UpdateStatusWithString(PRUnichar * aStatusString)
|
||||
{
|
||||
if (mProgressEventSink)
|
||||
mProgressEventSink->OnStatus(this, m_channelContext, aStatusString);
|
||||
nsresult rv;
|
||||
if (mProgressEventSink) {
|
||||
rv = mProgressEventSink->OnStatus(this, m_channelContext, NS_OK, aStatusString); // XXX i18n message
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
}
|
||||
|
||||
void nsPop3Protocol::UpdateProgressPercent (PRUint32 totalDone, PRUint32 total)
|
||||
|
@ -674,6 +677,8 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
|
|||
server->SetServerBusy(PR_TRUE); // the server is now busy
|
||||
}
|
||||
|
||||
m_pop3ConData->uidlinfo = net_pop3_load_state(host, GetUsername(), mailDirectory);
|
||||
|
||||
m_pop3ConData->uidlinfo = net_pop3_load_state(host, GetUsername(), mailDirectory);
|
||||
m_pop3ConData->biffstate = nsIMsgFolder::nsMsgBiffState_NoMail;
|
||||
|
||||
|
|
|
@ -5014,12 +5014,14 @@ void nsNNTPProtocol::SetProgressBarPercent(PRUint32 aProgress, PRUint32 aProgres
|
|||
void
|
||||
nsNNTPProtocol::SetProgressStatus(char *message)
|
||||
{
|
||||
nsresult rv;
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("nsNNTPProtocol::SetProgressStatus(%s)",message));
|
||||
if (mProgressEventSink)
|
||||
{
|
||||
nsAutoString formattedString;
|
||||
formattedString.AssignWithConversion(message);
|
||||
mProgressEventSink->OnStatus(this, m_channelContext, formattedString.GetUnicode());
|
||||
rv = mProgressEventSink->OnStatus(this, m_channelContext, NS_OK, formattedString.GetUnicode()); // XXX i18n message
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,10 +72,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* jarCacheTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg) {
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* jarCacheTransport, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoMonitor monitor(mJARChannel->mMonitor);
|
||||
|
||||
|
@ -88,11 +86,11 @@ public:
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar download complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
(const char*)jarURLStr, aStatus));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (NS_SUCCEEDED(status) && mJARChannel->mJarCacheTransport) {
|
||||
if (NS_SUCCEEDED(aStatus) && mJARChannel->mJarCacheTransport) {
|
||||
NS_ASSERTION(jarCacheTransport == (mJARChannel->mJarCacheTransport).get(),
|
||||
"wrong transport");
|
||||
// after successfully downloading the jar file to the cache,
|
||||
|
@ -528,7 +526,7 @@ nsJARChannel::EnsureJARFileAvailable(OnJARFileAvailableFun onJARFileAvailable,
|
|||
|
||||
error:
|
||||
if (NS_FAILED(rv) && mLoadGroup) {
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, rv, nsnull); // XXX fix error message
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed");
|
||||
}
|
||||
return rv;
|
||||
|
@ -864,10 +862,8 @@ nsJARChannel::OnStartRequest(nsIChannel* jarExtractionTransport,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg)
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -877,14 +873,14 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar extraction complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
(const char*)jarURLStr, aStatus));
|
||||
}
|
||||
#endif
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, status, aMsg);
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, status, aMsg);
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1171,7 +1171,8 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIChannel* channel,
|
|||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIChannel* channel,
|
||||
nsISupports* aContext,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aStatusArg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1171,7 +1171,8 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnProgress(nsIChannel* channel,
|
|||
|
||||
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStatus(nsIChannel* channel,
|
||||
nsISupports* aContext,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aStatusArg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -61,4 +61,7 @@
|
|||
#endif /* !XP_PC */
|
||||
#endif /* !_IMPL_NS_NET */
|
||||
|
||||
// Where most necko status messages come from:
|
||||
#define NECKO_MSGS_URL "chrome://necko/locale/necko.properties"
|
||||
|
||||
#endif // __netCore_h__
|
||||
|
|
|
@ -74,4 +74,11 @@ interface nsIFileTransportService : nsISupports
|
|||
0x11d2, \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Status nsresult codes: used with nsIProgressEventSink::OnStatus
|
||||
*/
|
||||
#define NS_NET_STATUS_READ_FROM NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 8)
|
||||
#define NS_NET_STATUS_WROTE_TO NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 9)
|
||||
|
||||
%}
|
||||
|
|
|
@ -28,7 +28,6 @@ interface nsIStreamObserver;
|
|||
interface nsIStreamListener;
|
||||
interface nsIInputStream;
|
||||
|
||||
|
||||
[scriptable, uuid(60fdf550-5392-11d3-9a97-0080c7cb1080)]
|
||||
interface nsILoadGroupListenerFactory : nsISupports
|
||||
{
|
||||
|
@ -75,7 +74,7 @@ interface nsILoadGroup : nsIRequest
|
|||
void removeChannel(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
in wstring statusArg);
|
||||
|
||||
/**
|
||||
* Returns the channels contained directly in this group.
|
||||
|
|
|
@ -43,9 +43,18 @@ interface nsIProgressEventSink : nsISupports
|
|||
|
||||
/**
|
||||
* Notify the EventSink with a status message for the URL load.<BR>
|
||||
* @param status - A status code denoting the type of notification. This
|
||||
* can be a message to be displayed (e.g. for file I/O,
|
||||
* STATUS_READ_FROM, or STATUS_WROTE_TO), or can be an event
|
||||
* to be programmatically handled.
|
||||
* @param statusArg - An argument or arguments to the status notification.
|
||||
* These arguments will be formatted into any status or error
|
||||
* message. Multiple arguments can be passed by delimiting them
|
||||
* with newline ('\n') characters.
|
||||
*/
|
||||
void onStatus(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in wstring aMsg);
|
||||
in nsresult status,
|
||||
in wstring statusArg);
|
||||
|
||||
};
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
[scriptable, uuid(785CA0F0-C39E-11d3-9ED6-0010A4053FD0)]
|
||||
interface nsISocketTransport : nsISupports
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
attribute boolean reuseConnection;
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,4 +99,13 @@ interface nsISocketTransportService : nsISupports
|
|||
|
||||
#define NS_ERROR_NET_TIMEOUT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 14)
|
||||
|
||||
/**
|
||||
* Status nsresult codes: used with nsIProgressEventSink::OnStatus
|
||||
*/
|
||||
#define NS_NET_STATUS_RESOLVING_HOST NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3)
|
||||
#define NS_NET_STATUS_CONNECTED_TO NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4)
|
||||
#define NS_NET_STATUS_SENDING_TO NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 5)
|
||||
#define NS_NET_STATUS_RECEIVING_FROM NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 6)
|
||||
#define NS_NET_STATUS_CONNECTING_TO NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 7)
|
||||
|
||||
%}
|
||||
|
|
|
@ -28,13 +28,21 @@ interface nsIChannel;
|
|||
[scriptable, uuid(fd91e2e0-1481-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamObserver : nsISupports
|
||||
{
|
||||
/**
|
||||
* Called to signify the beginning of an asyncronous request.
|
||||
*/
|
||||
void onStartRequest(in nsIChannel channel,
|
||||
in nsISupports ctxt);
|
||||
|
||||
/**
|
||||
* Called to signify the end of an asyncronous request.
|
||||
* @param notif - a notification object containing any error code and error parameters
|
||||
* (may be null if the notification status is NS_OK)
|
||||
*/
|
||||
void onStopRequest(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
in wstring statusArg);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -254,15 +254,15 @@ public:
|
|||
nsOnStopRequestEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context, nsIChannel* channel)
|
||||
: nsStreamListenerEvent(listener, channel, context),
|
||||
mStatus(NS_OK), mMessage(nsnull) {}
|
||||
mStatus(NS_OK) {}
|
||||
virtual ~nsOnStopRequestEvent();
|
||||
|
||||
nsresult Init(nsresult status, const PRUnichar* aMsg);
|
||||
nsresult Init(nsresult aStatus, const PRUnichar* aStatusArg);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsresult mStatus;
|
||||
PRUnichar* mMessage;
|
||||
nsString mStatusArg;
|
||||
};
|
||||
|
||||
nsOnStopRequestEvent::~nsOnStopRequestEvent()
|
||||
|
@ -270,10 +270,10 @@ nsOnStopRequestEvent::~nsOnStopRequestEvent()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsOnStopRequestEvent::Init(nsresult status, const PRUnichar* aMsg)
|
||||
nsOnStopRequestEvent::Init(nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
mStatus = status;
|
||||
mMessage = (PRUnichar*)aMsg;
|
||||
mStatus = aStatus;
|
||||
mStatusArg = aStatusArg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -298,13 +298,12 @@ nsOnStopRequestEvent::HandleEvent()
|
|||
if (NS_SUCCEEDED(rv) && NS_FAILED(status)) {
|
||||
mStatus = status;
|
||||
}
|
||||
return receiver->OnStopRequest(mChannel, mContext, mStatus, mMessage);
|
||||
return receiver->OnStopRequest(mChannel, mContext, mStatus, mStatusArg.GetUnicode());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -317,7 +316,7 @@ nsAsyncStreamObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
|||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
rv = event->Init(aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
#if defined(PR_LOGGING)
|
||||
PLEventQueue *equeue;
|
||||
|
|
|
@ -73,10 +73,9 @@ public:
|
|||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStopRequest(channel, context, aStatus, aMsg);
|
||||
return nsAsyncStreamObserver::OnStopRequest(channel, context, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsIChannel* channel, nsISupports* context,
|
||||
|
|
|
@ -146,7 +146,7 @@ nsDirectoryIndexStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aReadCount)
|
|||
|
||||
// If anything is enqueued (or left-over) in mBuf, then feed it to
|
||||
// the reader first.
|
||||
while (mOffset < mBuf.Length() && aCount != 0) {
|
||||
while (mOffset < (PRInt32)mBuf.Length() && aCount != 0) {
|
||||
*(aBuf++) = char(mBuf.CharAt(mOffset++));
|
||||
--aCount;
|
||||
++nread;
|
||||
|
@ -260,7 +260,7 @@ nsDirectoryIndexStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aReadCount)
|
|||
|
||||
// ...and once we've either run out of directory entries, or
|
||||
// filled up the buffer, then we'll push it to the reader.
|
||||
while (mOffset < mBuf.Length() && aCount != 0) {
|
||||
while (mOffset < (PRInt32)mBuf.Length() && aCount != 0) {
|
||||
*(aBuf++) = char(mBuf.CharAt(mOffset++));
|
||||
--aCount;
|
||||
++nread;
|
||||
|
|
|
@ -374,8 +374,6 @@ nsFileTransport::Process(void)
|
|||
("nsFileTransport: OPEN_FOR_READ [this=%x %s]",
|
||||
this, mStreamName.GetBuffer()));
|
||||
mStatus = mStreamIO->Open(&mContentType, &mTotalAmount);
|
||||
|
||||
// if we're reading:
|
||||
if (mListener) {
|
||||
nsresult rv = mListener->OnStartRequest(this, mContext); // always send the start notification
|
||||
if (NS_SUCCEEDED(mStatus))
|
||||
|
@ -504,20 +502,18 @@ nsFileTransport::Process(void)
|
|||
|
||||
mSource = null_nsCOMPtr();
|
||||
|
||||
nsresult rv;
|
||||
if (mListener) {
|
||||
// XXX where do we get the done message?
|
||||
nsresult rv = mListener->OnStopRequest(this, mContext, mStatus, nsnull);
|
||||
rv = mListener->OnStopRequest(this, mContext, mStatus, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected OnStopRequest failure");
|
||||
mListener = null_nsCOMPtr();
|
||||
}
|
||||
if (mProgress && !(mLoadAttributes & LOAD_BACKGROUND)) {
|
||||
// XXX fix up this message for i18n
|
||||
nsAutoString msg;
|
||||
msg.AssignWithConversion("Read ");
|
||||
nsXPIDLCString spec;
|
||||
(void)
|
||||
msg.AppendWithConversion(mStreamName);
|
||||
(void)mProgress->OnStatus(this, mContext, msg.GetUnicode());
|
||||
nsAutoString fileName; fileName.AssignWithConversion(mStreamName);
|
||||
rv = mProgress->OnStatus(this, mContext,
|
||||
NS_NET_STATUS_READ_FROM,
|
||||
fileName.GetUnicode());
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected OnStopRequest failure");
|
||||
}
|
||||
mContext = null_nsCOMPtr();
|
||||
|
||||
|
@ -530,9 +526,10 @@ nsFileTransport::Process(void)
|
|||
("nsFileTransport: OPEN_FOR_WRITE [this=%x %s]",
|
||||
this, mStreamName.GetBuffer()));
|
||||
mStatus = mStreamIO->Open(&mContentType, &mTotalAmount);
|
||||
|
||||
if (mObserver) {
|
||||
mStatus = mObserver->OnStartRequest(this, mContext); // always send the start notification
|
||||
nsresult rv = mObserver->OnStartRequest(this, mContext); // always send the start notification
|
||||
if (NS_SUCCEEDED(mStatus))
|
||||
mStatus = rv;
|
||||
}
|
||||
|
||||
mXferState = NS_FAILED(mStatus) ? END_WRITE : START_WRITE;
|
||||
|
@ -666,17 +663,18 @@ nsFileTransport::Process(void)
|
|||
mSource = null_nsCOMPtr();
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (mObserver) {
|
||||
// XXX where do we get the done message?
|
||||
(void)mObserver->OnStopRequest(this, mContext, mStatus, nsnull);
|
||||
rv = mObserver->OnStopRequest(this, mContext, mStatus, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected OnStopRequest failure");
|
||||
mObserver = null_nsCOMPtr();
|
||||
}
|
||||
if (mProgress && !(mLoadAttributes & LOAD_BACKGROUND)) {
|
||||
// XXX fix up this message for i18n
|
||||
nsAutoString msg;
|
||||
msg.AssignWithConversion("Wrote ");
|
||||
msg.AssignWithConversion(mStreamName);
|
||||
(void)mProgress->OnStatus(this, mContext, msg.GetUnicode());
|
||||
nsAutoString fileName; fileName.AssignWithConversion(mStreamName);
|
||||
rv = mProgress->OnStatus(this, mContext,
|
||||
NS_NET_STATUS_WROTE_TO,
|
||||
fileName.GetUnicode());
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected OnStopRequest failure");
|
||||
}
|
||||
mContext = null_nsCOMPtr();
|
||||
|
||||
|
|
|
@ -32,11 +32,14 @@
|
|||
#include "nsLoadGroup.h"
|
||||
#include "nsInputStreamChannel.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIErrorService.h"
|
||||
#include "netCore.h"
|
||||
|
||||
static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
|
||||
static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -67,6 +70,26 @@ nsIOService::Init()
|
|||
NS_GET_IID(nsIDNSService),
|
||||
getter_AddRefs(mDNSService));
|
||||
|
||||
// XXX hack until xpidl supports error info directly (http://bugzilla.mozilla.org/show_bug.cgi?id=13423)
|
||||
nsCOMPtr<nsIErrorService> errorService = do_GetService(kErrorServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_NETWORK, NECKO_MSGS_URL);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_READ_FROM, "ReadFrom");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_WROTE_TO, "WroteTo");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_RESOLVING_HOST, "ResolvingHost");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_CONNECTED_TO, "ConnectedTo");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_SENDING_TO, "SendingTo");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_RECEIVING_FROM, "ReceivingFrom");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_CONNECTING_TO, "ConnectingTo");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -327,7 +327,8 @@ nsStreamIOChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
|
||||
done:
|
||||
if (NS_FAILED(rv)) {
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, ctxt, rv, nsnull); // XXX fix error message
|
||||
nsresult rv2;
|
||||
rv2 = mLoadGroup->RemoveChannel(this, ctxt, rv, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed");
|
||||
// release the transport so that we don't think we're in progress
|
||||
mFileTransport = nsnull;
|
||||
|
@ -389,7 +390,8 @@ nsStreamIOChannel::AsyncWrite(nsIInputStream *fromStream,
|
|||
|
||||
done:
|
||||
if (NS_FAILED(rv)) {
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, ctxt, rv, nsnull); // XXX fix error message
|
||||
nsresult rv2;
|
||||
rv2 = mLoadGroup->RemoveChannel(this, ctxt, rv, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed");
|
||||
// release the transport so that we don't think we're in progress
|
||||
mFileTransport = nsnull;
|
||||
|
@ -598,21 +600,24 @@ nsStreamIOChannel::OnStartRequest(nsIChannel* transportChannel, nsISupports* con
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsStreamIOChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = mUserObserver->OnStopRequest(this, context, aStatus, aMsg);
|
||||
rv = mUserObserver->OnStopRequest(this, context, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aMsg);
|
||||
rv = mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Release the reference to the consumer stream listener...
|
||||
mUserObserver = null_nsCOMPtr();
|
||||
mFileTransport = null_nsCOMPtr();
|
||||
|
||||
return mStreamIO->Close(aStatus);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "prlog.h"
|
||||
#include "nsCRT.h"
|
||||
#include "netCore.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -478,7 +479,7 @@ nsLoadGroup::AddChannel(nsIChannel *channel, nsISupports* ctxt)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -504,7 +505,7 @@ nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
|||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Removing channel %x %s status %x (count=%d).\n",
|
||||
this, channel, uriStr, status, count-1));
|
||||
this, channel, uriStr, aStatus, count-1));
|
||||
nsCRT::free(uriStr);
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
|
@ -541,7 +542,7 @@ nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
|||
"(foreground count=%d).\n",
|
||||
this, channel, mForegroundCount));
|
||||
|
||||
rv = observer->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
rv = observer->OnStopRequest(channel, ctxt, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
|
||||
("LOADGROUP [%x]: OnStopRequest for channel %x FAILED.\n",
|
||||
|
|
|
@ -540,6 +540,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
mOnStartReadFired = PR_TRUE;
|
||||
mReadListener -> OnStartRequest (this , mReadContext);
|
||||
}
|
||||
|
||||
mReadListener -> OnStopRequest(this, mReadContext, mStatus, nsnull);
|
||||
mReadListener = null_nsCOMPtr ();
|
||||
mReadContext = null_nsCOMPtr ();
|
||||
|
@ -570,6 +571,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags)
|
|||
mOnStartWriteFired = PR_TRUE;
|
||||
mWriteObserver -> OnStartRequest (this, mWriteContext);
|
||||
}
|
||||
|
||||
mWriteObserver -> OnStopRequest(this, mWriteContext, mStatus, nsnull);
|
||||
mWriteObserver = null_nsCOMPtr ();
|
||||
mWriteContext = null_nsCOMPtr ();
|
||||
|
@ -2410,73 +2412,25 @@ nsSocketTransport::SetSocketConnectTimeout (PRUint32 a_Seconds)
|
|||
nsresult
|
||||
nsSocketTransport::fireStatus(PRUint32 aCode)
|
||||
{
|
||||
// need to optimize this - TODO
|
||||
nsXPIDLString tempmesg;
|
||||
nsresult rv = GetSocketErrorString(aCode, getter_Copies(tempmesg));
|
||||
if (!mEventSink)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString mesg(tempmesg);
|
||||
mesg.AppendWithConversion(mHostName);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return mEventSink ? mEventSink->OnStatus(this,
|
||||
mReadContext,
|
||||
mesg.GetUnicode()) // this gets freed elsewhere.
|
||||
: NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//TODO l10n and i18n stuff here!
|
||||
nsresult
|
||||
nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
||||
PRUnichar** oString) const
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (!oString)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*oString = nsnull;
|
||||
|
||||
switch (iCode) /* these are currently just nsSocketState
|
||||
(as in nsSocketTransport.h) */
|
||||
{
|
||||
nsresult status;
|
||||
switch (aCode) {
|
||||
case eSocketState_Created:
|
||||
case eSocketState_WaitDNS:
|
||||
{
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
mService -> GetNeckoStringByName ("ResolvingHost", oString);
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
}
|
||||
status = NS_NET_STATUS_RESOLVING_HOST;
|
||||
break;
|
||||
case eSocketState_Connected:
|
||||
{
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
mService -> GetNeckoStringByName ("ConnectedTo", oString);
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
}
|
||||
status = NS_NET_STATUS_CONNECTED_TO;
|
||||
break;
|
||||
case eSocketState_WaitReadWrite:
|
||||
{
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
static nsAutoString frommesg; frommesg.AssignWithConversion("Transferring data from ");
|
||||
static nsAutoString tomesg; tomesg.AssignWithConversion("Sending request to ");
|
||||
if (mWriteContext == nsnull)
|
||||
mService -> GetNeckoStringByName ("SendingRequestTo", oString);
|
||||
else
|
||||
mService -> GetNeckoStringByName ("TransferringDataFrom", oString);
|
||||
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
}
|
||||
status = mWriteContext
|
||||
? NS_NET_STATUS_RECEIVING_FROM
|
||||
: NS_NET_STATUS_SENDING_TO;
|
||||
break;
|
||||
case eSocketState_WaitConnect:
|
||||
{
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
mService -> GetNeckoStringByName ("ConnectingTo", oString);
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
}
|
||||
status = NS_NET_STATUS_CONNECTING_TO;
|
||||
break;
|
||||
case eSocketState_Closed:
|
||||
case eSocketState_Done:
|
||||
|
@ -2484,8 +2438,10 @@ nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
|||
case eSocketState_Error:
|
||||
case eSocketState_Max:
|
||||
default:
|
||||
return rv; // just return error, ie no status strings for this case
|
||||
status = NS_OK;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
|
||||
nsAutoString host; host.AssignWithConversion(mHostName);
|
||||
return mEventSink->OnStatus(this, mReadContext, status, host.GetUnicode());
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ protected:
|
|||
nsresult doWriteFromStream(PRUint32 *aCount);
|
||||
|
||||
nsresult fireStatus(PRUint32 aCode);
|
||||
nsresult GetSocketErrorString(PRUint32 iCode, PRUnichar** oString) const;
|
||||
|
||||
private:
|
||||
PRIntervalTime mSocketTimeout;
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#define MAX_OPEN_CONNECTIONS 50
|
||||
#define DEFAULT_POLL_TIMEOUT_IN_MS 35*1000
|
||||
|
||||
#define NECKO_MSGS_URL "chrome://necko/locale/necko.properties"
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransport;
|
||||
|
||||
|
|
|
@ -112,10 +112,11 @@ nsStreamLoader::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
mChannel = channel;
|
||||
nsresult rv = mObserver->OnStreamComplete(this, mContext, status,
|
||||
rv = mObserver->OnStreamComplete(this, mContext, aStatus,
|
||||
mData.Length(),
|
||||
mData.GetBuffer());
|
||||
return rv;
|
||||
|
|
|
@ -61,8 +61,7 @@ nsSyncStreamListener::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
// XXX what do we do with the status and error message?
|
||||
return mOutputStream->Close();
|
||||
|
|
|
@ -641,15 +641,15 @@ nsDiskCacheRecordChannel::OnStartRequest(nsIChannel* transportChannel, nsISuppor
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDiskCacheRecordChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = mRealListener->OnStopRequest(this, context, aStatus, aMsg);
|
||||
rv = mRealListener->OnStopRequest(this, context, aStatus, aStatusArg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aMsg);
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ nsDiskCacheRecordChannel::OnDataAvailable(nsIChannel* transportChannel, nsISuppo
|
|||
// insure that the transport will go away even if it is blocked waiting
|
||||
// for the consumer to empty the pipe...
|
||||
//
|
||||
if (NS_FAILED(rv && mFileTransport)) {
|
||||
if (NS_FAILED(rv) && mFileTransport) {
|
||||
mFileTransport->Cancel(rv);
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -138,14 +138,14 @@ public:
|
|||
|
||||
NS_IMETHOD
|
||||
OnStopRequest(nsIChannel *channel, nsISupports *aContext,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv;
|
||||
|
||||
|
||||
NS_ASSERTION(mDownstreamListener, "no downstream listener");
|
||||
|
||||
if (mDownstreamListener) {
|
||||
rv = mDownstreamListener->OnStopRequest(mChannel, aContext, status, errorMsg);
|
||||
rv = mDownstreamListener->OnStopRequest(mChannel, aContext, aStatus, aStatusArg);
|
||||
mDownstreamListener = 0;
|
||||
}
|
||||
// Tricky: causes this instance to be free'ed because mEventQueueStreamListener
|
||||
|
|
|
@ -1151,8 +1151,8 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
if (NS_FAILED(status))
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
if (NS_FAILED(aStatus))
|
||||
mCacheEntry->SetFlag(nsCachedNetData::TRUNCATED_CONTENT);
|
||||
|
||||
mCacheEntry->ClearFlag(nsCachedNetData::VESTIGIAL);
|
||||
|
@ -1163,7 +1163,7 @@ public:
|
|||
// Tell any stream-as-file observers that the file has been completely written
|
||||
mCacheEntry->Notify(nsIStreamAsFileObserver::NOTIFY_AVAILABLE, NS_OK);
|
||||
|
||||
return mOriginalListener->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
return mOriginalListener->OnStopRequest(channel, ctxt, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsIChannel *channel, nsISupports *ctxt,
|
||||
|
|
|
@ -339,7 +339,7 @@ NS_IMETHODIMP
|
|||
nsDateTimeChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
if (mLoadGroup) // if we already had a load group remove ourselves...
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
|
||||
mLoadGroup = aLoadGroup;
|
||||
if (mLoadGroup) {
|
||||
|
@ -394,12 +394,12 @@ nsDateTimeChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
if (mLoadGroup) {
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ nsFileChannel::OnStartRequest(nsIChannel* transportChannel, nsISupports* context
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(mInitiator == PR_CurrentThread(),
|
||||
|
@ -629,11 +629,11 @@ nsFileChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
rv = mRealListener->OnStopRequest(this, context, aStatus, aMsg);
|
||||
rv = mRealListener->OnStopRequest(this, context, aStatus, aStatusArg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aMsg);
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,14 +692,12 @@ nsFileChannel::GetInterface(const nsIID &anIID, void **aResult )
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::OnStatus(nsIChannel *aChannel,
|
||||
nsISupports *aContext,
|
||||
const PRUnichar *aMsg)
|
||||
nsFileChannel::OnStatus(nsIChannel *aChannel, nsISupports* ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mProgress) {
|
||||
mProgress->OnStatus(this, aContext, aMsg);
|
||||
rv = mProgress->OnStatus(aChannel, ctxt, aStatus, aStatusArg);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -710,12 +708,12 @@ nsFileChannel::OnProgress(nsIChannel* aChannel,
|
|||
PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
if (mProgress) {
|
||||
rv = mProgress->OnProgress(this, aContext, aProgress, aProgressMax);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -443,7 +443,8 @@ nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
#ifdef DEBUG_bryner
|
||||
printf("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n",
|
||||
mActAsObserver);
|
||||
|
@ -453,10 +454,10 @@ nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
|||
|
||||
if (NS_FAILED(aStatus) || !mActAsObserver) {
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
mTransport = 0;
|
||||
return rv;
|
||||
} else {
|
||||
|
|
|
@ -33,3 +33,14 @@ interface nsIFTPChannel : nsIChannel
|
|||
readonly attribute PRBool UsingProxy;
|
||||
readonly attribute PRBool UsingTransparentProxy;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
/**
|
||||
* Status nsresult codes: used with nsINotification objects
|
||||
*/
|
||||
#define NS_NET_STATUS_BEGIN_FTP_TRANSACTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 27)
|
||||
#define NS_NET_STATUS_END_FTP_TRANSACTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 28)
|
||||
|
||||
|
||||
%}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsMimeTypes.h"
|
||||
|
||||
static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
extern PRLogModuleInfo* gFTPLog;
|
||||
|
@ -296,8 +297,10 @@ nsFTPChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
mUserContext = ctxt;
|
||||
|
||||
if (mEventSink) {
|
||||
nsAutoString statusMsg; statusMsg.AssignWithConversion("Beginning FTP transaction.");
|
||||
rv = mEventSink->OnStatus(this, ctxt, statusMsg.GetUnicode());
|
||||
nsCOMPtr<nsIIOService> serv = do_GetService(kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mEventSink->OnStatus(this, ctxt, NS_NET_STATUS_BEGIN_FTP_TRANSACTION, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -609,19 +612,21 @@ nsFTPChannel::GetInterface(const nsIID &anIID, void **aResult ) {
|
|||
|
||||
// nsIProgressEventSink methods
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStatus(nsIChannel *aChannel,
|
||||
nsISupports *aContext,
|
||||
const PRUnichar *aMsg) {
|
||||
nsFTPChannel::OnStatus(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
if (!mEventSink)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString str;
|
||||
if (mProxyChannel) {
|
||||
// XXX We're appending the *real* host to this string
|
||||
// XXX coming from the proxy channel progress notifications.
|
||||
// XXX This assumes the proxy channel was setup using a null host name
|
||||
nsAutoString msg(aMsg);
|
||||
msg.AppendWithConversion(NS_STATIC_CAST(const char*, mHost));
|
||||
return mEventSink ? mEventSink->OnStatus(this, aContext, msg.GetUnicode()) : NS_OK;
|
||||
} else {
|
||||
return mEventSink ? mEventSink->OnStatus(this, aContext, aMsg) : NS_OK;
|
||||
if (aStatusArg) {
|
||||
str.Append(aStatusArg);
|
||||
str.AppendWithConversion("\n");
|
||||
}
|
||||
str.AppendWithConversion(mHost);
|
||||
}
|
||||
return mEventSink->OnStatus(this, aContext, aStatus, str.GetUnicode());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -634,22 +639,23 @@ nsFTPChannel::OnProgress(nsIChannel* aChannel, nsISupports* aContext,
|
|||
// nsIStreamObserver methods.
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
mConnThread = nsnull;
|
||||
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (mObserver) {
|
||||
rv = mObserver->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
rv = mObserver->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (mListener) {
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aStatusArg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "nsIDNSService.h" // for host error code
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIProxy.h"
|
||||
#include "nsIAllocator.h"
|
||||
#include "nsIMemory.h"
|
||||
|
||||
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
|
||||
|
@ -47,6 +47,7 @@ static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
|
|||
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
#define FTP_COMMAND_CHANNEL_SEG_SIZE 64
|
||||
#define FTP_COMMAND_CHANNEL_MAX_SIZE 512
|
||||
|
@ -1736,7 +1737,7 @@ nsFtpConnectionThread::Init(nsIProtocolHandler* aHandler,
|
|||
rv = mURL->GetPath(&path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mPath = nsUnescape(path);
|
||||
nsAllocator::Free(path);
|
||||
nsMemory::Free(path);
|
||||
|
||||
// pull any username and/or password out of the uri
|
||||
nsXPIDLCString uname;
|
||||
|
@ -1794,20 +1795,16 @@ nsFtpConnectionThread::SetWriteStream(nsIInputStream* aInStream, PRUint32 aWrite
|
|||
nsresult
|
||||
nsFtpConnectionThread::StopProcessing() {
|
||||
nsresult rv;
|
||||
PRUnichar* errorMsg = nsnull;
|
||||
|
||||
// kill the event loop
|
||||
mKeepRunning = PR_FALSE;
|
||||
|
||||
// setup any internal error message to propegate
|
||||
#if 0
|
||||
if (NS_FAILED(mInternalError)) {
|
||||
// generate a FTP specific error msg.
|
||||
rv = MapResultCodeToString(mInternalError, &errorMsg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//if (mCPipe) (void)mCPipe->Cancel();
|
||||
//if (mDPipe) (void)mDPipe->Cancel();
|
||||
if (mCPipe) (void)mCPipe->Cancel();
|
||||
if (mDPipe) (void)mDPipe->Cancel();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Release the transports
|
||||
mCPipe = 0;
|
||||
|
@ -1822,6 +1819,9 @@ nsFtpConnectionThread::StopProcessing() {
|
|||
// we never got to the point that the transport would be
|
||||
// taking over notifications. we'll handle them our selves.
|
||||
|
||||
nsCOMPtr<nsIIOService> serv = do_GetService(kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mObserver) {
|
||||
nsCOMPtr<nsIStreamObserver> asyncObserver;
|
||||
rv = NS_NewAsyncStreamObserver(getter_AddRefs(asyncObserver), mObserver, mEventQueue);
|
||||
|
@ -1829,7 +1829,7 @@ nsFtpConnectionThread::StopProcessing() {
|
|||
|
||||
// we only want to fire OnStop. No OnStart has been fired, and
|
||||
// we only want to propagate an error.
|
||||
rv = asyncObserver->OnStopRequest(mChannel, mObserverContext, mInternalError, errorMsg);
|
||||
rv = asyncObserver->OnStopRequest(mChannel, mObserverContext, mInternalError, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
@ -1840,7 +1840,7 @@ nsFtpConnectionThread::StopProcessing() {
|
|||
|
||||
// we only want to fire OnStop. No OnStart has been fired, and
|
||||
// we only want to propagate an error.
|
||||
rv = asyncListener->OnStopRequest(mChannel, mListenerContext, mInternalError, errorMsg);
|
||||
rv = asyncListener->OnStopRequest(mChannel, mListenerContext, mInternalError, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
@ -1870,36 +1870,6 @@ nsFtpConnectionThread::FindActionState(void) {
|
|||
return FTP_ERROR;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFtpConnectionThread::MapResultCodeToString(nsresult aResultCode, PRUnichar* *aOutMsg) {
|
||||
nsCAutoString errorMsg;
|
||||
switch (aResultCode) {
|
||||
case NS_ERROR_FTP_LOGIN:
|
||||
errorMsg = "FTP: Login failed.";
|
||||
break;
|
||||
case NS_ERROR_FTP_MODE:
|
||||
errorMsg = "FTP: MODE command failed.";
|
||||
break;
|
||||
case NS_ERROR_FTP_CWD:
|
||||
errorMsg = "FTP: CWD command failed.";
|
||||
break;
|
||||
case NS_ERROR_FTP_PASV:
|
||||
errorMsg = "FTP: PASV command failed.";
|
||||
break;
|
||||
case NS_ERROR_FTP_DEL_DIR:
|
||||
errorMsg = "FTP: DEL directory command failed.";
|
||||
break;
|
||||
case NS_ERROR_FTP_MKDIR:
|
||||
errorMsg = "FTP: MKDIR command failed";
|
||||
break;
|
||||
default:
|
||||
errorMsg = "Unknown FTP error.";
|
||||
} // END: switch
|
||||
*aOutMsg = errorMsg.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFtpConnectionThread::SetDirMIMEType(nsString& aString) {
|
||||
// the from content type is a string of the form
|
||||
|
|
|
@ -138,7 +138,6 @@ private:
|
|||
// internal methods
|
||||
nsresult StopProcessing();
|
||||
FTP_STATE FindActionState(void);
|
||||
nsresult MapResultCodeToString(nsresult aResultCode, PRUnichar* *aOutMsg);
|
||||
void SetDirMIMEType(nsString& aString);
|
||||
nsresult Process();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
// For proxification of FTP URLs
|
||||
#include "nsIHTTPProtocolHandler.h"
|
||||
#include "nsIHTTPChannel.h"
|
||||
|
||||
#include "nsIErrorService.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -68,6 +68,7 @@ PRLogModuleInfo* gFTPLog = nsnull;
|
|||
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kProtocolProxyServiceCID, NS_PROTOCOLPROXYSERVICE_CID);
|
||||
static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID);
|
||||
static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -111,6 +112,14 @@ nsFtpProtocolHandler::Init() {
|
|||
mLock = PR_NewLock();
|
||||
if (!mLock) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// XXX hack until xpidl supports error info directly (http://bugzilla.mozilla.org/show_bug.cgi?id=13423)
|
||||
nsCOMPtr<nsIErrorService> errorService = do_GetService(kErrorServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_BEGIN_FTP_TRANSACTION, "BeginFTPTransaction");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = errorService->RegisterErrorStringBundleKey(NS_NET_STATUS_END_FTP_TRANSACTION, "EndFTPTransaction");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsIEventQueueService.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "netCore.h"
|
||||
|
||||
// FIXME - Temporary include. Delete this when cache is enabled on all
|
||||
// platforms
|
||||
|
@ -839,12 +840,12 @@ nsHTTPChannel::GetInterface(const nsIID &anIID, void **aResult ) {
|
|||
|
||||
// nsIProgressEventSink methods
|
||||
NS_IMETHODIMP
|
||||
nsHTTPChannel::OnStatus(nsIChannel *aChannel,
|
||||
nsISupports *aContext,
|
||||
const PRUnichar *aMsg) {
|
||||
nsHTTPChannel::OnStatus(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mProgressEventSink) {
|
||||
rv = mProgressEventSink->OnStatus(this, aContext, aMsg);
|
||||
rv = mProgressEventSink->OnStatus(this, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1714,10 +1715,8 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsHTTPChannel::ResponseCompleted(
|
||||
nsIStreamListener *aListener,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -1727,7 +1726,7 @@ nsresult nsHTTPChannel::ResponseCompleted(
|
|||
this, (void*)mResponseDataListener, aStatus));
|
||||
|
||||
#if 0
|
||||
if (NS_FAILED (aStatus) && !mResponse)
|
||||
if (NS_FAILED (status) && !mResponse)
|
||||
{
|
||||
// ruslan: must have failed during connect phase
|
||||
|
||||
|
@ -1736,7 +1735,7 @@ nsresult nsHTTPChannel::ResponseCompleted(
|
|||
|
||||
if (NS_SUCCEEDED (rv1))
|
||||
{
|
||||
aStatus = NS_ERROR_GENERATE_SUCCESS (NS_ERROR_MODULE_NETWORK, NS_ERROR_GET_CODE (aStatus));
|
||||
status = NS_ERROR_GENERATE_SUCCESS (NS_ERROR_MODULE_NETWORK, NS_ERROR_GET_CODE (status));
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -1754,7 +1753,7 @@ nsresult nsHTTPChannel::ResponseCompleted(
|
|||
// Call the consumer OnStopRequest(...) to end the request...
|
||||
if (aListener)
|
||||
{
|
||||
rv = aListener->OnStopRequest(this, mResponseContext, aStatus, aMsg);
|
||||
rv = aListener->OnStopRequest(this, mResponseContext, aStatus, aStatusArg);
|
||||
|
||||
if (NS_FAILED (rv))
|
||||
{
|
||||
|
@ -1788,7 +1787,7 @@ nsresult nsHTTPChannel::ResponseCompleted(
|
|||
//
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveChannel(this, nsnull, aStatus, nsnull);
|
||||
mLoadGroup->RemoveChannel(this, nsnull, aStatus, aStatusArg);
|
||||
|
||||
|
||||
// Null out pointers that are no longer needed...
|
||||
|
@ -2719,10 +2718,10 @@ nsSyncHelper::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsSyncHelper::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar *aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
mProcessing = PR_FALSE;
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aMsg);
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,8 +97,7 @@ public:
|
|||
nsIChannel **aResult, PRInt32 aStatusCode);
|
||||
|
||||
nsresult ResponseCompleted(nsIStreamListener *aListener,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
nsresult aStatus, const PRUnichar* aStatusArg);
|
||||
|
||||
nsresult SetResponse(nsHTTPResponse* i_pResp);
|
||||
nsresult GetResponseContext(nsISupports** aContext);
|
||||
|
|
|
@ -704,17 +704,16 @@ nsHTTPPipelinedRequest::OnStartRequest(nsIChannel* channel, nsISupports* i_Conte
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Context,
|
||||
nsresult iStatus,
|
||||
const PRUnichar* i_Msg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISocketTransport> trans = do_QueryInterface(mTransport, &rv);
|
||||
|
||||
nsHTTPRequest * req =(nsHTTPRequest *) mRequests->ElementAt(0);
|
||||
|
||||
rv = iStatus;
|
||||
rv = aStatus;
|
||||
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,("\nnsHTTPRequest::OnStopRequest() [this=%x], iStatus=%u\n", this, iStatus));
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,("\nnsHTTPRequest::OnStopRequest() [this=%x], aStatus=%u\n", this, aStatus));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -731,11 +730,11 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex
|
|||
if (mInputStream)
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_ALWAYS,
|
||||
("nsHTTPRequest [this=%x]. "
|
||||
("nsHTTPRequest [this=%x]. "
|
||||
"Writing PUT/POST data to the server.\n", this));
|
||||
|
||||
rv = mTransport->AsyncWrite(mInputStream, this,
|
||||
(nsISupports*)(nsIRequest*)req->mConnection);
|
||||
(nsISupports*)(nsIRequest*)req->mConnection);
|
||||
|
||||
/* the mInputStream is released below... */
|
||||
}
|
||||
|
@ -745,9 +744,9 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex
|
|||
else
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_ALWAYS,
|
||||
("nsHTTPRequest [this=%x]. "
|
||||
("nsHTTPRequest [this=%x]. "
|
||||
"Finished writing request to server."
|
||||
"\tStatus: %x\n", this, iStatus));
|
||||
"\tStatus: %x\n", this, aStatus));
|
||||
|
||||
if (mListener == nsnull)
|
||||
{
|
||||
|
@ -783,9 +782,9 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex
|
|||
else
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_ERROR,
|
||||
("nsHTTPRequest [this=%x]. Error writing request to server."
|
||||
"\tStatus: %x\n", this, iStatus));
|
||||
rv = iStatus;
|
||||
("nsHTTPRequest [this=%x]. Error writing request to server."
|
||||
"\tStatus: %x\n", this, aStatus));
|
||||
rv = aStatus;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -833,7 +832,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex
|
|||
{
|
||||
nsCOMPtr<nsIStreamListener> consumer;
|
||||
req->mConnection->GetResponseDataListener(getter_AddRefs(consumer));
|
||||
req->mConnection->ResponseCompleted(consumer, rv, i_Msg);
|
||||
req->mConnection->ResponseCompleted(consumer, rv, nsnull);
|
||||
|
||||
// Notify the HTTPChannel that the request has finished
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
|
@ -45,6 +45,7 @@
|
|||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIIOService.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID) ;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
|
@ -149,10 +150,8 @@ nsHTTPCacheListener::OnStartRequest(nsIChannel *aChannel,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPCacheListener::OnStopRequest(nsIChannel *aChannel,
|
||||
nsISupports *aContext,
|
||||
nsresult aStatus,
|
||||
const PRUnichar *aErrorMsg)
|
||||
nsHTTPCacheListener::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
("nsHTTPCacheListener::OnStopRequest [this=%x]\n", this)) ;
|
||||
|
@ -162,9 +161,7 @@ nsHTTPCacheListener::OnStopRequest(nsIChannel *aChannel,
|
|||
// is no socket transport involved nsnull is passed as the
|
||||
// transport...
|
||||
//
|
||||
nsresult rv = mChannel->ResponseCompleted(mResponseDataListener,
|
||||
aStatus,
|
||||
aErrorMsg) ;
|
||||
nsresult rv = mChannel->ResponseCompleted(mResponseDataListener, aStatus, aStatusArg) ;
|
||||
// NS_IF_RELEASE(mChannel) ;
|
||||
return rv;
|
||||
}
|
||||
|
@ -664,7 +661,8 @@ nsHTTPServerListener::OnStartRequest(nsIChannel* channel, nsISupports* i_pContex
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext, nsresult i_Status, const PRUnichar* i_pMsg)
|
||||
nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext,
|
||||
nsresult i_Status, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = i_Status, channelStatus = NS_OK;
|
||||
|
||||
|
@ -672,7 +670,7 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext
|
|||
mChannel->GetStatus(&channelStatus) ;
|
||||
|
||||
PR_LOG(gHTTPLog, PR_LOG_ALWAYS,
|
||||
("nsHTTPServerListener::OnStopRequest [this=%x]."
|
||||
("nsHTTPServerListener::OnStopRequest [this=%x]."
|
||||
"\tStatus = %x, mDataReceived=%d\n", this, i_Status, mDataReceived)) ;
|
||||
|
||||
if (NS_SUCCEEDED(channelStatus) && !mDataReceived
|
||||
|
@ -718,7 +716,7 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext
|
|||
|
||||
if (status != 304 || !mChannel->mCachedResponse)
|
||||
{
|
||||
mChannel->ResponseCompleted(mResponseDataListener, i_Status, i_pMsg) ;
|
||||
mChannel->ResponseCompleted(mResponseDataListener, i_Status, aStatusArg);
|
||||
mChannel->mHTTPServerListener = 0;
|
||||
}
|
||||
|
||||
|
@ -787,7 +785,7 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext
|
|||
while (NS_SUCCEEDED(mPipelinedRequest->AdvanceToNextRequest()) )
|
||||
{
|
||||
OnStartRequest(nsnull, nsnull) ;
|
||||
mChannel->ResponseCompleted(mResponseDataListener, i_Status, i_pMsg) ;
|
||||
mChannel->ResponseCompleted(mResponseDataListener, i_Status, aStatusArg);
|
||||
mChannel->mHTTPServerListener = 0;
|
||||
}
|
||||
|
||||
|
@ -1157,13 +1155,11 @@ nsHTTPFinalListener::OnStartRequest(nsIChannel *aChannel,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPFinalListener::OnStopRequest(nsIChannel *aChannel,
|
||||
nsISupports *aContext,
|
||||
nsresult aStatus,
|
||||
const PRUnichar *aErrorMsg)
|
||||
nsHTTPFinalListener::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
("nsHTTPFinalListener::OnStopRequest [this=%x]"
|
||||
("nsHTTPFinalListener::OnStopRequest [this=%x]"
|
||||
", mOnStopFired=%u\n", this, mOnStopFired)) ;
|
||||
|
||||
if (mShutdown || mOnStopFired)
|
||||
|
@ -1192,7 +1188,7 @@ nsHTTPFinalListener::OnStopRequest(nsIChannel *aChannel,
|
|||
}
|
||||
|
||||
mOnStopFired = PR_TRUE;
|
||||
nsresult rv = mListener->OnStopRequest(aChannel, aContext, aStatus, aErrorMsg) ;
|
||||
nsresult rv = mListener->OnStopRequest(aChannel, aContext, aStatus, aStatusArg) ;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -72,10 +72,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* jarCacheTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg) {
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* jarCacheTransport, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoMonitor monitor(mJARChannel->mMonitor);
|
||||
|
||||
|
@ -88,11 +86,11 @@ public:
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar download complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
(const char*)jarURLStr, aStatus));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (NS_SUCCEEDED(status) && mJARChannel->mJarCacheTransport) {
|
||||
if (NS_SUCCEEDED(aStatus) && mJARChannel->mJarCacheTransport) {
|
||||
NS_ASSERTION(jarCacheTransport == (mJARChannel->mJarCacheTransport).get(),
|
||||
"wrong transport");
|
||||
// after successfully downloading the jar file to the cache,
|
||||
|
@ -528,7 +526,7 @@ nsJARChannel::EnsureJARFileAvailable(OnJARFileAvailableFun onJARFileAvailable,
|
|||
|
||||
error:
|
||||
if (NS_FAILED(rv) && mLoadGroup) {
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, rv, nsnull); // XXX fix error message
|
||||
nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, NS_OK, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed");
|
||||
}
|
||||
return rv;
|
||||
|
@ -864,10 +862,8 @@ nsJARChannel::OnStartRequest(nsIChannel* jarExtractionTransport,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg)
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -877,14 +873,14 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport,
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar extraction complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
(const char*)jarURLStr, aStatus));
|
||||
}
|
||||
#endif
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, status, aMsg);
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, status, aMsg);
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ nsResChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
|||
} while (NS_FAILED(rv));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
(void)EndRequest(rv, nsnull); // XXX need error message
|
||||
(void)EndRequest(rv, nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -461,7 +461,7 @@ nsResChannel::AsyncWrite(nsIInputStream *fromStream,
|
|||
} while (NS_FAILED(rv));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
(void)EndRequest(rv, nsnull); // XXX need error message
|
||||
(void)EndRequest(rv, nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -679,7 +679,7 @@ nsResChannel::OnStartRequest(nsIChannel* transportChannel, nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsResChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(mInitiator == PR_CurrentThread(),
|
||||
|
@ -696,18 +696,18 @@ nsResChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return EndRequest(aStatus, aMsg);
|
||||
return EndRequest(aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsResChannel::EndRequest(nsresult aStatus, const PRUnichar* aMsg)
|
||||
nsResChannel::EndRequest(nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mUserObserver->OnStopRequest(this, mUserContext, aStatus, aMsg);
|
||||
rv = mUserObserver->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
|
||||
#if 0 // we don't add the resource channel to the group (although maybe we should)
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aMsg);
|
||||
mLoadGroup->RemoveChannel(this, context, notif);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -91,7 +91,7 @@ protected:
|
|||
}
|
||||
|
||||
nsresult EnsureNextResolvedChannel();
|
||||
nsresult EndRequest(nsresult status, const PRUnichar* msg);
|
||||
nsresult EndRequest(nsresult aStatus, const PRUnichar* aStatusArg);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
|
|
|
@ -19,8 +19,26 @@
|
|||
#
|
||||
# downloadHeadersTitlePrefix=Download headers for:
|
||||
|
||||
ResolvingHost=Resolving host
|
||||
ConnectedTo=Connected to
|
||||
ConnectingTo=Connecting to
|
||||
SendingRequestTo=Sending request to
|
||||
TransferringDataFrom=Transferring data from
|
||||
#ResolvingHost=Resolving host
|
||||
#ConnectedTo=Connected to
|
||||
#ConnectingTo=Connecting to
|
||||
#SendingRequestTo=Sending request to
|
||||
#TransferringDataFrom=Transferring data from
|
||||
|
||||
3=Resolving host %1$S
|
||||
4=Connected to %1$S
|
||||
5=Sending request to %1$S
|
||||
6=Transferring data from %1$S
|
||||
7=Connecting to %1$S
|
||||
8=Read %1$S
|
||||
9=Wrote %1$S
|
||||
|
||||
ResolvingHost=Resolving host %1$S
|
||||
ConnectedTo=Connected to %1$S
|
||||
SendingTo=Sending request to %1$S
|
||||
ReceivingFrom=Transferring data from %1$S
|
||||
ConnectingTo=Connecting to %1$S
|
||||
ReadFrom=Read %1$S
|
||||
WroteTo=Wrote %1$S
|
||||
BeginFTPTransaction=Beginning FTP transaction
|
||||
EndFTPTransaction=Finished FTP transaction
|
||||
|
|
|
@ -377,8 +377,8 @@ nsSOCKSIOLayerConnect(PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime time
|
|||
// destination port
|
||||
PRUint16 destPort = PR_NetAddrInetPort(addr);
|
||||
|
||||
request[request_len-1] = destPort >> 8;
|
||||
request[request_len-2] = destPort;
|
||||
request[request_len-1] = (unsigned char)(destPort >> 8);
|
||||
request[request_len-2] = (unsigned char)destPort;
|
||||
|
||||
if (PR_Write(fd, request, request_len) != request_len) {
|
||||
// bad write
|
||||
|
|
|
@ -1148,7 +1148,7 @@ mozTXTToHTMLConv::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
|
|||
|
||||
NS_IMETHODIMP
|
||||
mozTXTToHTMLConv::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -354,16 +354,16 @@ nsFTPDirListingConv::OnStartRequest(nsIChannel *channel, nsISupports *ctxt) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsFTPDirListingConv::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
// we don't care about stop. move along...
|
||||
nsCOMPtr<nsILoadGroup> loadgroup;
|
||||
nsresult rv = mPartChannel->GetLoadGroup(getter_AddRefs(loadgroup));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (loadgroup)
|
||||
(void)loadgroup->RemoveChannel(mPartChannel, nsnull, nsnull, nsnull);
|
||||
(void)loadgroup->RemoveChannel(mPartChannel, nsnull, aStatus, aStatusArg);
|
||||
|
||||
return mFinalListener->OnStopRequest(mPartChannel, ctxt, status, errorMsg);
|
||||
return mFinalListener->OnStopRequest(mPartChannel, ctxt, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,9 +102,10 @@ nsHTTPChunkConv::OnStartRequest (nsIChannel *aChannel, nsISupports *aContext)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPChunkConv::OnStopRequest (nsIChannel *aChannel, nsISupports *aContext, nsresult status, const PRUnichar *errorMsg)
|
||||
nsHTTPChunkConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return mListener -> OnStopRequest (aChannel, aContext, status, errorMsg);
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -101,9 +101,10 @@ nsHTTPCompressConv::OnStartRequest (nsIChannel *aChannel, nsISupports *aContext)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPCompressConv::OnStopRequest (nsIChannel *aChannel, nsISupports *aContext, nsresult status, const PRUnichar *errorMsg)
|
||||
nsHTTPCompressConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return mListener -> OnStopRequest (aChannel, aContext, status, errorMsg);
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -250,9 +250,10 @@ nsMultiMixedConv::OnStartRequest(nsIChannel *channel, nsISupports *ctxt) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMultiMixedConv::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv = NS_OK;
|
||||
if (NS_FAILED(status)) {
|
||||
|
||||
if (NS_FAILED(aStatus)) {
|
||||
if (mPartChannel) {
|
||||
// we've already fired an onstart.
|
||||
// push any buffered data out and then push
|
||||
|
@ -264,16 +265,15 @@ nsMultiMixedConv::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
|||
mBuffer = nsnull;
|
||||
mBufLen = 0;
|
||||
}
|
||||
rv = mFinalListener->OnStopRequest(mPartChannel, mContext,
|
||||
status, errorMsg);
|
||||
rv = mFinalListener->OnStopRequest(mPartChannel, mContext, aStatus, aStatusArg);
|
||||
} else {
|
||||
rv = mFinalListener->OnStartRequest(channel, ctxt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mFinalListener->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
rv = mFinalListener->OnStopRequest(channel, ctxt, aStatus, aStatusArg);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
if (mBufLen > 0 && mBuffer)
|
||||
{
|
||||
SendData(mBuffer, mBufLen);
|
||||
|
@ -282,7 +282,7 @@ nsMultiMixedConv::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
|||
mBufLen = 0;
|
||||
rv = SendStop ();
|
||||
}
|
||||
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ nsTXTToHTMLConv::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsTXTToHTMLConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar *aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv = NS_OK;
|
||||
if (mToken) {
|
||||
// we still have an outstanding token
|
||||
|
@ -109,7 +109,7 @@ nsTXTToHTMLConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
|||
inputData, 0, mBuffer.Length());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aMsg);
|
||||
return mListener->OnStopRequest(aChannel, aContext, aStatus, aStatusArg);
|
||||
}
|
||||
|
||||
// nsITXTToHTMLConv methods
|
||||
|
|
|
@ -196,10 +196,8 @@ nsUnknownDecoder::OnStartRequest(nsIChannel *aChannel, nsISupports *aCtxt)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUnknownDecoder::OnStopRequest(nsIChannel *aChannel,
|
||||
nsISupports *aCtxt,
|
||||
nsresult aStatus,
|
||||
const PRUnichar *aErrorMsg)
|
||||
nsUnknownDecoder::OnStopRequest(nsIChannel *aChannel, nsISupports *aCtxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -221,7 +219,7 @@ nsUnknownDecoder::OnStopRequest(nsIChannel *aChannel,
|
|||
}
|
||||
}
|
||||
|
||||
rv = mNextListener->OnStopRequest(aChannel, aCtxt, aStatus, aErrorMsg);
|
||||
rv = mNextListener->OnStopRequest(aChannel, aCtxt, aStatus, aStatusArg);
|
||||
mNextListener = 0;
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -99,8 +99,8 @@ TestConverter::OnStartRequest(nsIChannel *channel, nsISupports *ctxt) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
TestConverter::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
return mListener->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
return mListener->OnStopRequest(channel, ctxt, aStatus, aStatusArg);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -107,7 +107,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -217,10 +217,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg) {
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
PRIntervalTime endTime;
|
||||
PRIntervalTime duration;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ Consumer::OnStartRequest(nsIChannel *aChannel, nsISupports* aContext) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
Consumer::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
fprintf(stderr, "Consumer::OnStop() -> in\n\n");
|
||||
|
||||
if (!mOnStart) {
|
||||
|
|
|
@ -140,10 +140,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg) {
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv;
|
||||
PR_EnterMonitor(mMonitor);
|
||||
PRIntervalTime endTime = PR_IntervalNow();
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
printf("ending status=%0x total=%d\n", status, mTotal);
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
printf("ending status=%0x total=%d\n", aStatus, mTotal);
|
||||
if (--mStopCount == 0)
|
||||
gDone = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -240,8 +240,8 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
printf("stream closed: status %x\n", status);
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
printf("stream closed: status %x\n", aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
|
@ -280,10 +280,8 @@ OpenObserver::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OpenObserver::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
OpenObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
printf("\n+++ OpenObserver::OnStopRequest (status = %x) +++."
|
||||
"\tContext = %p\n",
|
||||
|
@ -371,10 +369,8 @@ InputTestConsumer::OnDataAvailable(nsIChannel* channel,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
URLLoadInfo* info = (URLLoadInfo*)context;
|
||||
|
||||
|
@ -420,7 +416,7 @@ InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
|||
pURI->GetSpec(&location);
|
||||
}
|
||||
|
||||
printf("\nFinished loading: %s Status Code: %x\n", location ? location : "UNKNOWN URL", aStatus);
|
||||
printf("\nFinished loading: %s Status Code: %x\n", location ? location : "UNKNOWN URL", status);
|
||||
|
||||
if (location) {
|
||||
nsCRT::free(location);
|
||||
|
@ -461,7 +457,6 @@ NS_IMPL_ISUPPORTS1(nsNotificationCallbacks, nsIInterfaceRequestor)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
nsresult StartLoadingURL(const char* aUrlString)
|
||||
{
|
||||
nsresult rv;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "prenv.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIFileSpec.h"
|
||||
|
||||
// Number of test entries to be placed in the cache
|
||||
#define NUM_CACHE_ENTRIES 250
|
||||
|
||||
|
@ -227,10 +228,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg) {
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
PRIntervalTime endTime;
|
||||
PRIntervalTime duration;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsIEventQueueService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
|
@ -142,7 +143,7 @@ public:
|
|||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg) {
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
|
@ -150,7 +151,7 @@ public:
|
|||
char* str;
|
||||
rv = uri->GetSpec(&str);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fprintf(stdout, "Ending load %s, status=%x\n", str, status);
|
||||
fprintf(stdout, "Ending load %s, status=%x\n", str, aStatus);
|
||||
nsCRT::free(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,10 +116,8 @@ InputTestConsumer::OnDataAvailable(nsIChannel* channel,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
gKeepRunning = 0;
|
||||
printf("\n+++ InputTestConsumer::OnStopRequest (status = %x) +++\n", aStatus);
|
||||
|
@ -169,8 +167,7 @@ TestWriteObserver::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
|||
|
||||
NS_IMETHODIMP
|
||||
TestWriteObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
printf("\n+++ TestWriteObserver::OnStopRequest (status = %x) +++\n", aStatus);
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ public:
|
|||
PRUint32 aLength);
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
nsresult aStatus, const PRUnichar* aStatusArg);
|
||||
|
||||
};
|
||||
|
||||
|
@ -111,10 +110,8 @@ InputTestConsumer::OnDataAvailable(nsIChannel* channel,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
InputTestConsumer::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
gKeepRunning = 0;
|
||||
printf("+++ OnStopRequest status %x +++\n", aStatus);
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "nsITimer.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
#if defined(XP_MAC)
|
||||
|
@ -154,12 +153,14 @@ public:
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnProgress(nsIChannel *channel, nsISupports *ctxt, PRUint32 aProgress, PRUint32 aProgressMax) {
|
||||
NS_IMETHOD OnProgress(nsIChannel *channel, nsISupports *ctxt,
|
||||
PRUint32 aProgress, PRUint32 aProgressMax) {
|
||||
putc('+', stderr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStatus(nsIChannel *channel, nsISupports *ctxt, const PRUnichar *aMsg) {
|
||||
NS_IMETHOD OnStatus(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg) {
|
||||
putc('?', stderr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -216,10 +217,8 @@ TestConnectionOpenObserver::OnStartRequest(nsIChannel* channel, nsISupports* con
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TestConnectionOpenObserver::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
TestConnectionOpenObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
if (gVerbose || NS_FAILED(aStatus))
|
||||
printf("\n+++ TestConnectionOpenObserver::OnStopRequest (status = %x) +++."
|
||||
|
@ -276,10 +275,8 @@ TestConnection::OnDataAvailable(nsIChannel* channel, nsISupports* context,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
TestConnection::OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
TestConnection::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
if (gVerbose || NS_FAILED(aStatus))
|
||||
printf("\n+++ TestConnection::OnStopRequest (status = %x) +++."
|
||||
|
|
|
@ -2030,13 +2030,15 @@ nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgr
|
|||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult
|
||||
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext, const PRUnichar* aMsg)
|
||||
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult result=0;
|
||||
nsresult rv;
|
||||
if (nsnull != mProgressEventSink) {
|
||||
mProgressEventSink->OnStatus(channel, aContext, aMsg);
|
||||
rv = mProgressEventSink->OnStatus(channel, aContext, aStatus, aStatusArg);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
|
||||
}
|
||||
return result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef rickgdebug
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsHTMLTags.h"
|
||||
#include "nsDTDUtils.h"
|
||||
#include "nsTimer.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
class IContentSink;
|
||||
class nsIDTD;
|
||||
|
@ -250,9 +251,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser,
|
|||
// These methods are callback methods used by
|
||||
// net lib to let us know about our inputstream.
|
||||
//*********************************************
|
||||
// nsIProgressEventSink methods:
|
||||
NS_IMETHOD OnProgress(nsIChannel* channel, nsISupports* context, PRUint32 Progress, PRUint32 ProgressMax);
|
||||
NS_IMETHOD OnStatus(nsIChannel* channel, nsISupports* context, const PRUnichar* aMmsg);
|
||||
NS_DECL_NSIPROGRESSEVENTSINK
|
||||
|
||||
// nsIStreamObserver methods:
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
|
|
|
@ -40,7 +40,9 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -1109,8 +1111,21 @@ NS_IMETHODIMP nsDocLoaderImpl::OnProgress(nsIChannel* aChannel, nsISupports* ctx
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::OnStatus(nsIChannel* channel, nsISupports* ctxt, const PRUnichar* aMsg)
|
||||
NS_IMETHODIMP nsDocLoaderImpl::OnStatus(nsIChannel* aChannel, nsISupports* ctxt,
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
//
|
||||
// Fire progress notifications out to any registered nsIWebProgressListeners
|
||||
//
|
||||
if (aStatus) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString msg;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(msg));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
FireOnStatusChange(this, aChannel, aStatus, msg);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1245,7 +1260,9 @@ void nsDocLoaderImpl::FireOnStateChange(nsIWebProgress *aProgress,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::FireOnLocationChange(nsIURI *aUri)
|
||||
nsDocLoaderImpl::FireOnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *aUri)
|
||||
{
|
||||
PRInt32 count;
|
||||
|
||||
|
@ -1261,7 +1278,33 @@ nsDocLoaderImpl::FireOnLocationChange(nsIURI *aUri)
|
|||
continue;
|
||||
}
|
||||
|
||||
listener->OnLocationChange(aUri);
|
||||
listener->OnLocationChange(aWebProgress, aRequest, aUri);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::FireOnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
PRInt32 count;
|
||||
|
||||
count = mListenerList.Count();
|
||||
while (count > 0) {
|
||||
nsIWebProgressListener *listener;
|
||||
|
||||
listener = NS_STATIC_CAST(nsIWebProgressListener*,
|
||||
mListenerList.ElementAt(--count));
|
||||
|
||||
NS_ASSERTION(listener, "NULL listener found in list.");
|
||||
if (! listener) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -30,6 +30,8 @@ interface nsIDocumentLoaderObserver;
|
|||
interface nsIContentViewerContainer;
|
||||
interface nsIChannel;
|
||||
interface nsIURI;
|
||||
interface nsIWebProgress;
|
||||
interface nsIRequest;
|
||||
|
||||
[scriptable, uuid(f43ba260-0737-11d2-beb9-00805f8a66dc)]
|
||||
interface nsIDocumentLoader : nsISupports
|
||||
|
@ -50,6 +52,12 @@ interface nsIDocumentLoader : nsISupports
|
|||
// called between a parent doc loader and it's child.
|
||||
void clearParentDocLoader();
|
||||
|
||||
void fireOnLocationChange(in nsIURI aUri);
|
||||
void fireOnLocationChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsIURI aUri);
|
||||
void fireOnStatusChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsresult aStatus,
|
||||
in wstring aMessage);
|
||||
};
|
||||
|
||||
|
|
|
@ -110,5 +110,16 @@ interface nsIWebProgressListener : nsISupports
|
|||
|
||||
@param location - The URI of the location that is being loaded.
|
||||
*/
|
||||
void onLocationChange(in nsIURI location);
|
||||
void onLocationChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsIURI location);
|
||||
|
||||
/**
|
||||
* Notification that the status has changed. The status message is usually
|
||||
* printed in the status bar of the browser.
|
||||
*/
|
||||
void onStatusChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsresult aStatus,
|
||||
in wstring aMessage);
|
||||
};
|
|
@ -2176,11 +2176,19 @@ nsBrowserWindow::OnProgress(nsIChannel* channel, nsISupports *ctxt,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::OnStatus(nsIChannel* channel, nsISupports *ctxt, const PRUnichar *aMsg)
|
||||
nsBrowserWindow::OnStatus(nsIChannel* channel, nsISupports *ctxt,
|
||||
nsresult aStatus, const PRUnichar *aStatusArg)
|
||||
{
|
||||
if (mStatus) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString msg;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(msg));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
PRUint32 size;
|
||||
mStatus->SetText(aMsg,size);
|
||||
nsAutoString msg2 = msg;
|
||||
mStatus->SetText(msg2, size);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -447,7 +447,9 @@ nsWebBrowserChrome::OnStateChange(nsIWebProgress* aProgress,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnLocationChange(nsIURI* aURI)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
nsXPIDLCString spec;
|
||||
|
||||
|
@ -465,6 +467,19 @@ NS_IMETHODIMP nsWebBrowserChrome::OnLocationChange(nsIURI* aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
if (mBrowserWindow->mStatus) {
|
||||
PRUint32 size;
|
||||
mBrowserWindow->mStatus->SetText(aMessage, size);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowserChrome: Helpers
|
||||
//*****************************************************************************
|
||||
|
@ -574,7 +589,7 @@ void nsWebBrowserChrome::OnLoadFinished(nsIRequest* aRequest,
|
|||
|
||||
if(mBrowserWindow->mStatus)
|
||||
{
|
||||
PRUint32 size;
|
||||
// PRUint32 size;
|
||||
|
||||
msg.AppendWithConversion(" done.");
|
||||
|
||||
|
|
|
@ -109,7 +109,10 @@ CPP_OBJS = \
|
|||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
LOCALEDIR=$(DIST)\bin\chrome\locales\en-US\global\locale
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) xpcom.properties $(LOCALEDIR)
|
||||
# $(MAKE_INSTALL) $(LIBNAME).$(DLL_SUFFIX) $(DIST)\bin
|
||||
# $(MAKE_INSTALL) $(LIBNAME).$(LIB_SUFFIX) $(DIST)\lib
|
||||
|
||||
|
|
|
@ -120,19 +120,19 @@ nsErrorService::GetErrorStringBundle(PRInt16 errorModule, char **result)
|
|||
NS_IMETHODIMP
|
||||
nsErrorService::RegisterErrorStringBundleKey(nsresult error, const char *stringBundleKey)
|
||||
{
|
||||
return mErrorStringBundleKeyMap.Put(NS_ERROR_GET_CODE(error), stringBundleKey);
|
||||
return mErrorStringBundleKeyMap.Put(error, stringBundleKey);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsErrorService::UnregisterErrorStringBundleKey(nsresult error)
|
||||
{
|
||||
return mErrorStringBundleKeyMap.Remove(NS_ERROR_GET_CODE(error));
|
||||
return mErrorStringBundleKeyMap.Remove(error);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsErrorService::GetErrorStringBundleKey(nsresult error, char **result)
|
||||
{
|
||||
char* value = mErrorStringBundleKeyMap.Get(NS_ERROR_GET_CODE(error));
|
||||
char* value = mErrorStringBundleKeyMap.Get(error);
|
||||
if (value == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*result = value;
|
||||
|
|
|
@ -54,10 +54,10 @@ interface nsIXULBrowserWindow : nsISupports
|
|||
void setDefaultStatus(in wstring status);
|
||||
|
||||
/*
|
||||
Tells the browser window that there is a status change with the window.
|
||||
These status flags are specified in nsIWebProgress.
|
||||
Tells the browser window that there is a state change with the window.
|
||||
These state flags are specified in nsIWebProgress.
|
||||
*/
|
||||
void onStatusChange(in nsIChannel aChannel, in unsigned long aProgressStatusFlags);
|
||||
void onStateChange(in nsIChannel aChannel, in unsigned long aProgressStateFlags);
|
||||
|
||||
/*
|
||||
Tells the browser window that the location of the window has changed.
|
||||
|
@ -69,5 +69,10 @@ interface nsIXULBrowserWindow : nsISupports
|
|||
*/
|
||||
void onProgress (in nsIChannel aChannel, in long aCurrentProgress, in long aMaxProgress);
|
||||
|
||||
/*
|
||||
Tells the browser window that a new status message is available.
|
||||
*/
|
||||
void onStatus(in nsIChannel aChannel, in nsresult aStatus, in wstring aMsg);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -342,13 +342,24 @@ nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnLocationChange(nsIURI* aLocation)
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aLocation)
|
||||
{
|
||||
// If loading a new root .xul document, then redo chrome.
|
||||
mXULWindow->mChromeLoaded = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsChromeTreeOwner: Helpers
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -54,10 +54,10 @@ interface nsIXULBrowserWindow : nsISupports
|
|||
void setDefaultStatus(in wstring status);
|
||||
|
||||
/*
|
||||
Tells the browser window that there is a status change with the window.
|
||||
These status flags are specified in nsIWebProgress.
|
||||
Tells the browser window that there is a state change with the window.
|
||||
These state flags are specified in nsIWebProgress.
|
||||
*/
|
||||
void onStatusChange(in nsIChannel aChannel, in unsigned long aProgressStatusFlags);
|
||||
void onStateChange(in nsIChannel aChannel, in unsigned long aProgressStateFlags);
|
||||
|
||||
/*
|
||||
Tells the browser window that the location of the window has changed.
|
||||
|
@ -69,5 +69,10 @@ interface nsIXULBrowserWindow : nsISupports
|
|||
*/
|
||||
void onProgress (in nsIChannel aChannel, in long aCurrentProgress, in long aMaxProgress);
|
||||
|
||||
/*
|
||||
Tells the browser window that a new status message is available.
|
||||
*/
|
||||
void onStatus(in nsIChannel aChannel, in nsresult aStatus, in wstring aMsg);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ nsXULBrowserWindow.prototype =
|
|||
statusMeter.setAttribute("mode","undetermined");
|
||||
}
|
||||
},
|
||||
onStatusChange : function(channel, status)
|
||||
onStateChange : function(channel, state)
|
||||
{
|
||||
if(!throbberElement)
|
||||
throbberElement = document.getElementById("navigator-throbber");
|
||||
|
@ -286,8 +286,8 @@ nsXULBrowserWindow.prototype =
|
|||
if(!stopMenu)
|
||||
stopMenu = document.getElementById("menuitem-stop");
|
||||
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_start) {
|
||||
if(status & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
if (state & Components.interfaces.nsIWebProgressListener.flag_start) {
|
||||
if(state & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
// Remember when loading commenced.
|
||||
startTime = (new Date()).getTime();
|
||||
// Turn progress meter on.
|
||||
|
@ -304,25 +304,27 @@ nsXULBrowserWindow.prototype =
|
|||
totalRequests = 0;
|
||||
finishedRequests = 0;
|
||||
}
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
if (state & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
totalRequests += 1;
|
||||
}
|
||||
}
|
||||
else if (status & Components.interfaces.nsIWebProgressListener.flag_stop) {
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
else if (state & Components.interfaces.nsIWebProgressListener.flag_stop) {
|
||||
if (state & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
finishedRequests += 1;
|
||||
if (!useRealProgressFlag) {
|
||||
this.onProgress(null, finishedRequests, totalRequests);
|
||||
}
|
||||
}
|
||||
if(status & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
if(state & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
// Record page loading time.
|
||||
var elapsed = ( (new Date()).getTime() - startTime ) / 1000;
|
||||
var msg = bundle.GetStringFromName("nv_done") + " (" + elapsed + " secs)";
|
||||
dump( msg + "\n" );
|
||||
defaultStatus = msg;
|
||||
UpdateStatusField();
|
||||
window.XULBrowserWindow.setDefaultStatus(msg);
|
||||
//window.XULBrowserWindow.setDefaultStatus(msg);
|
||||
//this.setDefaultStatus(msg);
|
||||
this.setOverLink(msg);
|
||||
// Turn progress meter off.
|
||||
statusMeter.setAttribute("mode","normal");
|
||||
statusMeter.value = 0; // be sure to clear the progress bar
|
||||
|
@ -334,8 +336,8 @@ nsXULBrowserWindow.prototype =
|
|||
stopMenu.setAttribute("disabled", true);
|
||||
}
|
||||
}
|
||||
else if (status & Components.interfaces.nsIWebProgressListener.flag_transferring) {
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_document) {
|
||||
else if (state & Components.interfaces.nsIWebProgressListener.flag_transferring) {
|
||||
if (state & Components.interfaces.nsIWebProgressListener.flag_is_document) {
|
||||
var ctype=channel.contentType;
|
||||
|
||||
if (ctype != "text/html") {
|
||||
|
@ -343,7 +345,7 @@ nsXULBrowserWindow.prototype =
|
|||
}
|
||||
statusMeter.setAttribute("mode", "normal");
|
||||
}
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
if (state & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
if (!useRealProgressFlag) {
|
||||
this.onProgress(null, finishedRequests, totalRequests);
|
||||
}
|
||||
|
@ -361,6 +363,11 @@ nsXULBrowserWindow.prototype =
|
|||
locationFld.setAttribute("value", location);
|
||||
|
||||
UpdateBackForwardButtons();
|
||||
},
|
||||
onStatus : function(channel, status, msg)
|
||||
{
|
||||
this.setOverLink(msg);
|
||||
//this.setDefaultStatus(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1503,8 +1510,13 @@ var leakDetector = null;
|
|||
|
||||
// Dumps current set of memory leaks.
|
||||
function dumpMemoryLeaks() {
|
||||
if (leakDetector == null)
|
||||
if (leakDetector == null) {
|
||||
leakDetector = createInstance("component://netscape/xpcom/leakdetector", "nsILeakDetector");
|
||||
if (leakDetector == null) {
|
||||
dump("Could not create leak detector, leak detection probably\n");
|
||||
dump("not compiled into this browser\n");
|
||||
}
|
||||
}
|
||||
if (leakDetector != null)
|
||||
leakDetector.dumpLeaks();
|
||||
}
|
||||
|
|
|
@ -1736,15 +1736,16 @@ nsBrowserInstance::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
|
||||
channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mXULBrowserWindow->OnStatusChange(channel, aProgressStateFlags);
|
||||
mXULBrowserWindow->OnStateChange(channel, aProgressStateFlags);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnLocationChange(nsIURI* aLocation)
|
||||
NS_IMETHODIMP nsBrowserInstance::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI* aLocation)
|
||||
{
|
||||
|
||||
EnsureXULBrowserWindow();
|
||||
if(!mXULBrowserWindow)
|
||||
return NS_OK;
|
||||
|
@ -1757,6 +1758,25 @@ NS_IMETHODIMP nsBrowserInstance::OnLocationChange(nsIURI* aLocation)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
EnsureXULBrowserWindow();
|
||||
if(mXULBrowserWindow) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mXULBrowserWindow->OnStatus(channel, aStatus, aMessage);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsBrowserInstance: Helpers
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
|
||||
#include "prprf.h"
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#define DEBUG_PRINTF PR_fprintf
|
||||
#else
|
||||
|
@ -396,11 +399,17 @@ nsStreamXferOp::OnProgress(nsIChannel* channel, nsISupports* aContext,
|
|||
NS_IMETHODIMP
|
||||
nsStreamXferOp::OnStatus( nsIChannel *channel,
|
||||
nsISupports *aContext,
|
||||
const PRUnichar *aMsg ) {
|
||||
nsresult aStatus,
|
||||
const PRUnichar *aStatusArg) {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if ( mObserver ) {
|
||||
nsString msg = aMsg;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString str;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString msg = str;
|
||||
rv = mObserver->Observe( (nsIStreamTransferOperation*)this,
|
||||
NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_PROGID ";onStatus" ).GetUnicode(),
|
||||
msg.GetUnicode() );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
|
@ -825,13 +825,20 @@ nsXPInstallManager::OnProgress(nsIChannel *channel, nsISupports *ctxt, PRUint32
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPInstallManager::OnStatus(nsIChannel *channel, nsISupports *ctxt, const PRUnichar *aMsg)
|
||||
nsXPInstallManager::OnStatus(nsIChannel *channel, nsISupports *ctxt,
|
||||
nsresult aStatus, const PRUnichar *aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
PRTime now = PR_Now();
|
||||
if (!mCancelled && TimeToUpdate(now))
|
||||
{
|
||||
mLastUpdate = now;
|
||||
return mDlg->SetActionText(aMsg);
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString msg;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(msg));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return mDlg->SetActionText(msg);
|
||||
}
|
||||
else
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче