From 2c6c00a84fc96a70ce838a448ea38d88a8b6538e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 30 Nov 2009 17:58:37 +0100 Subject: [PATCH] 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 f8a6938640..cdbddb8eac 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 727eaef15f..c6d398ed05 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); -- 2.32.0.93.g670b81a890