mshtml: Added nsIChannel::Cancel implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2015-12-21 14:31:29 +01:00 committed by Alexandre Julliard
parent 11a6bfc673
commit 86c097142b
3 changed files with 23 additions and 8 deletions

View File

@ -55,6 +55,8 @@ typedef struct {
REQUEST_METHOD request_method; REQUEST_METHOD request_method;
struct list response_headers; struct list response_headers;
struct list request_headers; struct list request_headers;
nsChannelBSC *binding;
} nsChannel; } nsChannel;
typedef struct { typedef struct {

View File

@ -927,6 +927,8 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
{ {
nsresult nsres; nsresult nsres;
This->nschannel->binding = This;
/* FIXME: it's needed for http connections from BindToObject. */ /* FIXME: it's needed for http connections from BindToObject. */
if(!This->nschannel->response_status) if(!This->nschannel->response_status)
This->nschannel->response_status = 200; This->nschannel->response_status = 200;
@ -972,11 +974,15 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
WARN("OnStopRequest failed: %08x\n", nsres); WARN("OnStopRequest failed: %08x\n", nsres);
} }
if(This->nschannel && This->nschannel->load_group) { if(This->nschannel) {
nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group, if(This->nschannel->load_group) {
(nsIRequest*)&This->nschannel->nsIHttpChannel_iface, NULL, request_result); nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
if(NS_FAILED(nsres)) (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, NULL, request_result);
ERR("RemoveRequest failed: %08x\n", nsres); if(NS_FAILED(nsres))
ERR("RemoveRequest failed: %08x\n", nsres);
}
if(This->nschannel->binding == This)
This->nschannel->binding = NULL;
} }
} }
@ -1217,8 +1223,11 @@ static void nsChannelBSC_destroy(BSCallback *bsc)
{ {
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc); nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->nschannel) if(This->nschannel) {
if(This->nschannel->binding == This)
This->nschannel->binding = NULL;
nsIHttpChannel_Release(&This->nschannel->nsIHttpChannel_iface); nsIHttpChannel_Release(&This->nschannel->nsIHttpChannel_iface);
}
if(This->nslistener) if(This->nslistener)
nsIStreamListener_Release(This->nslistener); nsIStreamListener_Release(This->nslistener);
if(This->nscontext) if(This->nscontext)

View File

@ -617,9 +617,13 @@ static nsresult NSAPI nsChannel_Cancel(nsIHttpChannel *iface, nsresult aStatus)
{ {
nsChannel *This = impl_from_nsIHttpChannel(iface); nsChannel *This = impl_from_nsIHttpChannel(iface);
FIXME("(%p)->(%08x)\n", This, aStatus); TRACE("(%p)->(%08x)\n", This, aStatus);
return NS_ERROR_NOT_IMPLEMENTED; if(This->binding && This->binding->bsc.binding)
IBinding_Abort(This->binding->bsc.binding);
else
WARN("No binding to cancel\n");
return NS_OK;
} }
static nsresult NSAPI nsChannel_Suspend(nsIHttpChannel *iface) static nsresult NSAPI nsChannel_Suspend(nsIHttpChannel *iface)