mshtml: Report better status in on_stop_nsrequest.

This commit is contained in:
Jacek Caban 2010-10-06 21:35:22 +02:00 committed by Alexandre Julliard
parent d48a56db5c
commit 6fff7e7c05
2 changed files with 22 additions and 5 deletions

View File

@ -34,6 +34,9 @@
#include "nsiface.h"
#define NS_ERROR_GENERATE_FAILURE(module,code) \
((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
#define NS_OK ((nsresult)0x00000000L)
#define NS_ERROR_FAILURE ((nsresult)0x80004005L)
#define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
@ -42,7 +45,11 @@
#define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
#define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
#define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
#define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
#define NS_ERROR_MODULE_NETWORK 6
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
#define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
#define NS_FAILED(res) ((res) & 0x80000000)
#define NS_SUCCEEDED(res) (!NS_FAILED(res))

View File

@ -992,7 +992,18 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
{
nsresult nsres;
nsresult nsres, request_result;
switch(result) {
case S_OK:
request_result = NS_OK;
break;
case E_ABORT:
request_result = NS_BINDING_ABORTED;
break;
default:
request_result = NS_ERROR_FAILURE;
}
if(!This->bsc.readed && SUCCEEDED(result)) {
TRACE("No data read! Calling OnStartRequest\n");
@ -1001,15 +1012,14 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
if(This->nslistener) {
nsres = nsIStreamListener_OnStopRequest(This->nslistener,
(nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, SUCCEEDED(result) ? NS_OK : NS_ERROR_FAILURE);
(nsIRequest*)NSCHANNEL(This->nschannel), This->nscontext, request_result);
if(NS_FAILED(nsres))
WARN("OnStopRequet failed: %08x\n", nsres);
}
if(This->nschannel->load_group) {
nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
(nsIRequest*)NSCHANNEL(This->nschannel), NULL, NS_OK);
(nsIRequest*)NSCHANNEL(This->nschannel), NULL, request_result);
if(NS_FAILED(nsres))
ERR("RemoveRequest failed: %08x\n", nsres);
}