From 119af4768303eb4081e8f38dee7dfd4f39662002 Mon Sep 17 00:00:00 2001 From: Zhenbo Li Date: Tue, 7 Jul 2015 22:49:58 +0800 Subject: [PATCH] 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 b857b454bd1..0a9824d71e5 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 1432b2c9bc3..54f0187ed73 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) -- 2.11.4.GIT