Jacek Caban : mshtml: Forward setting window.location to window.location. href.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 09:19:39 CST 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 30 17:58:37 2009 +0100

mshtml: Forward setting window.location to window.location.href.

---

 dlls/mshtml/htmlwindow.c |   55 +++++++++++++++++++++++++++++++++++++--------
 dlls/mshtml/navigate.c   |    5 ++++
 2 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index f8a6938..cdbddb8 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -24,6 +24,7 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "ole2.h"
+#include "mshtmdid.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -100,6 +101,22 @@ static void release_children(HTMLWindow *This)
     }
 }
 
+static HRESULT get_location(HTMLWindow *This, HTMLLocation **ret)
+{
+    if(This->location) {
+        IHTMLLocation_AddRef(HTMLLOCATION(This->location));
+    }else {
+        HRESULT hres;
+
+        hres = HTMLLocation_Create(This, &This->location);
+        if(FAILED(hres))
+            return hres;
+    }
+
+    *ret = This->location;
+    return S_OK;
+}
+
 #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
 
 static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
@@ -183,6 +200,9 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
             IHTMLLocation_Release(HTMLLOCATION(This->location));
         }
 
+        if(This->screen)
+            IHTMLScreen_Release(This->screen);
+
         if(This->event_target)
             release_event_target(This->event_target);
         for(i=0; i < This->global_prop_cnt; i++)
@@ -193,6 +213,10 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
 
         heap_free(This->global_props);
         release_script_hosts(This);
+
+        if(This->nswindow)
+            nsIDOMWindow_Release(This->nswindow);
+
         list_remove(&This->entry);
         release_dispex(&This->dispex);
         heap_free(This);
@@ -590,20 +614,16 @@ static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageEleme
 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
 {
     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
+    HTMLLocation *location;
+    HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, p);
 
-    if(This->location) {
-        IHTMLLocation_AddRef(HTMLLOCATION(This->location));
-    }else {
-        HRESULT hres;
-
-        hres = HTMLLocation_Create(This, &This->location);
-        if(FAILED(hres))
-            return hres;
-    }
+    hres = get_location(This, &location);
+    if(FAILED(hres))
+        return hres;
 
-    *p = HTMLLOCATION(This->location);
+    *p = HTMLLOCATION(location);
     return S_OK;
 }
 
@@ -1757,6 +1777,21 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
 
     TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 
+    if(id == DISPID_IHTMLWINDOW2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT)) {
+        HTMLLocation *location;
+        HRESULT hres;
+
+        TRACE("forwarding to location.href\n");
+
+        hres = get_location(This, &location);
+        if(FAILED(hres))
+            return hres;
+
+        hres = IDispatchEx_InvokeEx(DISPATCHEX(&location->dispex), DISPID_VALUE, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
+        IHTMLLocation_Release(HTMLLOCATION(location));
+        return hres;
+    }
+
     return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 }
 
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 727eaef..c6d398e 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -1246,6 +1246,11 @@ HRESULT navigate_url(HTMLDocumentNode *doc, OLECHAR *url)
             url = translated_url;
     }
 
+    if(doc != doc->basedoc.doc_obj->basedoc.doc_node) {
+        FIXME("navigation in frame\n");
+        return E_NOTIMPL;
+    }
+
     hres = hlink_frame_navigate(&doc->basedoc, url, NULL, 0);
     if(FAILED(hres))
         FIXME("hlink_frame_navigate failed: %08x\n", hres);




More information about the wine-cvs mailing list