Based on patch from Andrey Turkin
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=12457 Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/ieframe/tests/webbrowser.c | 26 ++++++++++++++++++++++---- dlls/ieframe/webbrowser.c | 20 ++++++++++++++++++-- 2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c index 706d5071a9cf..a7d752f34c21 100644 --- a/dlls/ieframe/tests/webbrowser.c +++ b/dlls/ieframe/tests/webbrowser.c @@ -166,7 +166,7 @@ static HWND container_hwnd, shell_embedding_hwnd; static BOOL is_downloading, do_download, is_first_load, use_container_olecmd, test_close, is_http, use_container_dochostui; static HRESULT hr_dochost_TranslateAccelerator = E_NOTIMPL; static HRESULT hr_site_TranslateAccelerator = E_NOTIMPL; -static const char *current_url; +static const char *current_url, *current_title; static int wb_version, expect_update_commands_enable, set_update_commands_enable; static BOOL nav_back_todo, nav_forward_todo; /* FIXME */
@@ -267,6 +267,22 @@ static void _test_LocationURL(unsigned line, IWebBrowser2 *wb, const char *exurl } }
+#define test_LocationName(a,b) _test_LocationName(__LINE__,a,b) +static void _test_LocationName(unsigned line, IWebBrowser2 *unk, const char *exname) +{ + BSTR name = (void*)0xdeadbeef; + static const char wine_title[] = "WineHQ - Run Windows applications on Linux, BSD, Solaris and Mac OS X"; + HRESULT hres; + + hres = IWebBrowser2_get_LocationName(wb, &name); + ok_(__FILE__,line) (hres == (*exname ? S_OK : S_FALSE), "get_LocationName failed: %08x\n", hres); + if (SUCCEEDED(hres)) + { + ok_(__FILE__,line) (!strcmp_wa(name, exname) || !strcmp_wa(name,wine_title), "unexpected name: %s\n", wine_dbgstr_w(name)); + SysFreeString(name); + } +} + #define test_ready_state(ex) _test_ready_state(__LINE__,ex) static void _test_ready_state(unsigned line, READYSTATE exstate) { @@ -2744,14 +2760,15 @@ static void test_Navigate2(IWebBrowser2 *webbrowser, const char *nav_url) HRESULT hres;
test_LocationURL(webbrowser, is_first_load ? "" : current_url); + test_LocationName(webbrowser, is_first_load ? "" : current_title); test_ready_state(is_first_load ? READYSTATE_UNINITIALIZED : READYSTATE_COMPLETE);
is_http = !memcmp(nav_url, "http:", 5); V_VT(&url) = VT_BSTR; - V_BSTR(&url) = a2bstr(current_url = nav_url); + V_BSTR(&url) = a2bstr(current_title = current_url = nav_url);
if((is_file = !strncasecmp(nav_url, "file://", 7))) - current_url = nav_url + 7; + current_title = current_url = nav_url + 7;
if(is_first_load) { SET_EXPECT(Invoke_AMBIENT_USERMODE); @@ -3182,7 +3199,7 @@ static void test_put_href(IWebBrowser2 *unk, const char *url)
dwl_flags = DWL_FROM_PUT_HREF;
- str = a2bstr(current_url = url); + str = a2bstr(current_title = current_url = url); is_first_load = FALSE; hres = IHTMLLocation_put_href(location, str);
@@ -3728,6 +3745,7 @@ static void test_WebBrowser(DWORD flags, BOOL do_close) test_ClassInfo(webbrowser); test_EnumVerbs(webbrowser); test_LocationURL(webbrowser, ""); + test_LocationName(webbrowser, ""); test_ConnectionPoint(webbrowser, TRUE); test_ClientSite(webbrowser, &ClientSite, !do_download); test_Extent(webbrowser); diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c index 03acf3886989..9e34cab51bdb 100644 --- a/dlls/ieframe/webbrowser.c +++ b/dlls/ieframe/webbrowser.c @@ -503,8 +503,24 @@ 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; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, LocationName); + + hres = get_location_url(&This->doc_host, LocationName); + if (This->doc_host.document) + { + IHTMLDocument2 *doc = NULL; + hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IHTMLDocument2, (void **)&doc); + if (SUCCEEDED(hres)) + { + IHTMLDocument2_get_title(doc, LocationName); + if (SysStringLen(*LocationName) == 0) + hres = get_location_url(&This->doc_host, LocationName); + IHTMLDocument2_Release(doc); + } + } + return hres; }
static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48475
Your paranoid android.
=== debian9 (32 bit Chinese:China report) ===
ieframe: ie: Timeout
Hi Vijay,
On 3/1/19 2:58 AM, Vijay Kiran Kamuju wrote:
+#define test_LocationName(a,b) _test_LocationName(__LINE__,a,b) +static void _test_LocationName(unsigned line, IWebBrowser2 *unk, const char *exname) +{
- BSTR name = (void*)0xdeadbeef;
- static const char wine_title[] = "WineHQ - Run Windows applications on Linux, BSD, Solaris and Mac OS X";
- HRESULT hres;
- hres = IWebBrowser2_get_LocationName(wb, &name);
- ok_(__FILE__,line) (hres == (*exname ? S_OK : S_FALSE), "get_LocationName failed: %08x\n", hres);
- if (SUCCEEDED(hres))
- {
ok_(__FILE__,line) (!strcmp_wa(name, exname) || !strcmp_wa(name,wine_title), "unexpected name: %s\n", wine_dbgstr_w(name));
This || here makes the test pass even if you'd always simply return URL. See the attached patch for how it could be improved.
diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c index 03acf3886989..9e34cab51bdb 100644 --- a/dlls/ieframe/webbrowser.c +++ b/dlls/ieframe/webbrowser.c @@ -503,8 +503,24 @@ 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;
- HRESULT hres;
- TRACE("(%p)->(%p)\n", This, LocationName);
- hres = get_location_url(&This->doc_host, LocationName);
- if (This->doc_host.document)
- {
IHTMLDocument2 *doc = NULL;
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IHTMLDocument2, (void **)&doc);
if (SUCCEEDED(hres))
{
IHTMLDocument2_get_title(doc, LocationName);
if (SysStringLen(*LocationName) == 0)
You leak LocationName in this case (even an empty string is allocated).
hres = get_location_url(&This->doc_host, LocationName);
What happens if have a document that doesn't implement IHTMLDocument2? I guess it should just return URL here, but it will fail with your patch.
Thanks,
Jacek
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48667
Your paranoid android.
=== build (build log) ===
error: corrupt patch at line 145 Task: Patch failed to apply
=== debian9 (build log) ===
error: corrupt patch at line 145 Task: Patch failed to apply
=== debian9 (build log) ===
error: corrupt patch at line 145 Task: Patch failed to apply