Andrey Turkin : ieframe: Implement IWebBrowser2::get_LocationName().
Alexandre Julliard
julliard at winehq.org
Tue Oct 26 09:40:27 CDT 2021
Module: wine
Branch: stable
Commit: 1edb71ad07afb7cbac6a74b2a96e7e8f0d6fac87
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1edb71ad07afb7cbac6a74b2a96e7e8f0d6fac87
Author: Andrey Turkin <andrey.turkin at gmail.com>
Date: Thu Apr 22 18:48:17 2021 +0200
ieframe: Implement IWebBrowser2::get_LocationName().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=12457
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 92713253ab4662127c5c1e2b7f35b358585cc215)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/ieframe/tests/webbrowser.c | 15 +++++++++++++++
dlls/ieframe/webbrowser.c | 21 +++++++++++++++++++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c
index 52d1f707357..d1206b02c0f 100644
--- a/dlls/ieframe/tests/webbrowser.c
+++ b/dlls/ieframe/tests/webbrowser.c
@@ -254,6 +254,19 @@ static void _test_LocationURL(unsigned line, IWebBrowser2 *wb, const WCHAR *exur
}
}
+#define test_LocationName(a,b) _test_LocationName(__LINE__,a,b)
+static void _test_LocationName(unsigned line, IWebBrowser2 *wb, const WCHAR *exname)
+{
+ BSTR name = (void*)0xdeadbeef;
+ HRESULT hres;
+
+ hres = IWebBrowser2_get_LocationName(wb, &name);
+ ok_(__FILE__,line) (hres == (*exname ? S_OK : S_FALSE), "get_LocationName failed: %08x\n", hres);
+ ok_(__FILE__,line) (!lstrcmpW(name, exname) || broken(is_http && !lstrcmpW(name, current_url)) /* Win10 2004 */,
+ "expected %s, got %s\n", wine_dbgstr_w(exname), wine_dbgstr_w(name));
+ SysFreeString(name);
+}
+
#define test_ready_state(a,b) _test_ready_state(__LINE__,a,b)
static void _test_ready_state(unsigned line, READYSTATE exstate, VARIANT_BOOL expect_busy)
{
@@ -2785,11 +2798,13 @@ static void test_ConnectionPoint(IWebBrowser2 *unk, BOOL init)
static void test_Navigate2(IWebBrowser2 *webbrowser, const WCHAR *nav_url)
{
+ const WCHAR *title = L"WineHQ - Run Windows applications on Linux, BSD, Solaris and Mac OS X";
VARIANT url;
BOOL is_file;
HRESULT hres;
test_LocationURL(webbrowser, is_first_load ? L"" : current_url);
+ test_LocationName(webbrowser, is_first_load ? L"" : (is_http ? title : current_url));
test_ready_state(is_first_load ? READYSTATE_UNINITIALIZED : READYSTATE_COMPLETE, VARIANT_FALSE);
is_http = !memcmp(nav_url, "http:", 5);
diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c
index 87b74b8e01f..26ce666b4ba 100644
--- a/dlls/ieframe/webbrowser.c
+++ b/dlls/ieframe/webbrowser.c
@@ -539,8 +539,25 @@ static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
- FIXME("(%p)->(%p)\n", This, LocationName);
- return E_NOTIMPL;
+ IHTMLDocument2 *doc;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, LocationName);
+
+ if(This->doc_host.document &&
+ SUCCEEDED(IUnknown_QueryInterface(This->doc_host.document, &IID_IHTMLDocument2, (void **)&doc))) {
+ hres = IHTMLDocument2_get_title(doc, LocationName);
+ if(hres == S_OK && !SysStringLen(*LocationName)) {
+ SysFreeString(*LocationName);
+ hres = get_location_url(&This->doc_host, LocationName);
+ }
+ IHTMLDocument2_Release(doc);
+ } else {
+ *LocationName = SysAllocString(L"");
+ hres = S_FALSE;
+ }
+
+ return hres;
}
static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
More information about the wine-cvs
mailing list