Jacek Caban : mshtml: Set binding channel, listener and context in AsyncOpen.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jun 3 05:24:42 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: f1d2e376551476fd79896a698d89526113e58c45
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=f1d2e376551476fd79896a698d89526113e58c45

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Jun  3 00:40:26 2006 +0200

mshtml: Set binding channel, listener and context in AsyncOpen.

---

 dlls/mshtml/mshtml_private.h |   29 +++++++++++++++++++++++++++--
 dlls/mshtml/navigate.c       |    9 +++++++++
 dlls/mshtml/nsiface.idl      |   22 ++++++++++++++++++++--
 dlls/mshtml/nsio.c           |   30 +++++++++++-------------------
 4 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 7223a7e..cd8abe1 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 @@ #define INPLACEWIN(x)    ((IOleInPlaceOb
 #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,10 +218,14 @@ #define NSTOOLTIP(x)     ((nsITooltipLis
 #define NSWEAKREF(x)     ((nsIWeakReference*)             &(x)->lpWeakReferenceVtbl)
 #define NSSUPWEAKREF(x)  ((nsISupportsWeakReference*)     &(x)->lpSupportsWeakReferenceVtbl)
 
+#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)
 #define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)
@@ -253,7 +276,9 @@ PRUint32 nsAString_GetData(const nsAStri
 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 3101c92..dc70726 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -96,6 +96,12 @@ static ULONG WINAPI BindStatusCallback_R
     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(HTMLDocume
     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 ab4e751..0af802e 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;
@@ -275,6 +273,26 @@ interface nsIRequest : nsISupports
 
 [
     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)
 ]
 interface nsILoadGroup : nsIRequest
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 561a750..76f60ba 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -46,22 +46,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;
 
     LONG ref;
@@ -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_AsyncOpe
         }
 
         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);




More information about the wine-cvs mailing list