From f1d2e376551476fd79896a698d89526113e58c45 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 3 Jun 2006 00:40:26 +0200 Subject: [PATCH] mshtml: Set binding channel, listener and context in AsyncOpen. --- dlls/mshtml/mshtml_private.h | 31 ++++++++++++++++++++++++++++--- dlls/mshtml/navigate.c | 9 +++++++++ dlls/mshtml/nsiface.idl | 22 ++++++++++++++++++++-- dlls/mshtml/nsio.c | 30 +++++++++++------------------- 4 files changed, 68 insertions(+), 24 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7223a7e13a9..cd8abe13979 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -115,6 +115,22 @@ struct NSContainer { BSCallback *bscallback; /* hack */ }; +typedef struct { + const nsIHttpChannelVtbl *lpHttpChannelVtbl; + const nsIUploadChannelVtbl *lpUploadChannelVtbl; + + LONG ref; + + nsIChannel *channel; + nsIHttpChannel *http_channel; + nsIWineURI *uri; + nsIInputStream *post_data_stream; + nsILoadGroup *load_group; + nsIInterfaceRequestor *notif_callback; + nsLoadFlags load_flags; + nsIURI *original_uri; +} nsChannel; + struct BSCallback { const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl; const IServiceProviderVtbl *lpServiceProviderVtbl; @@ -126,6 +142,10 @@ struct BSCallback { LPWSTR headers; HGLOBAL post_data; ULONG post_data_len; + + nsChannel *nschannel; + nsIStreamListener *nslistener; + nsISupports *nscontext; }; struct HTMLDOMNode { @@ -185,7 +205,6 @@ typedef struct { #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl) #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl) -#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl) #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl) #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl) #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl) @@ -199,9 +218,13 @@ typedef struct { #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl) #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl) -#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl) -#define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl); +#define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl) +#define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl) +#define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl) +#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl) +#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl) +#define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl); #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl) #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl) @@ -253,7 +276,9 @@ PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*); void nsAString_Finish(nsAString*); nsIInputStream *create_nsstream(const char*,PRInt32); + BSCallback *create_bscallback(HTMLDocument*,LPCOLESTR); +HRESULT start_binding(BSCallback*,IMoniker*); IHlink *Hlink_Create(void); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 3101c92005a..dc707269484 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -96,6 +96,12 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface) if(!ref) { if(This->post_data) GlobalFree(This->post_data); + if(This->nschannel) + nsIChannel_Release(NSCHANNEL(This->nschannel)); + if(This->nslistener) + nsIStreamListener_Release(This->nslistener); + if(This->nscontext) + nsISupports_Release(This->nscontext); HeapFree(GetProcessHeap(), 0, This->headers); HeapFree(GetProcessHeap(), 0, This); } @@ -371,6 +377,9 @@ BSCallback *create_bscallback(HTMLDocument *doc, LPCOLESTR url) ret->post_data = NULL; ret->headers = NULL; ret->post_data_len = 0; + ret->nschannel = NULL; + ret->nslistener = NULL; + ret->nscontext = NULL; return ret; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index ab4e751edb9..0af802e077e 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -87,9 +87,7 @@ typedef nsISupports nsIWidget; typedef nsISupports nsIProtocolHandler; typedef nsISupports nsIDOMEventTarget; typedef nsISupports nsIDOMAbstractView; -typedef nsISupports nsIStreamListener; typedef nsISupports nsIHttpHeaderVisitor; -typedef nsISupports nsIRequestObserver; typedef nsISupports nsIDOMBarProp; typedef nsISupports nsIDOMWindowCollection; typedef nsISupports nsISelection; @@ -273,6 +271,26 @@ interface nsIRequest : nsISupports nsresult SetLoadFlags(nsLoadFlags aLoadFlags); } +[ + object, + uuid(fd91e2e0-1481-11d3-9333-00104ba0fd40) +] +interface nsIRequestObserver : nsISupports +{ + nsresult OnStartRequest(nsIRequest *aRequest, nsISupports *aContext); + nsresult OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode); +} + +[ + object, + uuid(1a637020-1482-11d3-9333-00104ba0fd40) +] +interface nsIStreamListener : nsIRequestObserver +{ + nsresult OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext, + nsIInputStream *aInputStream, PRUint32 aOffset, PRUint32 aCount); +} + [ object, uuid(3de0a31c-feaf-400f-9f1e-4ef71f8b20cc) diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 561a750e9da..76f60bae8a5 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -45,22 +45,6 @@ static const IID NS_IOSERVICE_CID = static nsIIOService *nsio = NULL; -typedef struct { - const nsIHttpChannelVtbl *lpHttpChannelVtbl; - const nsIUploadChannelVtbl *lpUploadChannelVtbl; - - LONG ref; - - nsIChannel *channel; - nsIHttpChannel *http_channel; - nsIWineURI *uri; - nsIInputStream *post_data_stream; - nsILoadGroup *load_group; - nsIInterfaceRequestor *notif_callback; - nsLoadFlags load_flags; - nsIURI *original_uri; -} nsChannel; - typedef struct { const nsIWineURIVtbl *lpWineURIVtbl; @@ -70,9 +54,6 @@ typedef struct { NSContainer *container; } nsURI; -#define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl) -#define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl) -#define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl) #define NSURI(x) ((nsIURI*) &(x)->lpWineURIVtbl) static nsresult create_uri(nsIURI*,NSContainer*,nsIURI**); @@ -590,6 +571,17 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen } if(container->bscallback) { + nsIChannel_AddRef(NSCHANNEL(This)); + container->bscallback->nschannel = This; + + nsIStreamListener_AddRef(aListener); + container->bscallback->nslistener = aListener; + + if(aContext) { + nsISupports_AddRef(aContext); + container->bscallback->nscontext = aContext; + } + nsIWebBrowserChrome_Release(NSWBCHROME(container)); }else { BOOL cont = before_async_open(This, container);