fixes bug 197079 "Status bar doesn't display 'Stopped' when stop button is clicked" r=dougt sr=jag a=asa

This commit is contained in:
darin%netscape.com 2003-05-02 06:31:55 +00:00
Родитель 1196a91c44
Коммит 34c20a2555
8 изменённых файлов: 67 добавлений и 27 удалений

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

@ -403,7 +403,7 @@ nsDateTimeChannel::OnTransportStatus(nsITransport *trans, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
// suppress status notification if channel is no longer pending!
if (mProgressSink && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
if (mProgressSink && NS_SUCCEEDED(mStatus) && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
NS_ConvertUTF8toUCS2 host(mHost);
mProgressSink->OnStatus(this, nsnull, status, host.get());

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

@ -425,7 +425,7 @@ nsFingerChannel::OnTransportStatus(nsITransport *trans, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
// suppress status notification if channel is no longer pending!
if (mProgressSink && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
if (mProgressSink && NS_SUCCEEDED(mStatus) && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
NS_ConvertUTF8toUCS2 host(mHost);
mProgressSink->OnStatus(this, nsnull, status, host.get());

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

@ -8266,7 +8266,7 @@ NS_IMETHODIMP
nsImapMockChannel::OnTransportStatus(nsITransport *transport, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
if (mProgressEventSink && !(mLoadFlags & LOAD_BACKGROUND))
if (mProgressEventSink && NS_SUCCEEDED(m_cancelStatus) && !(mLoadFlags & LOAD_BACKGROUND))
{
// these transport events should not generate any status messages
if (status == nsISocketTransport::STATUS_RECEIVING_FROM ||

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

@ -41,35 +41,74 @@ interface nsIURI;
interface nsIRequest;
/**
* An instance of nsIFfpEventSink should be passed as the eventSink
* argument of nsINetService::NewConnection for ftp URLs. It defines
* the callbacks to the application program (the html parser).
* nsIProgressEventSink
*
* This interface is used to asynchronously convey channel status and progress
* information that is generally not critical to the processing of the channel.
* The information is intended to be displayed to the user in some meaningful
* way.
*
* An implementation of this interface can be passed to a channel via the
* channel's notificationCallbacks attribute. See nsIChannel for more info.
*
* The channel will begin passing notifications to the progress event sink
* after its asyncOpen method has been called. Notifications will cease once
* the channel calls its listener's onStopRequest method or once the channel
* is canceled (via nsIRequest::cancel).
*
* NOTE: This interface is actually not specific to channels and may be used
* with other implementations of nsIRequest.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(dd47ee00-18c2-11d3-9337-00104ba0fd40)]
interface nsIProgressEventSink : nsISupports
{
/**
* Notify the EventSink that progress has occurred for the URL load.<BR>
* Called to notify the event sink that progress has occurred for the
* given request.
*
* @param aRequest
* the request being observed (may QI to nsIChannel).
* @param aContext
* if aRequest is a channel, then this parameter is the listener
* context passed to nsIChannel::asyncOpen.
* @param aProgress
* numeric value in the range 0 to aProgressMax indicating the
* number of bytes transfered thus far.
* @param aProgressMax
* numeric value indicating maximum number of bytes that will be
* transfered (or 0xFFFFFFFF if total is unknown).
*/
void onProgress(in nsIRequest request,
in nsISupports ctxt,
void onProgress(in nsIRequest aRequest,
in nsISupports aContext,
in unsigned long aProgress,
in unsigned long aProgressMax);
/**
* 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.
* Called to notify the event sink with a status message for the given
* request.
*
* @param aRequest
* the request being observed (may QI to nsIChannel).
* @param aContext
* if aRequest is a channel, then this parameter is the listener
* context passed to nsIChannel::asyncOpen.
* @param aStatus
* status code (not necessarily an error code) indicating the
* state of the channel (usually the state of the underlying
* transport). see nsISocketTransport for socket specific status
* codes.
* @param aStatusArg
* status code argument to be used with the string bundle service
* to convert the status message into localized, human readable
* text. the meaning of this parameter is specific to the value
* of the status code. for socket status codes, this parameter
* indicates the host:port associated with the status code.
*/
void onStatus(in nsIRequest request,
in nsISupports ctxt,
in nsresult status,
in wstring statusArg);
void onStatus(in nsIRequest aRequest,
in nsISupports aContext,
in nsresult aStatus,
in wstring aStatusArg);
};

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

@ -165,6 +165,7 @@ NS_IMETHODIMP
nsFileChannel::Cancel(nsresult status)
{
NS_ENSURE_TRUE(mRequest, NS_ERROR_UNEXPECTED);
mStatus = status;
return mRequest->Cancel(status);
}
@ -596,7 +597,7 @@ nsFileChannel::OnTransportStatus(nsITransport *trans, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
// suppress status notification if channel is no longer pending!
if (mProgressSink && mRequest && !(mLoadFlags & LOAD_BACKGROUND)) {
if (mProgressSink && NS_SUCCEEDED(mStatus) && mRequest && !(mLoadFlags & LOAD_BACKGROUND)) {
// file channel does not send OnStatus events!
if (status == nsITransport::STATUS_READING ||
status == nsITransport::STATUS_WRITING) {

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

@ -581,7 +581,7 @@ nsFTPChannel::OnStatus(nsIRequest *request, nsISupports *aContext,
NS_ERROR("ftp state is null.");
}
if (!mEventSink || (mLoadFlags & LOAD_BACKGROUND) || !mIsPending)
if (!mEventSink || (mLoadFlags & LOAD_BACKGROUND) || !mIsPending || NS_FAILED(mStatus))
return NS_OK;
return mEventSink->OnStatus(this, mUserContext, aStatus,

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

@ -783,7 +783,7 @@ nsGopherChannel::OnTransportStatus(nsITransport *trans, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
// suppress status notification if channel is no longer pending!
if (mProgressSink && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
if (mProgressSink && NS_SUCCEEDED(mStatus) && mPump && !(mLoadFlags & LOAD_BACKGROUND)) {
NS_ConvertUTF8toUCS2 host(mHost);
mProgressSink->OnStatus(this, nsnull, status, host.get());

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

@ -3188,8 +3188,8 @@ NS_IMETHODIMP
nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status,
PRUint32 progress, PRUint32 progressMax)
{
// block socket status event after OnStopRequest has been fired.
if (mProgressSink && mIsPending && !(mLoadFlags & LOAD_BACKGROUND)) {
// block socket status event after Cancel or OnStopRequest has been called.
if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && !(mLoadFlags & LOAD_BACKGROUND)) {
LOG(("sending status notification [this=%x status=%x progress=%u/%u]\n",
this, status, progress, progressMax));