Commit 6ca9da18 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Convert varAsync to bool if needed.

parent 5a009e43
...@@ -522,16 +522,21 @@ static void test_responseXML(const WCHAR *expect_text) ...@@ -522,16 +522,21 @@ static void test_responseXML(const WCHAR *expect_text)
IDispatch_Release(disp); IDispatch_Release(disp);
} }
#define xhr_open(a,b) _xhr_open(__LINE__,a,b) #define xhr_open(a,b,c) _xhr_open(__LINE__,a,b,c)
static HRESULT _xhr_open(unsigned line, const WCHAR *url_w, const WCHAR *method_w) static HRESULT _xhr_open(unsigned line, const WCHAR *url_w, const WCHAR *method_w, BOOL use_bool)
{ {
BSTR method = SysAllocString(method_w); BSTR method = SysAllocString(method_w);
BSTR url = SysAllocString(url_w); BSTR url = SysAllocString(url_w);
VARIANT async, empty; VARIANT async, empty;
HRESULT hres; HRESULT hres;
V_VT(&async) = VT_BOOL; if(use_bool) {
V_BOOL(&async) = VARIANT_TRUE; V_VT(&async) = VT_BOOL;
V_BOOL(&async) = VARIANT_TRUE;
}else {
V_VT(&async) = VT_I4;
V_I4(&async) = 1;
}
V_VT(&empty) = VT_EMPTY; V_VT(&empty) = VT_EMPTY;
hres = IHTMLXMLHttpRequest_open(xhr, method, url, async, empty, empty); hres = IHTMLXMLHttpRequest_open(xhr, method, url, async, empty, empty);
...@@ -787,7 +792,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const WCHAR *xml_url, const WCHA ...@@ -787,7 +792,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const WCHAR *xml_url, const WCHA
ok(val == 0, "Expect UNSENT, got %ld\n", val); ok(val == 0, "Expect UNSENT, got %ld\n", val);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
hres = xhr_open(xml_url, L"GET"); hres = xhr_open(xml_url, L"GET", TRUE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
if(FAILED(hres)) { if(FAILED(hres)) {
...@@ -898,7 +903,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url) ...@@ -898,7 +903,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url)
hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var); hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
xhr_open(xml_url, L"GET"); xhr_open(xml_url, L"GET", TRUE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
hres = IHTMLXMLHttpRequest_abort(xhr); hres = IHTMLXMLHttpRequest_abort(xhr);
...@@ -922,7 +927,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url) ...@@ -922,7 +927,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url)
hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var); hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
xhr_open(xml_url, L"GET"); xhr_open(xml_url, L"GET", FALSE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
loading_cnt = 0; loading_cnt = 0;
...@@ -969,7 +974,7 @@ static void test_xhr_post(IHTMLDocument2 *doc) ...@@ -969,7 +974,7 @@ static void test_xhr_post(IHTMLDocument2 *doc)
ok(hres == S_OK, "put_onreadystatechange failed: %08lx\n", hres); ok(hres == S_OK, "put_onreadystatechange failed: %08lx\n", hres);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
xhr_open(L"http://test.winehq.org/tests/post.php", L"POST"); xhr_open(L"http://test.winehq.org/tests/post.php", L"POST", FALSE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
set_request_header(xhr, L"Content-Type", L"application/x-www-form-urlencoded"); set_request_header(xhr, L"Content-Type", L"application/x-www-form-urlencoded");
......
...@@ -508,8 +508,12 @@ static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR b ...@@ -508,8 +508,12 @@ static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR b
TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword)); TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword));
if(V_VT(&varAsync) != VT_BOOL) { if(V_VT(&varAsync) != VT_BOOL) {
FIXME("varAsync not supported: %s\n", debugstr_variant(&varAsync)); LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
return E_FAIL; hres = VariantChangeTypeEx(&varAsync, &varAsync, lcid, 0, VT_BOOL);
if(FAILED(hres)) {
WARN("Failed to convert varAsync to BOOL: %#lx\n", hres);
return hres;
}
} }
/* Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), /* Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment