mshtml: Moved HTMLLocation reference to inner window.

This commit is contained in:
Jacek Caban 2012-08-14 11:29:17 +02:00 committed by Alexandre Julliard
parent 28f35f86c6
commit 93a2de1fba
3 changed files with 22 additions and 23 deletions

View File

@ -37,20 +37,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HRESULT get_url(HTMLLocation *This, const WCHAR **ret) static HRESULT get_url(HTMLLocation *This, const WCHAR **ret)
{ {
if(!This->window || !This->window->url) { if(!This->window || !This->window->base.outer_window || !This->window->base.outer_window->url) {
FIXME("No current URL\n"); FIXME("No current URL\n");
return E_NOTIMPL; return E_NOTIMPL;
} }
*ret = This->window->url; *ret = This->window->base.outer_window->url;
return S_OK; return S_OK;
} }
static IUri *get_uri(HTMLLocation *This) static IUri *get_uri(HTMLLocation *This)
{ {
if(!This->window) if(!This->window || !This->window->base.outer_window)
return NULL; return NULL;
return This->window->uri; return This->window->base.outer_window->uri;
} }
static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url) static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url)
@ -165,12 +165,12 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v)); TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->window) { if(!This->window || !This->window->base.outer_window) {
FIXME("No window available\n"); FIXME("No window available\n");
return E_FAIL; return E_FAIL;
} }
return navigate_url(This->window, v, This->window->url); return navigate_url(This->window->base.outer_window, v, This->window->base.outer_window->url);
} }
static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
@ -565,12 +565,12 @@ static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
TRACE("(%p)->(%s)\n", This, debugstr_w(bstr)); TRACE("(%p)->(%s)\n", This, debugstr_w(bstr));
if(!This->window) { if(!This->window || !This->window->base.outer_window) {
FIXME("No window available\n"); FIXME("No window available\n");
return E_FAIL; return E_FAIL;
} }
return navigate_url(This->window, bstr, This->window->url); return navigate_url(This->window->base.outer_window, bstr, This->window->base.outer_window->url);
} }
static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr) static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr)
@ -629,7 +629,7 @@ static dispex_static_data_t HTMLLocation_dispex = {
}; };
HRESULT HTMLLocation_Create(HTMLOuterWindow *window, HTMLLocation **ret) HRESULT HTMLLocation_Create(HTMLInnerWindow *window, HTMLLocation **ret)
{ {
HTMLLocation *location; HTMLLocation *location;

View File

@ -61,7 +61,7 @@ static void release_children(HTMLOuterWindow *This)
} }
} }
static HRESULT get_location(HTMLOuterWindow *This, HTMLLocation **ret) static HRESULT get_location(HTMLInnerWindow *This, HTMLLocation **ret)
{ {
if(This->location) { if(This->location) {
IHTMLLocation_AddRef(&This->location->IHTMLLocation_iface); IHTMLLocation_AddRef(&This->location->IHTMLLocation_iface);
@ -214,11 +214,6 @@ static void release_outer_window(HTMLOuterWindow *This)
if(This->frame_element) if(This->frame_element)
This->frame_element->content_window = NULL; This->frame_element->content_window = NULL;
if(This->location) {
This->location->window = NULL;
IHTMLLocation_Release(&This->location->IHTMLLocation_iface);
}
This->window_ref->window = NULL; This->window_ref->window = NULL;
windowref_release(This->window_ref); windowref_release(This->window_ref);
@ -250,6 +245,11 @@ static void release_inner_window(HTMLInnerWindow *This)
heap_free(This->global_props[i].name); heap_free(This->global_props[i].name);
heap_free(This->global_props); heap_free(This->global_props);
if(This->location) {
This->location->window = NULL;
IHTMLLocation_Release(&This->location->IHTMLLocation_iface);
}
if(This->image_factory) { if(This->image_factory) {
This->image_factory->window = NULL; This->image_factory->window = NULL;
IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface); IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface);
@ -707,7 +707,7 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
hres = get_location(This->outer_window, &location); hres = get_location(This->inner_window, &location);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -2335,7 +2335,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{ {
HTMLWindow *This = impl_from_IDispatchEx(iface); HTMLWindow *This = impl_from_IDispatchEx(iface);
HTMLOuterWindow *window = This->outer_window; HTMLInnerWindow *window = This->inner_window;
TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
@ -2355,8 +2355,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
return hres; return hres;
} }
return IDispatchEx_InvokeEx(&window->base.inner_window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, return IDispatchEx_InvokeEx(&window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
pei, pspCaller);
} }
static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)

View File

@ -323,7 +323,7 @@ struct HTMLLocation {
LONG ref; LONG ref;
HTMLOuterWindow *window; HTMLInnerWindow *window;
}; };
typedef struct { typedef struct {
@ -371,8 +371,6 @@ struct HTMLOuterWindow {
IInternetSecurityManager *secmgr; IInternetSecurityManager *secmgr;
HTMLLocation *location;
struct list children; struct list children;
struct list sibling_entry; struct list sibling_entry;
struct list entry; struct list entry;
@ -400,6 +398,8 @@ struct HTMLInnerWindow {
LONG task_magic; LONG task_magic;
HTMLLocation *location;
IMoniker *mon; IMoniker *mon;
nsChannelBSC *bscallback; nsChannelBSC *bscallback;
struct list bindings; struct list bindings;
@ -713,7 +713,7 @@ HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN; HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN; HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN; HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN; IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN; HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
HRESULT create_history(IOmHistory**) DECLSPEC_HIDDEN; HRESULT create_history(IOmHistory**) DECLSPEC_HIDDEN;