Commit 22eab078 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLDocument2::put_domain implementation.

parent faf7a270
...@@ -795,24 +795,46 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p) ...@@ -795,24 +795,46 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v) static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
{ {
HTMLDocument *This = impl_from_IHTMLDocument2(iface); HTMLDocument *This = impl_from_IHTMLDocument2(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v)); nsAString nsstr;
return E_NOTIMPL; 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) static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
{ {
HTMLDocument *This = impl_from_IHTMLDocument2(iface); HTMLDocument *This = impl_from_IHTMLDocument2(iface);
HRESULT hres; nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
if(!This->window || !This->window->uri) { nsAString_Init(&nsstr, NULL);
FIXME("No current URI\n"); nsres = nsIDOMHTMLDocument_GetDomain(This->doc_node->nsdoc, &nsstr);
return E_FAIL; 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 return_nsstr(nsres, &nsstr, p);
return FAILED(hres) ? hres : S_OK;
} }
static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v) static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
......
...@@ -971,6 +971,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D ...@@ -971,6 +971,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
case 1014: case 1014:
CHECK_EXPECT2(OnChanged_1014); CHECK_EXPECT2(OnChanged_1014);
return S_OK; return S_OK;
case 1029:
case 1030: case 1030:
case 3000022: case 3000022:
case 3000023: case 3000023:
...@@ -7681,6 +7682,37 @@ static void test_cookies(IHTMLDocument2 *doc) ...@@ -7681,6 +7682,37 @@ static void test_cookies(IHTMLDocument2 *doc)
SysFreeString(str2); 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) static void test_HTMLDocument_http(BOOL with_wbapp)
{ {
IMoniker *http_mon; IMoniker *http_mon;
...@@ -7718,6 +7750,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp) ...@@ -7718,6 +7750,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp)
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL, FALSE); test_GetCurMoniker((IUnknown*)doc, http_mon, NULL, FALSE);
test_travellog(doc); test_travellog(doc);
test_binding_ui((IUnknown*)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 */ nav_url = nav_serv_url = "http://test.winehq.org/tests/winehq_snapshot/"; /* for valid prev nav_url */
if(support_wbapp) { if(support_wbapp) {
......
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