From 12b85befc0bc211d1af51b54eea6c13d24ec6171 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 11 Mar 2011 11:14:08 +0100 Subject: [PATCH] mshtml: Added IHTMLPrivateWindow_GetAddressBarUrl implementation. --- dlls/mshtml/htmlwindow.c | 9 +++++++-- dlls/mshtml/tests/htmldoc.c | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 99d03b3360d..0e420212c31 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -1777,8 +1777,13 @@ static HRESULT WINAPI HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow *ifa static HRESULT WINAPI HTMLPrivateWindow_GetAddressBar(IHTMLPrivateWindow *iface, BSTR *url) { HTMLWindow *This = impl_from_IHTMLPrivateWindow(iface); - FIXME("(%p)->(%p)\n", This, url); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, url); + + if(!url) + return E_INVALIDARG; + + *url = SysAllocString(This->url); + return S_OK; } static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl = { diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index ab5e17b383c..11b2036440f 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -3533,7 +3533,6 @@ static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace) str2 = a2bstr(""); V_VT(&vempty) = VT_EMPTY; hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0); - SysFreeString(str); SysFreeString(str2); ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres); @@ -3548,9 +3547,20 @@ static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace) test_GetCurMoniker(doc_unk, doc_mon, NULL); doc_mon = NULL; } - IHTMLPrivateWindow_Release(priv_window); + hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2); + ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres); + ok(!strcmp_wa(str2, use_replace?"about:blank":"http://www.winehq.org/"), + "unexpected address bar url: %s\n", wine_dbgstr_w(str2)); + SysFreeString(str2); test_download(DWL_VERBDONE); + + hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2); + ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres); + ok(!lstrcmpW(str2, str), "unexpected address bar url: %s\n", wine_dbgstr_w(str2)); + SysFreeString(str2); + SysFreeString(str); + IHTMLPrivateWindow_Release(priv_window); } static void test_open_window(IHTMLDocument2 *doc)