Commit c4bc5be2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IOmNavigator::get_userAgent implementation.

parent 4eead9d0
......@@ -179,8 +179,24 @@ static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
{
OmNavigator *This = OMNAVIGATOR_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
char user_agent[512];
DWORD size;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
size = sizeof(user_agent);
hres = ObtainUserAgentString(0, user_agent, &size);
if(FAILED(hres))
return hres;
size = MultiByteToWideChar(CP_ACP, 0, user_agent, -1, NULL, 0);
*p = SysAllocStringLen(NULL, size-1);
if(!*p)
return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, user_agent, -1, *p, size);
return S_OK;
}
static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
......
......@@ -2444,6 +2444,8 @@ static void test_navigator(IHTMLDocument2 *doc)
{
IHTMLWindow2 *window;
IOmNavigator *navigator, *navigator2;
char buf[512];
DWORD size;
ULONG ref;
BSTR bstr;
HRESULT hres;
......@@ -2501,6 +2503,16 @@ static void test_navigator(IHTMLDocument2 *doc)
ok(!strcmp_wa(bstr, "[object]"), "toString returned %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
size = sizeof(buf);
hres = ObtainUserAgentString(0, buf, &size);
ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
bstr = NULL;
hres = IOmNavigator_get_userAgent(navigator, &bstr);
ok(hres == S_OK, "get_userAgent failed: %08x\n", hres);
ok(!strcmp_wa(bstr, buf), "userAgent returned %s, expected \"%s\"\n", wine_dbgstr_w(bstr), buf);
SysFreeString(bstr);
ref = IOmNavigator_Release(navigator);
ok(!ref, "navigator should be destroyed here\n");
}
......
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