mshtml: Convert varAsync to bool if needed.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2022-05-19 21:06:39 +03:00 committed by Alexandre Julliard
parent 5a009e43f9
commit 6ca9da180b
2 changed files with 19 additions and 10 deletions

View File

@ -522,16 +522,21 @@ static void test_responseXML(const WCHAR *expect_text)
IDispatch_Release(disp);
}
#define xhr_open(a,b) _xhr_open(__LINE__,a,b)
static HRESULT _xhr_open(unsigned line, const WCHAR *url_w, const WCHAR *method_w)
#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, BOOL use_bool)
{
BSTR method = SysAllocString(method_w);
BSTR url = SysAllocString(url_w);
VARIANT async, empty;
HRESULT hres;
V_VT(&async) = VT_BOOL;
V_BOOL(&async) = VARIANT_TRUE;
if(use_bool) {
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;
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
ok(val == 0, "Expect UNSENT, got %ld\n", val);
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);
if(FAILED(hres)) {
@ -898,7 +903,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url)
hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
xhr_open(xml_url, L"GET");
xhr_open(xml_url, L"GET", TRUE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
hres = IHTMLXMLHttpRequest_abort(xhr);
@ -922,7 +927,7 @@ static void test_async_xhr_abort(IHTMLDocument2 *doc, const WCHAR *xml_url)
hres = IHTMLXMLHttpRequest_put_onreadystatechange(xhr, var);
SET_EXPECT(xmlhttprequest_onreadystatechange_opened);
xhr_open(xml_url, L"GET");
xhr_open(xml_url, L"GET", FALSE);
CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
loading_cnt = 0;
@ -969,7 +974,7 @@ static void test_xhr_post(IHTMLDocument2 *doc)
ok(hres == S_OK, "put_onreadystatechange failed: %08lx\n", hres);
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);
set_request_header(xhr, L"Content-Type", L"application/x-www-form-urlencoded");

View File

@ -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));
if(V_VT(&varAsync) != VT_BOOL) {
FIXME("varAsync not supported: %s\n", debugstr_variant(&varAsync));
return E_FAIL;
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
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),