diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 13f6bd4fbbb..749df4bbeb1 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -231,7 +231,7 @@ static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name, if(!This->framebase.content_window) return DISP_E_UNKNOWNNAME; - return search_window_props(This->framebase.content_window, name, grfdex, pid); + return search_window_props(This->framebase.content_window->base.inner_window, name, grfdex, pid); } static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index 03ebb473308..3cae2374ff0 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -202,7 +202,7 @@ static HRESULT HTMLIFrame_get_dispid(HTMLDOMNode *iface, BSTR name, if(!This->framebase.content_window) return DISP_E_UNKNOWNNAME; - return search_window_props(This->framebase.content_window, name, grfdex, pid); + return search_window_props(This->framebase.content_window->base.inner_window, name, grfdex, pid); } static HRESULT HTMLIFrame_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 4a696b7eac2..94731ec241c 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -180,8 +180,6 @@ static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) static void release_outer_window(HTMLOuterWindow *This) { - unsigned i; - remove_target_tasks(This->task_magic); set_window_bscallback(This, NULL); set_current_mon(This, NULL); @@ -212,13 +210,9 @@ static void release_outer_window(HTMLOuterWindow *This) if(This->screen) IHTMLScreen_Release(This->screen); - for(i=0; i < This->global_prop_cnt; i++) - heap_free(This->global_props[i].name); - This->window_ref->window = NULL; windowref_release(This->window_ref); - heap_free(This->global_props); release_script_hosts(This); if(This->nswindow) @@ -230,8 +224,15 @@ static void release_outer_window(HTMLOuterWindow *This) static void release_inner_window(HTMLInnerWindow *This) { + unsigned i; + htmldoc_release(&This->doc->basedoc); release_dispex(&This->dispex); + + for(i=0; i < This->global_prop_cnt; i++) + heap_free(This->global_props[i].name); + heap_free(This->global_props); + heap_free(This); } @@ -2186,7 +2187,7 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe pDispParams, pVarResult, pExcepInfo, puArgErr); } -static global_prop_t *alloc_global_prop(HTMLOuterWindow *This, global_prop_type_t type, BSTR name) +static global_prop_t *alloc_global_prop(HTMLInnerWindow *This, global_prop_type_t type, BSTR name) { if(This->global_prop_cnt == This->global_prop_size) { global_prop_t *new_props; @@ -2213,12 +2214,12 @@ static global_prop_t *alloc_global_prop(HTMLOuterWindow *This, global_prop_type_ return This->global_props + This->global_prop_cnt++; } -static inline DWORD prop_to_dispid(HTMLOuterWindow *This, global_prop_t *prop) +static inline DWORD prop_to_dispid(HTMLInnerWindow *This, global_prop_t *prop) { return MSHTML_DISPID_CUSTOM_MIN + (prop-This->global_props); } -HRESULT search_window_props(HTMLOuterWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) +HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) { DWORD i; ScriptHost *script_host; @@ -2232,7 +2233,7 @@ HRESULT search_window_props(HTMLOuterWindow *This, BSTR bstrName, DWORD grfdex, } } - if(find_global_prop(This, bstrName, grfdex, &script_host, &id)) { + if(find_global_prop(This->base.outer_window, bstrName, grfdex, &script_host, &id)) { global_prop_t *prop; prop = alloc_global_prop(This, GLOBAL_SCRIPTVAR, bstrName); @@ -2252,7 +2253,7 @@ HRESULT search_window_props(HTMLOuterWindow *This, BSTR bstrName, DWORD grfdex, static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { HTMLWindow *This = impl_from_IDispatchEx(iface); - HTMLOuterWindow *window = This->outer_window; + HTMLInnerWindow *window = This->inner_window; HRESULT hres; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); @@ -2450,10 +2451,10 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD HRESULT hres; idx = id - MSHTML_DISPID_CUSTOM_MIN; - if(idx >= This->base.outer_window->global_prop_cnt) + if(idx >= This->global_prop_cnt) return DISP_E_MEMBERNOTFOUND; - prop = This->base.outer_window->global_props+idx; + prop = This->global_props+idx; switch(prop->type) { case GLOBAL_SCRIPTVAR: { diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 010542edbea..004a4b476c2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -344,10 +344,6 @@ struct HTMLOuterWindow { IHTMLScreen *screen; IOmHistory *history; - global_prop_t *global_props; - DWORD global_prop_cnt; - DWORD global_prop_size; - struct list children; struct list sibling_entry; struct list entry; @@ -358,6 +354,10 @@ struct HTMLInnerWindow { DispatchEx dispex; HTMLDocumentNode *doc; + + global_prop_t *global_props; + DWORD global_prop_cnt; + DWORD global_prop_size; }; typedef enum { @@ -850,7 +850,7 @@ HRESULT exec_script(HTMLOuterWindow*,const WCHAR*,const WCHAR*,VARIANT*) DECLSPE void set_script_mode(HTMLOuterWindow*,SCRIPTMODE) DECLSPEC_HIDDEN; BOOL find_global_prop(HTMLOuterWindow*,BSTR,DWORD,ScriptHost**,DISPID*) DECLSPEC_HIDDEN; IDispatch *get_script_disp(ScriptHost*) DECLSPEC_HIDDEN; -HRESULT search_window_props(HTMLOuterWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; +HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;