Zhenbo Li : mshtml: Add IHTMLXMLHttpRequest::send() method implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 8 09:51:23 CDT 2015


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

Author: Zhenbo Li <litimetal at gmail.com>
Date:   Tue Jul  7 22:49:58 2015 +0800

mshtml: Add IHTMLXMLHttpRequest::send() method implementation.

---

 dlls/mshtml/tests/xmlhttprequest.c | 27 ++++++++++++++-------------
 dlls/mshtml/xmlhttprequest.c       | 24 ++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c
index b857b45..0a9824d 100644
--- a/dlls/mshtml/tests/xmlhttprequest.c
+++ b/dlls/mshtml/tests/xmlhttprequest.c
@@ -613,13 +613,13 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url)
     SET_EXPECT(xmlhttprequest_onreadystatechange_done);
     hres = IHTMLXMLHttpRequest_send(xhr, vempty);
 
-    todo_wine ok(hres == S_OK, "send failed: %08x\n", hres);
+    ok(hres == S_OK, "send failed: %08x\n", hres);
     if(SUCCEEDED(hres))
         pump_msgs(&called_xmlhttprequest_onreadystatechange_done);
     todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
-    todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_headers_received);
-    todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_loading);
-    todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_done);
+    CHECK_CALLED(xmlhttprequest_onreadystatechange_headers_received);
+    CHECK_CALLED(xmlhttprequest_onreadystatechange_loading);
+    CHECK_CALLED(xmlhttprequest_onreadystatechange_done);
 
     if(FAILED(hres)) {
         IHTMLXMLHttpRequest_Release(xhr);
@@ -629,26 +629,27 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url)
 
     val = 0xdeadbeef;
     hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
-    ok(hres == S_OK, "get_status failed: %08x\n", hres);
+    todo_wine ok(hres == S_OK, "get_status failed: %08x\n", hres);
     todo_wine ok(val == 200, "Expect 200, got %d\n", val);
 
+    text = NULL;
     hres = IHTMLXMLHttpRequest_get_statusText(xhr, &text);
-    ok(hres == S_OK, "get_statusText failed: %08x\n", hres);
+    todo_wine ok(hres == S_OK, "get_statusText failed: %08x\n", hres);
     todo_wine ok(text != NULL, "text == NULL\n");
-    todo_wine ok(!strcmp_wa(text, "OK"),
-        "Expected \"OK\", got %s\n", wine_dbgstr_w(text));
+    todo_wine ok(!strcmp_wa(text, "OK"), "Expected \"OK\", got %s\n", wine_dbgstr_w(text));
     SysFreeString(text);
 
     val = 0xdeadbeef;
     hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val);
     ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
-    todo_wine ok(val == 4, "Expect DONE, got %d\n", val);
+    ok(val == 4, "Expect DONE, got %d\n", val);
 
+    text = NULL;
     hres = IHTMLXMLHttpRequest_get_responseText(xhr, &text);
-    ok(hres == S_OK, "get_responseText failed: %08x\n", hres);
-    ok(text != NULL, "test == NULL\n");
-    ok(!strcmp_wa(text, EXPECT_RESPONSE_TEXT), "expect %s, got %s\n",
-            EXPECT_RESPONSE_TEXT, wine_dbgstr_w(text));
+    todo_wine ok(hres == S_OK, "get_responseText failed: %08x\n", hres);
+    todo_wine ok(text != NULL, "test == NULL\n");
+    todo_wine ok(!strcmp_wa(text, EXPECT_RESPONSE_TEXT), "expect %s, got %s\n",
+        EXPECT_RESPONSE_TEXT, wine_dbgstr_w(text));
     SysFreeString(text);
 
     IHTMLXMLHttpRequest_Release(xhr);
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c
index 1432b2c..54f0187 100644
--- a/dlls/mshtml/xmlhttprequest.c
+++ b/dlls/mshtml/xmlhttprequest.c
@@ -405,8 +405,28 @@ static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR b
 static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
 {
     HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_variant(&varBody));
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&varBody));
+
+    switch(V_VT(&varBody)) {
+        case VT_NULL:
+        case VT_EMPTY:
+        case VT_ERROR:
+            break;
+        default:
+            FIXME("varBody(%s) unsupported\n", debugstr_variant(&varBody));
+            return E_FAIL;
+    }
+
+    nsres = nsIXMLHttpRequest_Send(This->nsxhr, NULL);
+
+    if(NS_FAILED(nsres)) {
+        ERR("nsIXMLHttpRequest_Send failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpRequest *iface, BSTR *p)




More information about the wine-cvs mailing list