Jacek Caban : mshtml: Properly handle IHlinkFrame::Navigate result.

Alexandre Julliard julliard at winehq.org
Wed Mar 3 11:15:48 CST 2010


Module: wine
Branch: master
Commit: 34944c89dd8060e4f4717246f5cbf3e3338533e5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=34944c89dd8060e4f4717246f5cbf3e3338533e5

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar  3 14:54:44 2010 +0100

mshtml: Properly handle IHlinkFrame::Navigate result.

---

 dlls/mshtml/mshtml_private.h |    2 +-
 dlls/mshtml/navigate.c       |   24 +++++++++++++++++-------
 dlls/mshtml/nsio.c           |    5 +++--
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index bf6561c..95ae5ae 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -709,7 +709,7 @@ HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
 
-HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
+HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
 
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 941dc23..16d38a1 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -1253,7 +1253,7 @@ void channelbsc_set_channel(nsChannelBSC *This, nsChannel *channel, nsIStreamLis
 }
 
 HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
-        nsIInputStream *post_data_stream, DWORD hlnf)
+        nsIInputStream *post_data_stream, DWORD hlnf, BOOL *cancel)
 {
     IHlinkFrame *hlink_frame;
     nsChannelBSC *callback;
@@ -1263,16 +1263,18 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
     IHlink *hlink;
     HRESULT hres;
 
+    *cancel = FALSE;
+
     hres = IOleClientSite_QueryInterface(doc->doc_obj->client, &IID_IServiceProvider,
             (void**)&sp);
     if(FAILED(hres))
-        return hres;
+        return S_OK;
 
     hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame,
             (void**)&hlink_frame);
     IServiceProvider_Release(sp);
     if(FAILED(hres))
-        return hres;
+        return S_OK;
 
     hres = create_channelbsc(NULL, NULL, NULL, 0, &callback);
     if(FAILED(hres)) {
@@ -1304,8 +1306,9 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
         }
 
         hres = IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx, STATUSCLB(&callback->bsc), hlink);
-
         IMoniker_Release(mon);
+        *cancel = hres == S_OK;
+        hres = S_OK;
     }
 
     IHlinkFrame_Release(hlink_frame);
@@ -1339,16 +1342,23 @@ HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base
         hres = IDocHostUIHandler_TranslateUrl(window->doc_obj->hostui, 0, url,
                 &translated_url);
         if(hres == S_OK) {
+            TRACE("%08x %s -> %s\n", hres, debugstr_w(url), debugstr_w(translated_url));
             strcpyW(url, translated_url);
             CoTaskMemFree(translated_url);
         }
     }
 
     if(window->doc_obj && window == window->doc_obj->basedoc.window) {
-        hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0);
-        if(SUCCEEDED(hres))
+        BOOL cancel;
+
+        hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0, &cancel);
+        if(FAILED(hres))
+            return hres;
+
+        if(cancel) {
+            TRACE("Navigation handled by hlink frame\n");
             return S_OK;
-        TRACE("hlink_frame_navigate failed: %08x\n", hres);
+        }
     }
 
     hres = create_doc_uri(window, url, &uri);
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index b95b9c1..f4e6f4b 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -131,6 +131,7 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
 {
     HTMLDocumentObj *doc = container->doc;
     DWORD hlnf = 0;
+    BOOL cancel;
     HRESULT hres;
 
     if(!doc) {
@@ -148,8 +149,8 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
     if(!hlnf && !exec_shldocvw_67(doc, channel->uri->wine_url))
         return FALSE;
 
-    hres = hlink_frame_navigate(&doc->basedoc, channel->uri->wine_url, channel->post_data_stream, hlnf);
-    return hres != S_OK;
+    hres = hlink_frame_navigate(&doc->basedoc, channel->uri->wine_url, channel->post_data_stream, hlnf, &cancel);
+    return FAILED(hres) || cancel;
 }
 
 HRESULT load_nsuri(HTMLWindow *window, nsWineURI *uri, nsChannelBSC *channelbsc, DWORD flags)




More information about the wine-cvs mailing list