mshtml: Added IHTMLDocument2::put_domain implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-06-21 15:12:25 +02:00 committed by Alexandre Julliard
parent faf7a2701d
commit 22eab07811
2 changed files with 63 additions and 8 deletions

View File

@ -795,24 +795,46 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLDocument_SetDomain(This->doc_node->nsdoc, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("SetDomain failed: %08x\n", nsres);
return E_INVALIDARG;
}
return S_OK;
}
static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
HRESULT hres;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
if(!This->window || !This->window->uri) {
FIXME("No current URI\n");
return E_FAIL;
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLDocument_GetDomain(This->doc_node->nsdoc, &nsstr);
if(NS_SUCCEEDED(nsres) && This->window && This->window->uri) {
const PRUnichar *str;
HRESULT hres;
nsAString_GetData(&nsstr, &str);
if(!*str) {
TRACE("Gecko returned emptry string, fallback to loaded URL.\n");
nsAString_Finish(&nsstr);
hres = IUri_GetHost(This->window->uri, p);
return FAILED(hres) ? hres : S_OK;
}
}
hres = IUri_GetHost(This->window->uri, p);
return FAILED(hres) ? hres : S_OK;
return return_nsstr(nsres, &nsstr, p);
}
static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)

View File

@ -971,6 +971,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
case 1014:
CHECK_EXPECT2(OnChanged_1014);
return S_OK;
case 1029:
case 1030:
case 3000022:
case 3000023:
@ -7681,6 +7682,37 @@ static void test_cookies(IHTMLDocument2 *doc)
SysFreeString(str2);
}
static void test_doc_domain(IHTMLDocument2 *doc)
{
BSTR str;
HRESULT hres;
hres = IHTMLDocument2_get_domain(doc, &str);
ok(hres == S_OK, "get_domain failed: %08x\n", hres);
ok(!strcmp_wa(str, "test.winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
SysFreeString(str);
str = a2bstr("winehq.org");
hres = IHTMLDocument2_put_domain(doc, str);
ok(hres == S_OK, "put_domain failed: %08x\n", hres);
SysFreeString(str);
hres = IHTMLDocument2_get_domain(doc, &str);
ok(hres == S_OK, "get_domain failed: %08x\n", hres);
ok(!strcmp_wa(str, "winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
SysFreeString(str);
str = a2bstr("winehq.com");
hres = IHTMLDocument2_put_domain(doc, str);
ok(hres == E_INVALIDARG, "put_domain failed: %08x, expected E_INVALIDARG\n", hres);
SysFreeString(str);
hres = IHTMLDocument2_get_domain(doc, &str);
ok(hres == S_OK, "get_domain failed: %08x\n", hres);
ok(!strcmp_wa(str, "winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
SysFreeString(str);
}
static void test_HTMLDocument_http(BOOL with_wbapp)
{
IMoniker *http_mon;
@ -7718,6 +7750,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp)
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL, FALSE);
test_travellog(doc);
test_binding_ui((IUnknown*)doc);
test_doc_domain(doc);
nav_url = nav_serv_url = "http://test.winehq.org/tests/winehq_snapshot/"; /* for valid prev nav_url */
if(support_wbapp) {