Jacek Caban : mshtml: Call necko's SetUploadStream from wrapper' s SetUploadStream.

Alexandre Julliard julliard at winehq.org
Mon Nov 24 09:16:35 CST 2008


Module: wine
Branch: master
Commit: 3dbeb15eacaf4e046b924804891f0313e7f68beb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3dbeb15eacaf4e046b924804891f0313e7f68beb

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Nov 22 20:06:37 2008 +0100

mshtml: Call necko's SetUploadStream from wrapper's SetUploadStream.

---

 dlls/mshtml/nsio.c |   38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 1843542..31fb897 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -756,25 +756,6 @@ static nsresult async_open(nsChannel *This, NSContainer *container, nsIStreamLis
     HRESULT hres;
 
     if(This->channel) {
-        if(This->post_data_stream) {
-            nsIUploadChannel *upload_channel;
-
-            nsres = nsIChannel_QueryInterface(This->channel, &IID_nsIUploadChannel,
-                                          (void**)&upload_channel);
-            if(NS_SUCCEEDED(nsres)) {
-                nsACString empty_string;
-                nsACString_Init(&empty_string, "");
-
-                nsres = nsIUploadChannel_SetUploadStream(upload_channel, This->post_data_stream,
-                                                         &empty_string, -1);
-                nsIUploadChannel_Release(upload_channel);
-                if(NS_FAILED(nsres))
-                    WARN("SetUploadStream failed: %08x\n", nsres);
-
-                nsACString_Finish(&empty_string);
-            }
-        }
-
         nsres = nsIChannel_AsyncOpen(This->channel, listener, context);
 
         if(mon)
@@ -1162,6 +1143,7 @@ static nsresult NSAPI nsUploadChannel_SetUploadStream(nsIUploadChannel *iface,
 {
     nsChannel *This = NSUPCHANNEL_THIS(iface);
     const char *content_type;
+    nsresult nsres;
 
     TRACE("(%p)->(%p %p %d)\n", This, aStream, aContentType, aContentLength);
 
@@ -1177,9 +1159,25 @@ static nsresult NSAPI nsUploadChannel_SetUploadStream(nsIUploadChannel *iface,
     if(aContentLength != -1)
         FIXME("Unsupported acontentLength = %d\n", aContentLength);
 
+    if(This->post_data_stream)
+        nsIInputStream_Release(This->post_data_stream);
+    This->post_data_stream = aStream;
     if(aStream)
         nsIInputStream_AddRef(aStream);
-    This->post_data_stream = aStream;
+
+    if(This->post_data_stream) {
+        nsIUploadChannel *upload_channel;
+
+        nsres = nsIChannel_QueryInterface(This->channel, &IID_nsIUploadChannel,
+                (void**)&upload_channel);
+        if(NS_SUCCEEDED(nsres)) {
+            nsres = nsIUploadChannel_SetUploadStream(upload_channel, aStream, aContentType, aContentLength);
+            nsIUploadChannel_Release(upload_channel);
+            if(NS_FAILED(nsres))
+                WARN("SetUploadStream failed: %08x\n", nsres);
+
+        }
+    }
 
     return NS_OK;
 }




More information about the wine-cvs mailing list