From 99c34aa9d9bac71a2054fbae467d498d343e50b4 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 8 Nov 2012 18:17:12 +0100 Subject: [PATCH] mshtml: Use fregment-less URI in super_navigate. --- dlls/mshtml/mshtml_private.h | 1 - dlls/mshtml/navigate.c | 22 +++++++++++++++++----- dlls/mshtml/nsio.c | 2 +- dlls/mshtml/tests/htmldoc.c | 6 ++---- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 97cd165b81a..f24354ddd63 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -780,7 +780,6 @@ BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN; void init_node_cc(void); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN; -BOOL compare_ignoring_frag(IUri*,IUri*) DECLSPEC_HIDDEN; HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*) DECLSPEC_HIDDEN; HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index e2eecefd310..18961f6a4af 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -2047,10 +2047,15 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, const WCHAR *headers, BYTE *post_data, DWORD post_data_size) { nsChannelBSC *bsc; + IUri *uri_nofrag; IMoniker *mon; DWORD scheme; HRESULT hres; + uri_nofrag = get_uri_nofrag(uri); + if(!uri_nofrag) + return E_FAIL; + if(window->doc_obj->client) { IOleCommandTarget *cmdtrg; @@ -2059,7 +2064,7 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, const WCHAR *headers, VARIANT in, out; BSTR url_str; - hres = IUri_GetDisplayUri(uri, &url_str); + hres = IUri_GetDisplayUri(uri_nofrag, &url_str); if(SUCCEEDED(hres)) { V_VT(&in) = VT_BSTR; V_BSTR(&in) = url_str; @@ -2074,12 +2079,19 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, const WCHAR *headers, } } - if(window->uri && !post_data_size && compare_ignoring_frag(window->uri, uri)) { - TRACE("fragment navigate\n"); - return navigate_fragment(window, uri); + if(window->uri_nofrag && !post_data_size) { + BOOL eq; + + hres = IUri_IsEqual(uri_nofrag, window->uri_nofrag, &eq); + if(SUCCEEDED(hres) && eq) { + IUri_Release(uri_nofrag); + TRACE("fragment navigate\n"); + return navigate_fragment(window, uri); + } } - hres = CreateURLMonikerEx2(NULL, uri, &mon, URL_MK_UNIFORM); + hres = CreateURLMonikerEx2(NULL, uri_nofrag, &mon, URL_MK_UNIFORM); + IUri_Release(uri_nofrag); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 204879f4afb..5ce664897cc 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -121,7 +121,7 @@ IUri *get_uri_nofrag(IUri *uri) return ret; } -BOOL compare_ignoring_frag(IUri *uri1, IUri *uri2) +static BOOL compare_ignoring_frag(IUri *uri1, IUri *uri2) { IUri *uri_nofrag1, *uri_nofrag2; BOOL ret = FALSE; diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 849b5177fb5..0e8e0bba51a 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -2835,10 +2835,8 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID CHECK_EXPECT(Exec_ShellDocView_67); ok(pvaIn != NULL, "pvaIn == NULL\n"); ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn)); - if(!loading_hash) - ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url); - else - todo_wine ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url); + ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", + wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url); ok(pvaOut != NULL, "pvaOut == NULL\n"); ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut)); ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));