From 4aa48041fafaff23751be52edfd0f212ddd18ddb Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 11 Oct 2009 21:11:03 +0200 Subject: [PATCH] mshtml: Moved QueryService call to hlink_frame_navigate. --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/navigate.c | 43 ++++++++++++++++++++++-------------- dlls/mshtml/nsio.c | 20 ++--------------- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2f9e1e53560..4a10fea505d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -607,7 +607,7 @@ BOOL install_wine_gecko(BOOL); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); -void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD); +HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD); void call_property_onchanged(ConnectionPoint*,DISPID); HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 267168f9d51..7c7376d2114 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1160,14 +1160,27 @@ void channelbsc_set_channel(nsChannelBSC *This, nsChannel *channel, nsIStreamLis } } -void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, - LPCWSTR uri, nsIInputStream *post_data_stream, DWORD hlnf) +HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, + nsIInputStream *post_data_stream, DWORD hlnf) { + IHlinkFrame *hlink_frame; + IServiceProvider *sp; BSCallback *callback; IBindCtx *bindctx; IMoniker *mon; IHlink *hlink; - HRESULT hr; + HRESULT hres; + + hres = IOleClientSite_QueryInterface(doc->doc_obj->client, &IID_IServiceProvider, + (void**)&sp); + if(FAILED(hres)) + return hres; + + hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, + (void**)&hlink_frame); + IServiceProvider_Release(sp); + if(FAILED(hres)) + return hres; callback = &create_channelbsc(NULL)->bsc; @@ -1178,21 +1191,15 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, debugstr_an(callback->post_data, callback->post_data_len)); } - hr = CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &bindctx); - if (FAILED(hr)) { - IBindStatusCallback_Release(STATUSCLB(callback)); - return; - } + hres = CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &bindctx); + if(SUCCEEDED(hres)) + hres = CoCreateInstance(&CLSID_StdHlink, NULL, CLSCTX_INPROC_SERVER, + &IID_IHlink, (LPVOID*)&hlink); - hr = CoCreateInstance(&CLSID_StdHlink, NULL, CLSCTX_INPROC_SERVER, &IID_IHlink, (LPVOID*)&hlink); - if (FAILED(hr)) { - IBindCtx_Release(bindctx); - IBindStatusCallback_Release(STATUSCLB(callback)); - return; - } + if(SUCCEEDED(hres)) + hres = CreateURLMoniker(NULL, url, &mon); - hr = CreateURLMoniker(NULL, uri, &mon); - if (SUCCEEDED(hr)) { + if(SUCCEEDED(hres)) { IHlink_SetMonikerReference(hlink, 0, mon, NULL); if(hlnf & HLNF_OPENINNEWWINDOW) { @@ -1200,11 +1207,13 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, IHlink_SetTargetFrameName(hlink, wszBlank); /* FIXME */ } - IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx, STATUSCLB(callback), hlink); + hres = IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx, STATUSCLB(callback), hlink); IMoniker_Release(mon); } + IHlinkFrame_Release(hlink_frame); IBindCtx_Release(bindctx); IBindStatusCallback_Release(STATUSCLB(callback)); + return hres; } diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 8ed01081baf..f10db4884dc 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -128,7 +128,6 @@ static BOOL exec_shldocvw_67(HTMLDocumentObj *doc, LPCWSTR url) static BOOL before_async_open(nsChannel *channel, NSContainer *container) { HTMLDocumentObj *doc = container->doc; - IServiceProvider *service_provider; DWORD hlnf = 0; LPCWSTR uri; HRESULT hres; @@ -154,23 +153,8 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container) if(!hlnf && !exec_shldocvw_67(doc, uri)) return FALSE; - hres = IOleClientSite_QueryInterface(doc->client, &IID_IServiceProvider, - (void**)&service_provider); - if(SUCCEEDED(hres)) { - IHlinkFrame *hlink_frame; - - hres = IServiceProvider_QueryService(service_provider, &IID_IHlinkFrame, - &IID_IHlinkFrame, (void**)&hlink_frame); - IServiceProvider_Release(service_provider); - if(SUCCEEDED(hres)) { - hlink_frame_navigate(&doc->basedoc, hlink_frame, uri, channel->post_data_stream, hlnf); - IHlinkFrame_Release(hlink_frame); - - return FALSE; - } - } - - return TRUE; + hres = hlink_frame_navigate(&doc->basedoc, uri, channel->post_data_stream, hlnf); + return hres != S_OK; } #define NSCHANNEL_THIS(iface) DEFINE_THIS(nsChannel, HttpChannel, iface)