diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h index 4d19c46d13a..f0e1cd5ccfb 100644 --- a/dlls/mshtml/binding.h +++ b/dlls/mshtml/binding.h @@ -116,4 +116,6 @@ void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISuppo IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN; HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN; +IUri *get_uri_nofrag(IUri*) DECLSPEC_HIDDEN; + HRESULT bind_mon_to_wstr(HTMLInnerWindow*,IMoniker*,WCHAR**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 28b3b7f94da..0c3d7df577f 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -857,13 +857,14 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLOuterWindow *window = This->outer_window; INewWindowManager *new_window_mgr; + BSTR uri_str; IUri *uri; HRESULT hres; TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name), debugstr_w(features), replace, pomWindowResult); - if(!window->doc_obj) + if(!window->doc_obj || !window->uri_nofrag) return E_UNEXPECTED; if(name && *name == '_') { @@ -878,10 +879,14 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, return E_NOTIMPL; } - hres = INewWindowManager_EvaluateNewWindow(new_window_mgr, url, name, window->url, - features, !!replace, window->doc_obj->has_popup ? 0 : NWMF_FIRST, 0); + hres = IUri_GetDisplayUri(window->uri_nofrag, &uri_str); + if(SUCCEEDED(hres)) { + hres = INewWindowManager_EvaluateNewWindow(new_window_mgr, url, name, uri_str, + features, !!replace, window->doc_obj->has_popup ? 0 : NWMF_FIRST, 0); + window->doc_obj->has_popup = TRUE; + SysFreeString(uri_str); + } INewWindowManager_Release(new_window_mgr); - window->doc_obj->has_popup = TRUE; if(FAILED(hres)) { *pomWindowResult = NULL; return S_OK; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index f94f226ef87..97cd165b81a 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -372,6 +372,7 @@ struct HTMLOuterWindow { HTMLInnerWindow *pending_window; IMoniker *mon; IUri *uri; + IUri *uri_nofrag; BSTR url; SCRIPTMODE scriptmode; diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 7fc2a3a4451..204879f4afb 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -94,7 +94,7 @@ IUri *nsuri_get_uri(nsWineURI *nsuri) return nsuri->uri; } -static IUri *get_uri_nofrag(IUri *uri) +IUri *get_uri_nofrag(IUri *uri) { IUriBuilder *uri_builder; IUri *ret; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index e29bb252d1b..0c279c0da3b 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -106,6 +106,11 @@ void set_current_uri(HTMLOuterWindow *window, IUri *uri) window->uri = NULL; } + if(window->uri_nofrag) { + IUri_Release(window->uri_nofrag); + window->uri_nofrag = NULL; + } + SysFreeString(window->url); window->url = NULL; @@ -115,6 +120,13 @@ void set_current_uri(HTMLOuterWindow *window, IUri *uri) IUri_AddRef(uri); window->uri = uri; + window->uri_nofrag = get_uri_nofrag(uri); + if(!window->uri_nofrag) { + FIXME("get_uri_nofrag failed\n"); + IUri_AddRef(uri); + window->uri_nofrag = uri; + } + IUri_GetDisplayUri(uri, &window->url); }