Jacek Caban : mshtml: Properly report history update for location. replace call.

Alexandre Julliard julliard at winehq.org
Mon Nov 12 14:14:40 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 12 12:57:48 2012 +0100

mshtml: Properly report history update for location.replace call.

---

 dlls/mshtml/binding.h        |    4 ++++
 dlls/mshtml/htmlanchor.c     |    2 +-
 dlls/mshtml/htmldoc.c        |    3 ++-
 dlls/mshtml/htmlframebase.c  |    3 ++-
 dlls/mshtml/htmllocation.c   |    6 ++++--
 dlls/mshtml/htmlwindow.c     |    2 +-
 dlls/mshtml/mshtml_private.h |    3 ---
 dlls/mshtml/navigate.c       |   10 ++++++----
 dlls/mshtml/nsio.c           |    2 +-
 dlls/mshtml/persist.c        |    6 +++---
 10 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h
index 1eee469..7934c90 100644
--- a/dlls/mshtml/binding.h
+++ b/dlls/mshtml/binding.h
@@ -114,6 +114,7 @@ void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
 HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN;
 HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN;
 HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,IHTMLWindow2**) DECLSPEC_HIDDEN;
+HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD) DECLSPEC_HIDDEN;
 
 HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**) DECLSPEC_HIDDEN;
 HRESULT channelbsc_load_stream(HTMLInnerWindow*,IStream*) DECLSPEC_HIDDEN;
@@ -123,4 +124,7 @@ HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDE
 
 IUri *get_uri_nofrag(IUri*) DECLSPEC_HIDDEN;
 
+void set_current_mon(HTMLOuterWindow*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
+void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN;
+
 HRESULT bind_mon_to_wstr(HTMLInnerWindow*,IMoniker*,WCHAR**) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index b0ec97e..a7b87a8 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -121,7 +121,7 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
         if(*href) {
             if(!window)
                 window = This->element.node.doc->basedoc.window;
-            hres = navigate_url(window, href, window->uri);
+            hres = navigate_url(window, href, window->uri, BINDING_NAVIGATED);
         }else {
             TRACE("empty href\n");
             hres = S_OK;
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 0a41522..5fc9560 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -37,6 +37,7 @@
 #include "mshtml_private.h"
 #include "htmlevent.h"
 #include "pluginhost.h"
+#include "binding.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -609,7 +610,7 @@ static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
         return E_FAIL;
     }
 
-    return navigate_url(This->window, v, This->window->uri);
+    return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED);
 }
 
 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index a11adca..e05e219 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -27,6 +27,7 @@
 #include "ole2.h"
 
 #include "mshtml_private.h"
+#include "binding.h"
 
 #include "wine/debug.h"
 
@@ -136,7 +137,7 @@ static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
         return E_FAIL;
     }
 
-    return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri);
+    return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri, BINDING_NAVIGATED);
 }
 
 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 3a978b5..9e4d6d2 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -31,6 +31,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "binding.h"
 #include "resource.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@@ -170,7 +171,7 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
         return E_FAIL;
     }
 
-    return navigate_url(This->window->base.outer_window, v, This->window->base.outer_window->uri);
+    return navigate_url(This->window->base.outer_window, v, This->window->base.outer_window->uri, BINDING_NAVIGATED);
 }
 
 static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
@@ -570,7 +571,8 @@ static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
         return E_FAIL;
     }
 
-    return navigate_url(This->window->base.outer_window, bstr, This->window->base.outer_window->uri);
+    return navigate_url(This->window->base.outer_window, bstr, This->window->base.outer_window->uri,
+            BINDING_NAVIGATED|BINDING_REPLACE);
 }
 
 static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 1696ed5..0318002 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -206,7 +206,7 @@ static void release_outer_window(HTMLOuterWindow *This)
     }
 
     remove_target_tasks(This->task_magic);
-    set_current_mon(This, NULL);
+    set_current_mon(This, NULL, 0);
     if(This->base.inner_window)
         detach_inner_window(This->base.inner_window);
     release_children(This);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f24354d..74f1b39 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -781,7 +781,6 @@ void init_node_cc(void);
 
 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
 
-HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*) DECLSPEC_HIDDEN;
 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
 
 void call_property_onchanged(ConnectionPoint*,DISPID) DECLSPEC_HIDDEN;
@@ -810,8 +809,6 @@ nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
 
 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
-void set_current_mon(HTMLOuterWindow*,IMoniker*) DECLSPEC_HIDDEN;
-void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN;
 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 33ebbca..9532a82 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -1777,7 +1777,7 @@ static void start_doc_binding_proc(task_t *_task)
 {
     start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
 
-    set_current_mon(task->window, task->pending_window->bscallback->bsc.mon);
+    set_current_mon(task->window, task->pending_window->bscallback->bsc.mon, BINDING_NAVIGATED);
     start_binding(task->pending_window, &task->pending_window->bscallback->bsc, NULL);
 }
 
@@ -1948,6 +1948,7 @@ typedef struct {
     task_t header;
     HTMLOuterWindow *window;
     nsChannelBSC *bscallback;
+    DWORD flags;
     IMoniker *mon;
     IUri *uri;
 } navigate_task_t;
@@ -1959,7 +1960,7 @@ static void navigate_proc(task_t *_task)
 
     hres = set_moniker(&task->window->doc_obj->basedoc, task->mon, NULL, task->bscallback, TRUE);
     if(SUCCEEDED(hres)) {
-        set_current_mon(task->window, task->bscallback->bsc.mon);
+        set_current_mon(task->window, task->bscallback->bsc.mon, task->flags);
         set_current_uri(task->window, task->uri);
         start_binding(task->window->pending_window, &task->bscallback->bsc, NULL);
     }
@@ -2124,6 +2125,7 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, DWORD flags, const WC
 
         task->window = window;
         task->bscallback = bsc;
+        task->flags = flags;
         task->mon = mon;
 
         IUri_AddRef(uri);
@@ -2317,7 +2319,7 @@ HRESULT load_uri(HTMLOuterWindow *window, IUri *uri, DWORD flags)
     return hres;
 }
 
-HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, IUri *base_uri)
+HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, IUri *base_uri, DWORD flags)
 {
     BSTR display_uri;
     IUri *uri;
@@ -2359,7 +2361,7 @@ HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, IUri *base_u
         }
     }
 
-    hres = navigate_uri(window, uri, display_uri, BINDING_NAVIGATED);
+    hres = navigate_uri(window, uri, display_uri, flags);
 
     IUri_Release(uri);
     SysFreeString(display_uri);
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 5ce6648..90543df 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -992,7 +992,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
     }
 
     if(is_doc_channel)
-        set_current_mon(window, mon);
+        set_current_mon(window, mon, BINDING_NAVIGATED);
 
     hres = create_channelbsc(mon, NULL, NULL, 0, is_doc_channel, &bscallback);
     IMoniker_Release(mon);
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index 649c906..457f5dc 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -132,14 +132,14 @@ void set_current_uri(HTMLOuterWindow *window, IUri *uri)
     IUri_GetDisplayUri(uri, &window->url);
 }
 
-void set_current_mon(HTMLOuterWindow *This, IMoniker *mon)
+void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
 {
     IUriContainer *uri_container;
     IUri *uri = NULL;
     HRESULT hres;
 
     if(This->mon) {
-        if(This->doc_obj)
+        if(This->doc_obj && !(flags & BINDING_REPLACE))
             notify_travellog_update(This->doc_obj);
         IMoniker_Release(This->mon);
         This->mon = NULL;
@@ -323,7 +323,7 @@ void prepare_for_binding(HTMLDocument *This, IMoniker *mon, DWORD flags)
         update_doc(This, UPDATE_TITLE|UPDATE_UI);
     }else {
         update_doc(This, UPDATE_TITLE);
-        set_current_mon(This->window, mon);
+        set_current_mon(This->window, mon, flags);
     }
 
     if(This->doc_obj->client) {




More information about the wine-cvs mailing list