diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h index 82cafdd9625..5b8a5fd263e 100644 --- a/dlls/mshtml/binding.h +++ b/dlls/mshtml/binding.h @@ -82,7 +82,7 @@ typedef struct nsProtocolStream nsProtocolStream; struct nsChannelBSC { BSCallback bsc; - HTMLWindow *window; + HTMLOuterWindow *window; nsChannel *nschannel; nsIStreamListener *nslistener; @@ -103,15 +103,15 @@ HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_ nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN; HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN; -HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**) DECLSPEC_HIDDEN; -HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN; +HRESULT create_doc_uri(HTMLOuterWindow*,WCHAR*,nsWineURI**) DECLSPEC_HIDDEN; +HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN; HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN; void prepare_for_binding(HTMLDocument*,IMoniker*,BOOL) DECLSPEC_HIDDEN; -HRESULT super_navigate(HTMLWindow*,IUri*,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN; -HRESULT navigate_new_window(HTMLWindow*,IUri*,const WCHAR*,IHTMLWindow2**) DECLSPEC_HIDDEN; +HRESULT super_navigate(HTMLOuterWindow*,IUri*,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN; +HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,IHTMLWindow2**) DECLSPEC_HIDDEN; HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,nsChannelBSC**) DECLSPEC_HIDDEN; HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*) DECLSPEC_HIDDEN; void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN; IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN; -HRESULT create_relative_uri(HTMLWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN; +HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 00301ade0a5..cf289cdecfe 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -73,7 +73,7 @@ static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *targ static HRESULT navigate_anchor(HTMLAnchorElement *This) { nsAString href_str, target_str; - HTMLWindow *window = NULL; + HTMLOuterWindow *window = NULL; nsresult nsres; HRESULT hres = E_FAIL; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 5c55e6582a5..4857544c570 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -106,7 +106,7 @@ static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch * TRACE("(%p)->(%p)\n", This, p); - *p = (IDispatch*)&This->window->IHTMLWindow2_iface; + *p = (IDispatch*)&This->window->base.IHTMLWindow2_iface; IDispatch_AddRef(*p); return S_OK; } @@ -479,7 +479,7 @@ static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFrames TRACE("(%p)->(%p)\n", This, p); - return IHTMLWindow2_get_frames(&This->window->IHTMLWindow2_iface, p); + return IHTMLWindow2_get_frames(&This->window->base.IHTMLWindow2_iface, p); } static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p) @@ -587,7 +587,7 @@ static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLoca return E_UNEXPECTED; } - return IHTMLWindow2_get_location(&This->window->IHTMLWindow2_iface, p); + return IHTMLWindow2_get_location(&This->window->base.IHTMLWindow2_iface, p); } static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p) @@ -911,8 +911,8 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT if(tmp) nsISupports_Release(tmp); - *pomWindowResult = (IDispatch*)&This->window->IHTMLWindow2_iface; - IHTMLWindow2_AddRef(&This->window->IHTMLWindow2_iface); + *pomWindowResult = (IDispatch*)&This->window->base.IHTMLWindow2_iface; + IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); return S_OK; } @@ -1365,7 +1365,7 @@ static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTML TRACE("(%p)->(%p)\n", This, p); - *p = &This->window->IHTMLWindow2_iface; + *p = &This->window->base.IHTMLWindow2_iface; IHTMLWindow2_AddRef(*p); return S_OK; } @@ -1758,7 +1758,7 @@ static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID HTMLDocument *This = impl_from_IDispatchEx(iface); if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT)) - return IDispatchEx_InvokeEx(&This->window->IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION, + return IDispatchEx_InvokeEx(&This->window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION, lcid, wFlags, pdp, pvarRes, pei, pspCaller); @@ -2199,7 +2199,7 @@ static dispex_static_data_t HTMLDocumentNode_dispex = { HTMLDocumentNode_iface_tids }; -static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLWindow *window) +static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLOuterWindow *window) { HTMLDocumentNode *doc; @@ -2226,7 +2226,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLWindow *wi return doc; } -HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret) +HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLOuterWindow *window, HTMLDocumentNode **ret) { HTMLDocumentNode *doc; @@ -2325,7 +2325,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) } if(This->basedoc.window) { This->basedoc.window->doc_obj = NULL; - IHTMLWindow2_Release(&This->basedoc.window->IHTMLWindow2_iface); + IHTMLWindow2_Release(&This->basedoc.window->base.IHTMLWindow2_iface); } if(This->basedoc.advise_holder) IOleAdviseHolder_Release(This->basedoc.advise_holder); @@ -2453,7 +2453,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) if(NS_FAILED(nsres)) ERR("GetContentDOMWindow failed: %08x\n", nsres); - hres = HTMLWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window); + hres = HTMLOuterWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window); if(nswindow) nsIDOMWindow_Release(nswindow); if(FAILED(hres)) { diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 214c542ac94..a2478b0d017 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1348,7 +1348,7 @@ HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name, return S_OK; } -void update_cp_events(HTMLWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode) +void update_cp_events(HTMLOuterWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode) { event_target_t *event_target; int i; diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index ef39caf8590..4f8fec109bc 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -54,7 +54,7 @@ HRESULT attach_event(event_target_t**,nsIDOMNode*,HTMLDocument*,BSTR,IDispatch*, HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN; HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN; -void update_cp_events(HTMLWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN; +void update_cp_events(HTMLOuterWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN; HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN; void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 2663616d86b..711762bd95e 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -108,7 +108,7 @@ static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 * return E_FAIL; } - hres = IHTMLWindow2_get_document(&This->framebase.content_window->IHTMLWindow2_iface, &doc); + hres = IHTMLWindow2_get_document(&This->framebase.content_window->base.IHTMLWindow2_iface, &doc); if(FAILED(hres)) return hres; @@ -244,7 +244,7 @@ static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, return E_FAIL; } - return IDispatchEx_InvokeEx(&This->framebase.content_window->IDispatchEx_iface, id, lcid, + return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid, flags, params, res, ei, caller); } diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c index 90669e07fc9..fd6e2e6cedf 100644 --- a/dlls/mshtml/htmlframebase.c +++ b/dlls/mshtml/htmlframebase.c @@ -38,7 +38,7 @@ static const WCHAR noW[] = {'n','o',0}; HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc) { nsIDOMWindow *nswindow; - HTMLWindow *window; + HTMLOuterWindow *window; nsresult nsres; HRESULT hres = S_OK; @@ -51,7 +51,7 @@ HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc) window = nswindow_to_window(nswindow); if(!window) - hres = HTMLWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow, + hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow, frame->element.node.doc->basedoc.window, &window); nsIDOMWindow_Release(nswindow); if(FAILED(hres)) @@ -418,8 +418,8 @@ static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, I TRACE("(%p)->(%p)\n", This, p); if(This->content_window) { - IHTMLWindow2_AddRef(&This->content_window->IHTMLWindow2_iface); - *p = &This->content_window->IHTMLWindow2_iface; + IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface); + *p = &This->content_window->base.IHTMLWindow2_iface; }else { WARN("NULL content window\n"); *p = NULL; diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index 3acab1eaa29..aefe118646c 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -215,7 +215,7 @@ static HRESULT HTMLIFrame_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, return E_FAIL; } - return IDispatchEx_InvokeEx(&This->framebase.content_window->IDispatchEx_iface, id, lcid, + return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid, flags, params, res, ei, caller); } diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index 7d4817d0796..c626fca6c52 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -917,7 +917,7 @@ static dispex_static_data_t HTMLImageElementFactory_dispex = { HTMLImageElementFactory_iface_tids }; -HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window) +HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow *window) { HTMLImageElementFactory *ret; diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index ffe72a0a551..7a010391d18 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -617,7 +617,7 @@ static dispex_static_data_t HTMLLocation_dispex = { }; -HRESULT HTMLLocation_Create(HTMLWindow *window, HTMLLocation **ret) +HRESULT HTMLLocation_Create(HTMLOuterWindow *window, HTMLLocation **ret) { HTMLLocation *location; diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c index 0b57216c196..a450e2af163 100644 --- a/dlls/mshtml/htmloption.c +++ b/dlls/mshtml/htmloption.c @@ -517,7 +517,7 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { HTMLOptionElementFactory_create }; -HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow *window) +HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow *window) { HTMLOptionElementFactory *ret; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index ff17f95e49d..c95f95e6e83 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Jacek Caban for CodeWeavers + * Copyright 2006-2012 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,7 @@ */ #include +#include #define COBJMACROS @@ -42,7 +43,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); static struct list window_list = LIST_INIT(window_list); -static void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node) +static inline BOOL is_outer_window(HTMLWindow *window) +{ + return &window->outer_window->base == window; +} + +static void window_set_docnode(HTMLOuterWindow *window, HTMLDocumentNode *doc_node) { if(window->doc) { if(window->doc_obj && window == window->doc_obj->basedoc.window) @@ -79,20 +85,20 @@ static void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node) } } -static void release_children(HTMLWindow *This) +static void release_children(HTMLOuterWindow *This) { - HTMLWindow *child; + HTMLOuterWindow *child; while(!list_empty(&This->children)) { - child = LIST_ENTRY(list_tail(&This->children), HTMLWindow, sibling_entry); + child = LIST_ENTRY(list_tail(&This->children), HTMLOuterWindow, sibling_entry); list_remove(&child->sibling_entry); child->parent = NULL; - IHTMLWindow2_Release(&child->IHTMLWindow2_iface); + IHTMLWindow2_Release(&child->base.IHTMLWindow2_iface); } } -static HRESULT get_location(HTMLWindow *This, HTMLLocation **ret) +static HRESULT get_location(HTMLOuterWindow *This, HTMLLocation **ret) { if(This->location) { IHTMLLocation_AddRef(&This->location->IHTMLLocation_iface); @@ -108,9 +114,9 @@ static HRESULT get_location(HTMLWindow *This, HTMLLocation **ret) return S_OK; } -void get_top_window(HTMLWindow *window, HTMLWindow **ret) +void get_top_window(HTMLOuterWindow *window, HTMLOuterWindow **ret) { - HTMLWindow *iter; + HTMLOuterWindow *iter; for(iter = window; iter->parent; iter = iter->parent); *ret = iter; @@ -118,22 +124,22 @@ void get_top_window(HTMLWindow *window, HTMLWindow **ret) static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var) { - if(!window->doc) { + if(!window->outer_window->doc) { FIXME("No document\n"); return E_FAIL; } - return set_event_handler(&window->doc->body_event_target, NULL, window->doc, eid, var); + return set_event_handler(&window->outer_window->doc->body_event_target, NULL, window->outer_window->doc, eid, var); } static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var) { - if(!window->doc) { + if(!window->outer_window->doc) { FIXME("No document\n"); return E_FAIL; } - return get_event_handler(&window->doc->body_event_target, eid, var); + return get_event_handler(&window->outer_window->doc->body_event_target, eid, var); } static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface) @@ -183,8 +189,9 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii }else if(IsEqualGUID(&IID_ITravelLogClient, riid)) { TRACE("(%p)->(IID_ITravelLogClient %p)\n", This, ppv); *ppv = &This->ITravelLogClient_iface; - }else if(dispex_query_interface(&This->dispex, riid, ppv)) { - return *ppv ? S_OK : E_NOINTERFACE; + }else if(dispex_query_interface(&This->outer_window->dispex, riid, ppv)) { + assert(!*ppv); + return E_NOINTERFACE; } if(*ppv) { @@ -206,6 +213,62 @@ static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) return ref; } +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); + window_set_docnode(This, NULL); + release_children(This); + + if(This->secmgr) + IInternetSecurityManager_Release(This->secmgr); + + if(This->frame_element) + This->frame_element->content_window = NULL; + + if(This->option_factory) { + This->option_factory->window = NULL; + IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface); + } + + if(This->image_factory) { + This->image_factory->window = NULL; + IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface); + } + + if(This->location) { + This->location->window = NULL; + IHTMLLocation_Release(&This->location->IHTMLLocation_iface); + } + + 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) + nsIDOMWindow_Release(This->nswindow); + + list_remove(&This->entry); + release_dispex(&This->dispex); + heap_free(This); +} + +static void release_inner_window(HTMLInnerWindow *This) +{ + heap_free(This); +} + static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); @@ -214,53 +277,10 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - DWORD i; - - remove_target_tasks(This->task_magic); - set_window_bscallback(This, NULL); - set_current_mon(This, NULL); - window_set_docnode(This, NULL); - release_children(This); - - if(This->secmgr) - IInternetSecurityManager_Release(This->secmgr); - - if(This->frame_element) - This->frame_element->content_window = NULL; - - if(This->option_factory) { - This->option_factory->window = NULL; - IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface); - } - - if(This->image_factory) { - This->image_factory->window = NULL; - IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface); - } - - if(This->location) { - This->location->window = NULL; - IHTMLLocation_Release(&This->location->IHTMLLocation_iface); - } - - 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) - nsIDOMWindow_Release(This->nswindow); - - list_remove(&This->entry); - release_dispex(&This->dispex); - heap_free(This); + if(is_outer_window(This)) + release_outer_window(This->outer_window); + else + release_inner_window(This->inner_window); } return ref; @@ -301,7 +321,7 @@ static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMembe pDispParams, pVarResult, pExcepInfo, puArgErr); } -static HRESULT get_frame_by_index(nsIDOMWindowCollection *nsFrames, PRUint32 index, HTMLWindow **ret) +static HRESULT get_frame_by_index(nsIDOMWindowCollection *nsFrames, PRUint32 index, HTMLOuterWindow **ret) { PRUint32 length; nsIDOMWindow *nsWindow; @@ -333,13 +353,13 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, { HTMLWindow *This = impl_from_IHTMLWindow2(iface); nsIDOMWindowCollection *nsFrames; - HTMLWindow *window = NULL; + HTMLOuterWindow *window = NULL; HRESULT hres = S_OK; nsresult nsres; TRACE("(%p)->(%p %p)\n", This, pvarIndex, pvarResult); - nsres = nsIDOMWindow_GetFrames(This->nswindow, &nsFrames); + nsres = nsIDOMWindow_GetFrames(This->outer_window->nswindow, &nsFrames); if(NS_FAILED(nsres)) { FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres); return E_FAIL; @@ -370,7 +390,7 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, window = NULL; for(i = 0; i < length && !window; ++i) { - HTMLWindow *cur_window; + HTMLOuterWindow *cur_window; nsIDOMWindow *nsWindow; BSTR id; @@ -408,7 +428,7 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, if(!window) return DISP_E_MEMBERNOTFOUND; - IHTMLWindow2_AddRef(&window->IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); V_VT(pvarResult) = VT_DISPATCH; V_DISPATCH(pvarResult) = (IDispatch*)window; return S_OK; @@ -423,7 +443,7 @@ static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p) TRACE("(%p)->(%p)\n", This, p); - nsres = nsIDOMWindow_GetFrames(This->nswindow, &nscollection); + nsres = nsIDOMWindow_GetFrames(This->outer_window->nswindow, &nscollection); if(NS_FAILED(nsres)) { ERR("GetFrames failed: %08x\n", nsres); return E_FAIL; @@ -509,7 +529,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID TRACE("(%p)->(%d)\n", This, timerID); - return clear_task_timer(&This->doc->basedoc, FALSE, timerID); + return clear_task_timer(&This->outer_window->doc->basedoc, FALSE, timerID); } #define MAX_MESSAGE_LEN 2000 @@ -537,7 +557,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message) msg[MAX_MESSAGE_LEN] = 0; } - MessageBoxW(This->doc_obj->hwnd, msg, title, MB_ICONWARNING); + MessageBoxW(This->outer_window->doc_obj->hwnd, msg, title, MB_ICONWARNING); if(msg != message) heap_free(msg); return S_OK; @@ -560,7 +580,7 @@ static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message, return S_OK; } - if(MessageBoxW(This->doc_obj->hwnd, message, wszTitle, + if(MessageBoxW(This->outer_window->doc_obj->hwnd, message, wszTitle, MB_OKCANCEL|MB_ICONQUESTION)==IDOK) *confirmed = VARIANT_TRUE; else *confirmed = VARIANT_FALSE; @@ -653,20 +673,21 @@ static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message, arg.textdata = textdata; DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG), - This->doc_obj->hwnd, prompt_dlgproc, (LPARAM)&arg); + This->outer_window->doc_obj->hwnd, prompt_dlgproc, (LPARAM)&arg); return S_OK; } static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(!This->image_factory) - This->image_factory = HTMLImageElementFactory_Create(This); + if(!window->image_factory) + window->image_factory = HTMLImageElementFactory_Create(window); - *p = &This->image_factory->IHTMLImageElementFactory_iface; + *p = &window->image_factory->IHTMLImageElementFactory_iface; IHTMLImageElementFactory_AddRef(*p); return S_OK; @@ -680,7 +701,7 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio TRACE("(%p)->(%p)\n", This, p); - hres = get_location(This, &location); + hres = get_location(This->outer_window, &location); if(FAILED(hres)) return hres; @@ -691,19 +712,20 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(!This->history) { + if(!window->history) { HRESULT hres; - hres = create_history(&This->history); + hres = create_history(&window->history); if(FAILED(hres)) return hres; } - IOmHistory_AddRef(This->history); - *p = This->history; + IOmHistory_AddRef(window->history); + *p = window->history; return S_OK; } @@ -750,7 +772,7 @@ static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v) TRACE("(%p)->(%s)\n", This, debugstr_w(v)); nsAString_InitDepend(&name_str, v); - nsres = nsIDOMWindow_SetName(This->nswindow, &name_str); + nsres = nsIDOMWindow_SetName(This->outer_window->nswindow, &name_str); nsAString_Finish(&name_str); if(NS_FAILED(nsres)) ERR("SetName failed: %08x\n", nsres); @@ -767,20 +789,21 @@ static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p) TRACE("(%p)->(%p)\n", This, p); nsAString_Init(&name_str, NULL); - nsres = nsIDOMWindow_GetName(This->nswindow, &name_str); + nsres = nsIDOMWindow_GetName(This->outer_window->nswindow, &name_str); return return_nsstr(nsres, &name_str, p); } static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(!This->parent) + if(!window->parent) return IHTMLWindow2_get_self(&This->IHTMLWindow2_iface, p); - *p = &This->parent->IHTMLWindow2_iface; + *p = &window->parent->base.IHTMLWindow2_iface; IHTMLWindow2_AddRef(*p); return S_OK; } @@ -789,6 +812,7 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, BSTR features, VARIANT_BOOL replace, IHTMLWindow2 **pomWindowResult) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; INewWindowManager *new_window_mgr; IUri *uri; HRESULT hres; @@ -796,7 +820,7 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name), debugstr_w(features), replace, pomWindowResult); - if(!This->doc_obj) + if(!window->doc_obj) return E_UNEXPECTED; if(name && *name == '_') { @@ -804,27 +828,27 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, return E_NOTIMPL; } - hres = do_query_service((IUnknown*)This->doc_obj->client, &SID_SNewWindowManager, &IID_INewWindowManager, + hres = do_query_service((IUnknown*)window->doc_obj->client, &SID_SNewWindowManager, &IID_INewWindowManager, (void**)&new_window_mgr); if(FAILED(hres)) { FIXME("No INewWindowManager\n"); return E_NOTIMPL; } - hres = INewWindowManager_EvaluateNewWindow(new_window_mgr, url, name, This->url, - features, !!replace, This->doc_obj->has_popup ? 0 : NWMF_FIRST, 0); + hres = INewWindowManager_EvaluateNewWindow(new_window_mgr, url, name, window->url, + features, !!replace, window->doc_obj->has_popup ? 0 : NWMF_FIRST, 0); INewWindowManager_Release(new_window_mgr); - This->doc_obj->has_popup = TRUE; + window->doc_obj->has_popup = TRUE; if(FAILED(hres)) { *pomWindowResult = NULL; return S_OK; } - hres = create_relative_uri(This, url, &uri); + hres = create_relative_uri(window, url, &uri); if(FAILED(hres)) return hres; - hres = navigate_new_window(This, uri, name, pomWindowResult); + hres = navigate_new_window(window, uri, name, pomWindowResult); IUri_Release(uri); return hres; } @@ -844,12 +868,12 @@ static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); - HTMLWindow *top; + HTMLOuterWindow *top; TRACE("(%p)->(%p)\n", This, p); - get_top_window(This, &top); - *p = &top->IHTMLWindow2_iface; + get_top_window(This->outer_window, &top); + *p = &top->base.IHTMLWindow2_iface; IHTMLWindow2_AddRef(*p); return S_OK; @@ -1022,9 +1046,9 @@ static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocumen TRACE("(%p)->(%p)\n", This, p); - if(This->doc) { + if(This->outer_window->doc) { /* FIXME: We should return a wrapper object here */ - *p = &This->doc->basedoc.IHTMLDocument2_iface; + *p = &This->outer_window->doc->basedoc.IHTMLDocument2_iface; IHTMLDocument2_AddRef(*p); }else { *p = NULL; @@ -1036,12 +1060,13 @@ static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocumen static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(This->event) - IHTMLEventObj_AddRef(This->event); - *p = This->event; + if(window->event) + IHTMLEventObj_AddRef(window->event); + *p = window->event; return S_OK; } @@ -1071,32 +1096,34 @@ static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VA static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(!This->screen) { + if(!window->screen) { HRESULT hres; - hres = HTMLScreen_Create(&This->screen); + hres = HTMLScreen_Create(&window->screen); if(FAILED(hres)) return hres; } - *p = This->screen; - IHTMLScreen_AddRef(This->screen); + *p = window->screen; + IHTMLScreen_AddRef(window->screen); return S_OK; } static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%p)\n", This, p); - if(!This->option_factory) - This->option_factory = HTMLOptionElementFactory_Create(This); + if(!window->option_factory) + window->option_factory = HTMLOptionElementFactory_Create(window); - *p = &This->option_factory->IHTMLOptionElementFactory_iface; + *p = &window->option_factory->IHTMLOptionElementFactory_iface; IHTMLOptionElementFactory_AddRef(*p); return S_OK; @@ -1108,8 +1135,8 @@ static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface) TRACE("(%p)->()\n", This); - if(This->doc_obj) - SetFocus(This->doc_obj->hwnd); + if(This->outer_window->doc_obj) + SetFocus(This->outer_window->doc_obj->hwnd); return S_OK; } @@ -1160,7 +1187,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI TRACE("(%p)->(%d)\n", This, timerID); - return clear_task_timer(&This->doc->basedoc, TRUE, timerID); + return clear_task_timer(&This->outer_window->doc->basedoc, TRUE, timerID); } static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v) @@ -1184,7 +1211,7 @@ static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BS TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet); - return exec_script(This, scode, language, pvarRet); + return exec_script(This->outer_window, scode, language, pvarRet); } static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String) @@ -1209,7 +1236,7 @@ static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, LONG x, LONG y) TRACE("(%p)->(%d %d)\n", This, x, y); - nsres = nsIDOMWindow_ScrollBy(This->nswindow, x, y); + nsres = nsIDOMWindow_ScrollBy(This->outer_window->nswindow, x, y); if(NS_FAILED(nsres)) ERR("ScrollBy failed: %08x\n", nsres); @@ -1223,7 +1250,7 @@ static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, LONG x, LONG y) TRACE("(%p)->(%d %d)\n", This, x, y); - nsres = nsIDOMWindow_ScrollTo(This->nswindow, x, y); + nsres = nsIDOMWindow_ScrollTo(This->outer_window->nswindow, x, y); if(NS_FAILED(nsres)) ERR("ScrollTo failed: %08x\n", nsres); @@ -1266,10 +1293,10 @@ static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch ** *p = NULL; - if(!This->doc_obj->hostui) + if(!This->outer_window->doc_obj->hostui) return S_OK; - return IDocHostUIHandler_GetExternal(This->doc_obj->hostui, p); + return IDocHostUIHandler_GetExternal(This->outer_window->doc_obj->hostui, p); } static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = { @@ -1430,32 +1457,34 @@ static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, LONG *p) static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); - if(!This->doc) { + if(!window->doc) { FIXME("No document\n"); return E_FAIL; } - return attach_event(&This->doc->body_event_target, NULL, &This->doc->basedoc, event, pDisp, pfResult); + return attach_event(&window->doc->body_event_target, NULL, &window->doc->basedoc, event, pDisp, pfResult); } static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->()\n", This); - if(!This->doc) { + if(!window->doc) { FIXME("No document\n"); return E_FAIL; } - return detach_event(This->doc->body_event_target, &This->doc->basedoc, event, pDisp); + return detach_event(window->doc->body_event_target, &window->doc->basedoc, event, pDisp); } -static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARIANT *language, +static HRESULT window_set_timer(HTMLOuterWindow *This, VARIANT *expr, LONG msec, VARIANT *language, BOOL interval, LONG *timer_id) { IDispatch *disp = NULL; @@ -1491,7 +1520,7 @@ static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expre TRACE("(%p)->(%s %d %s %p)\n", This, debugstr_variant(expression), msec, debugstr_variant(language), timerID); - return window_set_timer(This, expression, msec, language, FALSE, timerID); + return window_set_timer(This->outer_window, expression, msec, language, FALSE, timerID); } static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, LONG msec, @@ -1501,7 +1530,7 @@ static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expr TRACE("(%p)->(%p %d %p %p)\n", This, expression, msec, language, timerID); - return window_set_timer(This, expression, msec, language, TRUE, timerID); + return window_set_timer(This->outer_window, expression, msec, language, TRUE, timerID); } static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface) @@ -1651,8 +1680,8 @@ static HRESULT WINAPI HTMLWindow4_get_frameElement(IHTMLWindow4 *iface, IHTMLFra HTMLWindow *This = impl_from_IHTMLWindow4(iface); TRACE("(%p)->(%p)\n", This, p); - if(This->frame_element) { - *p = &This->frame_element->IHTMLFrameBase_iface; + if(This->outer_window->frame_element) { + *p = &This->outer_window->frame_element->IHTMLFrameBase_iface; IHTMLFrameBase_AddRef(*p); }else *p = NULL; @@ -1955,6 +1984,7 @@ static HRESULT WINAPI HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow *iface, BSTR arg4, VARIANT *post_data_var, VARIANT *headers_var, ULONG flags) { HTMLWindow *This = impl_from_IHTMLPrivateWindow(iface); + HTMLOuterWindow *window = This->outer_window; OLECHAR *translated_url = NULL; DWORD post_data_size = 0; BYTE *post_data = NULL; @@ -1965,8 +1995,8 @@ static HRESULT WINAPI HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow *iface, TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This, debugstr_w(url), debugstr_w(arg2), debugstr_w(arg3), debugstr_w(arg4), debugstr_variant(post_data_var), debugstr_variant(headers_var), flags); - if(This->doc_obj->hostui) { - hres = IDocHostUIHandler_TranslateUrl(This->doc_obj->hostui, 0, url, &translated_url); + if(window->doc_obj->hostui) { + hres = IDocHostUIHandler_TranslateUrl(window->doc_obj->hostui, 0, url, &translated_url); if(hres != S_OK) translated_url = NULL; } @@ -1990,7 +2020,7 @@ static HRESULT WINAPI HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow *iface, headers = V_BSTR(headers_var); } - hres = super_navigate(This, uri, headers, post_data, post_data_size); + hres = super_navigate(window, uri, headers, post_data, post_data_size); IUri_Release(uri); if(post_data) SafeArrayUnaccessData(V_ARRAY(post_data_var)); @@ -2034,7 +2064,7 @@ static HRESULT WINAPI HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow *ifa if(!url) return E_INVALIDARG; - *url = SysAllocString(This->url); + *url = SysAllocString(This->outer_window->url); return S_OK; } @@ -2141,7 +2171,7 @@ static HRESULT WINAPI WindowDispEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pc TRACE("(%p)->(%p)\n", This, pctinfo); - return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); + return IDispatchEx_GetTypeInfoCount(&This->outer_window->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, @@ -2151,7 +2181,7 @@ static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); + return IDispatchEx_GetTypeInfo(&This->outer_window->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, @@ -2186,11 +2216,11 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe /* FIXME: Use script dispatch */ - return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + return IDispatchEx_Invoke(&This->outer_window->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } -static global_prop_t *alloc_global_prop(HTMLWindow *This, global_prop_type_t type, BSTR name) +static global_prop_t *alloc_global_prop(HTMLOuterWindow *This, global_prop_type_t type, BSTR name) { if(This->global_prop_cnt == This->global_prop_size) { global_prop_t *new_props; @@ -2217,12 +2247,12 @@ static global_prop_t *alloc_global_prop(HTMLWindow *This, global_prop_type_t typ return This->global_props + This->global_prop_cnt++; } -static inline DWORD prop_to_dispid(HTMLWindow *This, global_prop_t *prop) +static inline DWORD prop_to_dispid(HTMLOuterWindow *This, global_prop_t *prop) { return MSHTML_DISPID_CUSTOM_MIN + (prop-This->global_props); } -HRESULT search_window_props(HTMLWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) +HRESULT search_window_props(HTMLOuterWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) { DWORD i; ScriptHost *script_host; @@ -2256,32 +2286,33 @@ HRESULT search_window_props(HTMLWindow *This, BSTR bstrName, DWORD grfdex, DISPI static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { HTMLWindow *This = impl_from_IDispatchEx(iface); + HTMLOuterWindow *window = This->outer_window; HRESULT hres; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); - hres = search_window_props(This, bstrName, grfdex, pid); + hres = search_window_props(window, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; - hres = IDispatchEx_GetDispID(&This->dispex.IDispatchEx_iface, bstrName, grfdex, pid); + hres = IDispatchEx_GetDispID(&window->dispex.IDispatchEx_iface, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; - if(This->doc) { + if(window->doc) { global_prop_t *prop; IHTMLElement *elem; - hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface, + hres = IHTMLDocument3_getElementById(&window->doc->basedoc.IHTMLDocument3_iface, bstrName, &elem); if(SUCCEEDED(hres) && elem) { IHTMLElement_Release(elem); - prop = alloc_global_prop(This, GLOBAL_ELEMENTVAR, bstrName); + prop = alloc_global_prop(window, GLOBAL_ELEMENTVAR, bstrName); if(!prop) return E_OUTOFMEMORY; - *pid = prop_to_dispid(This, prop); + *pid = prop_to_dispid(window, prop); return S_OK; } } @@ -2293,6 +2324,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { HTMLWindow *This = impl_from_IDispatchEx(iface); + HTMLOuterWindow *window = This->outer_window; TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); @@ -2302,7 +2334,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID TRACE("forwarding to location.href\n"); - hres = get_location(This, &location); + hres = get_location(window, &location); if(FAILED(hres)) return hres; @@ -2312,7 +2344,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID return hres; } - return IDispatchEx_InvokeEx(&This->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, + return IDispatchEx_InvokeEx(&window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); } @@ -2322,7 +2354,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR b TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex); - return IDispatchEx_DeleteMemberByName(&This->dispex.IDispatchEx_iface, bstrName, grfdex); + return IDispatchEx_DeleteMemberByName(&This->outer_window->dispex.IDispatchEx_iface, bstrName, grfdex); } static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) @@ -2331,7 +2363,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISP TRACE("(%p)->(%x)\n", This, id); - return IDispatchEx_DeleteMemberByDispID(&This->dispex.IDispatchEx_iface, id); + return IDispatchEx_DeleteMemberByDispID(&This->outer_window->dispex.IDispatchEx_iface, id); } static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) @@ -2340,7 +2372,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPI TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); - return IDispatchEx_GetMemberProperties(&This->dispex.IDispatchEx_iface, id, grfdexFetch, + return IDispatchEx_GetMemberProperties(&This->outer_window->dispex.IDispatchEx_iface, id, grfdexFetch, pgrfdex); } @@ -2350,7 +2382,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id, TRACE("(%p)->(%x %p)\n", This, id, pbstrName); - return IDispatchEx_GetMemberName(&This->dispex.IDispatchEx_iface, id, pbstrName); + return IDispatchEx_GetMemberName(&This->outer_window->dispex.IDispatchEx_iface, id, pbstrName); } static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) @@ -2359,7 +2391,7 @@ static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfde TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid); - return IDispatchEx_GetNextDispID(&This->dispex.IDispatchEx_iface, grfdex, id, pid); + return IDispatchEx_GetNextDispID(&This->outer_window->dispex.IDispatchEx_iface, grfdex, id, pid); } static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) @@ -2424,10 +2456,10 @@ static HRESULT WINAPI HTMLWindowSP_QueryService(IServiceProvider *iface, REFGUID TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); - if(!This->doc_obj) + if(!This->outer_window->doc_obj) return E_NOINTERFACE; - return IServiceProvider_QueryService(&This->doc_obj->basedoc.IServiceProvider_iface, + return IServiceProvider_QueryService(&This->outer_window->doc_obj->basedoc.IServiceProvider_iface, guidService, riid, ppv); } @@ -2438,15 +2470,15 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { HTMLWindowSP_QueryService }; -static inline HTMLWindow *impl_from_DispatchEx(DispatchEx *iface) +static inline HTMLOuterWindow *impl_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, HTMLWindow, dispex); + return CONTAINING_RECORD(iface, HTMLOuterWindow, dispex); } static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - HTMLWindow *This = impl_from_DispatchEx(dispex); + HTMLOuterWindow *This = impl_from_DispatchEx(dispex); global_prop_t *prop; DWORD idx; HRESULT hres; @@ -2546,20 +2578,13 @@ static dispex_static_data_t HTMLWindow_dispex = { HTMLWindow_iface_tids }; -HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLWindow *parent, HTMLWindow **ret) +static void *alloc_window(size_t size) { HTMLWindow *window; - HRESULT hres; - window = heap_alloc_zero(sizeof(HTMLWindow)); + window = heap_alloc_zero(size); if(!window) - return E_OUTOFMEMORY; - - window->window_ref = heap_alloc(sizeof(windowref_t)); - if(!window->window_ref) { - heap_free(window); - return E_OUTOFMEMORY; - } + return NULL; window->IHTMLWindow2_iface.lpVtbl = &HTMLWindow2Vtbl; window->IHTMLWindow3_iface.lpVtbl = &HTMLWindow3Vtbl; @@ -2571,12 +2596,34 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML window->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl; window->ITravelLogClient_iface.lpVtbl = &TravelLogClientVtbl; window->ref = 1; + + return window; +} + +HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLOuterWindow *parent, HTMLOuterWindow **ret) +{ + HTMLOuterWindow *window; + HRESULT hres; + + window = alloc_window(sizeof(HTMLOuterWindow)); + if(!window) + return E_OUTOFMEMORY; + + window->base.outer_window = window; + window->base.inner_window = NULL; + + window->window_ref = heap_alloc(sizeof(windowref_t)); + if(!window->window_ref) { + heap_free(window); + return E_OUTOFMEMORY; + } + window->doc_obj = doc_obj; window->window_ref->window = window; window->window_ref->ref = 1; - init_dispex(&window->dispex, (IUnknown*)&window->IHTMLWindow2_iface, &HTMLWindow_dispex); + init_dispex(&window->dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex); if(nswindow) { nsIDOMWindow_AddRef(nswindow); @@ -2589,7 +2636,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML hres = CoInternetCreateSecurityManager(NULL, &window->secmgr, 0); if(FAILED(hres)) { - IHTMLWindow2_Release(&window->IHTMLWindow2_iface); + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); return hres; } @@ -2600,7 +2647,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML list_add_head(&window_list, &window->entry); if(parent) { - IHTMLWindow2_AddRef(&window->IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); window->parent = parent; list_add_tail(&parent->children, &window->sibling_entry); @@ -2610,7 +2657,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML return S_OK; } -void update_window_doc(HTMLWindow *window) +void update_window_doc(HTMLOuterWindow *window) { nsIDOMHTMLDocument *nshtmldoc; nsIDOMDocument *nsdoc; @@ -2645,11 +2692,11 @@ void update_window_doc(HTMLWindow *window) nsIDOMHTMLDocument_Release(nshtmldoc); } -HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow) +HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow *nswindow) { - HTMLWindow *iter; + HTMLOuterWindow *iter; - LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) { + LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLOuterWindow, entry) { if(iter->nswindow == nswindow) return iter; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1f04a6ea286..87cd7ca412e 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -236,6 +236,8 @@ void release_typelib(void) DECLSPEC_HIDDEN; HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN; typedef struct HTMLWindow HTMLWindow; +typedef struct HTMLInnerWindow HTMLInnerWindow; +typedef struct HTMLOuterWindow HTMLOuterWindow; typedef struct HTMLDocumentNode HTMLDocumentNode; typedef struct HTMLDocumentObj HTMLDocumentObj; typedef struct HTMLFrameBase HTMLFrameBase; @@ -267,7 +269,7 @@ typedef struct { LONG ref; - HTMLWindow *window; + HTMLOuterWindow *window; } HTMLOptionElementFactory; typedef struct { @@ -276,7 +278,7 @@ typedef struct { LONG ref; - HTMLWindow *window; + HTMLOuterWindow *window; } HTMLImageElementFactory; struct HTMLLocation { @@ -285,18 +287,17 @@ struct HTMLLocation { LONG ref; - HTMLWindow *window; + HTMLOuterWindow *window; }; typedef struct { - HTMLWindow *window; + HTMLOuterWindow *window; LONG ref; } windowref_t; typedef struct nsChannelBSC nsChannelBSC; struct HTMLWindow { - DispatchEx dispex; IHTMLWindow2 IHTMLWindow2_iface; IHTMLWindow3 IHTMLWindow3_iface; IHTMLWindow4 IHTMLWindow4_iface; @@ -309,13 +310,21 @@ struct HTMLWindow { LONG ref; + HTMLInnerWindow *inner_window; + HTMLOuterWindow *outer_window; +}; + +struct HTMLOuterWindow { + HTMLWindow base; + DispatchEx dispex; + windowref_t *window_ref; LONG task_magic; HTMLDocumentNode *doc; HTMLDocumentObj *doc_obj; nsIDOMWindow *nswindow; - HTMLWindow *parent; + HTMLOuterWindow *parent; HTMLFrameBase *frame_element; READYSTATE readystate; @@ -346,6 +355,10 @@ struct HTMLWindow { struct list entry; }; +struct HTMLInnerWindow { + HTMLWindow base; +}; + typedef enum { UNKNOWN_USERMODE, BROWSEMODE, @@ -419,7 +432,7 @@ struct HTMLDocument { HTMLDocumentObj *doc_obj; HTMLDocumentNode *doc_node; - HTMLWindow *window; + HTMLOuterWindow *window; LONG task_magic; @@ -598,7 +611,7 @@ struct HTMLFrameBase { IHTMLFrameBase IHTMLFrameBase_iface; IHTMLFrameBase2 IHTMLFrameBase2_iface; - HTMLWindow *content_window; + HTMLOuterWindow *content_window; nsIDOMHTMLFrameElement *nsframe; nsIDOMHTMLIFrameElement *nsiframe; @@ -639,16 +652,16 @@ struct HTMLDocumentNode { HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; -HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN; +HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLOuterWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN; HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN; -HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**) DECLSPEC_HIDDEN; -void update_window_doc(HTMLWindow*) DECLSPEC_HIDDEN; -HTMLWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN; -void get_top_window(HTMLWindow*,HTMLWindow**) DECLSPEC_HIDDEN; -HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN; -HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN; -HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**) DECLSPEC_HIDDEN; +HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; +void update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN; +HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN; +void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; +HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN; +HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN; +HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN; IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN; HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN; HRESULT create_history(IOmHistory**) DECLSPEC_HIDDEN; @@ -701,7 +714,7 @@ BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN; HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN; BOOL compare_ignoring_frag(IUri*,IUri*) DECLSPEC_HIDDEN; -HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; +HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN; void call_property_onchanged(ConnectionPoint*,DISPID) DECLSPEC_HIDDEN; @@ -728,18 +741,18 @@ void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN; nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN; nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN; -void set_window_bscallback(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; -void set_current_mon(HTMLWindow*,IMoniker*) DECLSPEC_HIDDEN; -void set_current_uri(HTMLWindow*,IUri*) DECLSPEC_HIDDEN; -HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN; -HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; +void set_window_bscallback(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; +void set_current_mon(HTMLOuterWindow*,IMoniker*) DECLSPEC_HIDDEN; +void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN; +HRESULT start_binding(HTMLOuterWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN; +HRESULT async_start_doc_binding(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN; void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN; void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN; HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN; -void set_ready_state(HTMLWindow*,READYSTATE) DECLSPEC_HIDDEN; +void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN; HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN; HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN; @@ -828,15 +841,15 @@ void release_nodes(HTMLDocumentNode*) DECLSPEC_HIDDEN; HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN; -void release_script_hosts(HTMLWindow*) DECLSPEC_HIDDEN; -void connect_scripts(HTMLWindow*) DECLSPEC_HIDDEN; -void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*) DECLSPEC_HIDDEN; -IDispatch *script_parse_event(HTMLWindow*,LPCWSTR) DECLSPEC_HIDDEN; -HRESULT exec_script(HTMLWindow*,const WCHAR*,const WCHAR*,VARIANT*) DECLSPEC_HIDDEN; -void set_script_mode(HTMLWindow*,SCRIPTMODE) DECLSPEC_HIDDEN; -BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*) DECLSPEC_HIDDEN; +void release_script_hosts(HTMLOuterWindow*) DECLSPEC_HIDDEN; +void connect_scripts(HTMLOuterWindow*) DECLSPEC_HIDDEN; +void doc_insert_script(HTMLOuterWindow*,nsIDOMHTMLScriptElement*) DECLSPEC_HIDDEN; +IDispatch *script_parse_event(HTMLOuterWindow*,LPCWSTR) DECLSPEC_HIDDEN; +HRESULT exec_script(HTMLOuterWindow*,const WCHAR*,const WCHAR*,VARIANT*) DECLSPEC_HIDDEN; +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(HTMLWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; +HRESULT search_window_props(HTMLOuterWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 7ce1add4377..6a25346a50b 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -267,7 +267,7 @@ static void parse_complete(HTMLDocumentObj *doc) call_explorer_69(doc); if(doc->is_webbrowser && doc->usermode != EDITMODE) - IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->basedoc.window->IHTMLWindow2_iface, 0); + IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->basedoc.window->base.IHTMLWindow2_iface, 0); /* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */ } diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 1979af32e7e..9936556eb42 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -717,7 +717,7 @@ static HRESULT process_response_headers(nsChannelBSC *This, const WCHAR *headers return S_OK; } -HRESULT start_binding(HTMLWindow *window, HTMLDocumentNode *doc, BSCallback *bscallback, IBindCtx *bctx) +HRESULT start_binding(HTMLOuterWindow *window, HTMLDocumentNode *doc, BSCallback *bscallback, IBindCtx *bctx) { IStream *str = NULL; HRESULT hres; @@ -1387,7 +1387,7 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result) ind = 3; V_VT(&var) = VT_UNKNOWN; - V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface; + V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface; SafeArrayPutElement(sa, &ind, &var); /* FIXME: what are the following fields for? */ @@ -1653,7 +1653,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data, return S_OK; } -void set_window_bscallback(HTMLWindow *window, nsChannelBSC *callback) +void set_window_bscallback(HTMLOuterWindow *window, nsChannelBSC *callback) { if(window->bscallback) { if(window->bscallback->bsc.binding) @@ -1674,7 +1674,7 @@ void set_window_bscallback(HTMLWindow *window, nsChannelBSC *callback) typedef struct { task_t header; - HTMLWindow *window; + HTMLOuterWindow *window; nsChannelBSC *bscallback; } start_doc_binding_task_t; @@ -1693,7 +1693,7 @@ static void start_doc_binding_task_destr(task_t *_task) heap_free(task); } -HRESULT async_start_doc_binding(HTMLWindow *window, nsChannelBSC *bscallback) +HRESULT async_start_doc_binding(HTMLOuterWindow *window, nsChannelBSC *bscallback) { start_doc_binding_task_t *task; @@ -1784,14 +1784,14 @@ void channelbsc_set_channel(nsChannelBSC *This, nsChannel *channel, nsIStreamLis typedef struct { task_t header; - HTMLWindow *window; + HTMLOuterWindow *window; IUri *uri; } navigate_javascript_task_t; static void navigate_javascript_proc(task_t *_task) { navigate_javascript_task_t *task = (navigate_javascript_task_t*)_task; - HTMLWindow *window = task->window; + HTMLOuterWindow *window = task->window; VARIANT v; BSTR code; HRESULT hres; @@ -1830,7 +1830,7 @@ static void navigate_javascript_task_destr(task_t *_task) typedef struct { task_t header; - HTMLWindow *window; + HTMLOuterWindow *window; nsChannelBSC *bscallback; IMoniker *mon; } navigate_task_t; @@ -1854,7 +1854,7 @@ static void navigate_task_destr(task_t *_task) heap_free(task); } -static HRESULT navigate_fragment(HTMLWindow *window, IUri *uri) +static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) { nsIDOMLocation *nslocation; nsAString nsfrag_str; @@ -1885,15 +1885,15 @@ static HRESULT navigate_fragment(HTMLWindow *window, IUri *uri) } if(window->doc_obj->doc_object_service) { - IDocObjectService_FireNavigateComplete2(window->doc_obj->doc_object_service, &window->IHTMLWindow2_iface, 0x10); - IDocObjectService_FireDocumentComplete(window->doc_obj->doc_object_service, &window->IHTMLWindow2_iface, 0); + IDocObjectService_FireNavigateComplete2(window->doc_obj->doc_object_service, &window->base.IHTMLWindow2_iface, 0x10); + IDocObjectService_FireDocumentComplete(window->doc_obj->doc_object_service, &window->base.IHTMLWindow2_iface, 0); } return S_OK; } -HRESULT super_navigate(HTMLWindow *window, IUri *uri, const WCHAR *headers, BYTE *post_data, DWORD post_data_size) +HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, const WCHAR *headers, BYTE *post_data, DWORD post_data_size) { nsChannelBSC *bsc; IMoniker *mon; @@ -1986,7 +1986,7 @@ HRESULT super_navigate(HTMLWindow *window, IUri *uri, const WCHAR *headers, BYTE return S_OK; } -HRESULT navigate_new_window(HTMLWindow *window, IUri *uri, const WCHAR *name, IHTMLWindow2 **ret) +HRESULT navigate_new_window(HTMLOuterWindow *window, IUri *uri, const WCHAR *name, IHTMLWindow2 **ret) { IWebBrowser2 *web_browser; IHTMLWindow2 *new_window; @@ -2096,7 +2096,7 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, nsChannel *nschanne return hres; } -HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url) +HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, const WCHAR *base_url) { WCHAR url[INTERNET_MAX_URL_LENGTH]; nsWineURI *uri; diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c index 435933a8790..ff599ef48c0 100644 --- a/dlls/mshtml/npplugin.c +++ b/dlls/mshtml/npplugin.c @@ -234,11 +234,11 @@ static nsIDOMElement *get_dom_element(NPP instance) return elem; } -static HTMLWindow *get_elem_window(nsIDOMElement *elem) +static HTMLOuterWindow *get_elem_window(nsIDOMElement *elem) { nsIDOMWindow *nswindow; nsIDOMDocument *nsdoc; - HTMLWindow *window; + HTMLOuterWindow *window; nsresult nsres; nsres = nsIDOMElement_GetOwnerDocument(elem, &nsdoc); @@ -313,7 +313,7 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid) return ret; } -static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem, CLSID *clsid) +static IUnknown *create_activex_object(HTMLOuterWindow *window, nsIDOMElement *nselem, CLSID *clsid) { IClassFactoryEx *cfex; IClassFactory *cf; @@ -357,7 +357,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I char **argv, NPSavedData *saved) { nsIDOMElement *nselem; - HTMLWindow *window; + HTMLOuterWindow *window; IUnknown *obj; CLSID clsid; NPError err = NPERR_NO_ERROR; diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 542b8c735ca..56d43847d94 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -259,7 +259,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event if(doc_obj && doc_obj->usermode!=EDITMODE && doc_obj->doc_object_service) IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service, - &doc->basedoc.window->IHTMLWindow2_iface, 0); + &doc->basedoc.window->base.IHTMLWindow2_iface, 0); if(!doc->nsdoc) { ERR("NULL nsdoc\n"); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 2b41f0ddbd5..312d4053d07 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -139,7 +139,7 @@ BOOL compare_ignoring_frag(IUri *uri1, IUri *uri2) return ret; } -static nsresult create_nsuri(IUri*,HTMLWindow*,NSContainer*,nsWineURI**); +static nsresult create_nsuri(IUri*,HTMLOuterWindow*,NSContainer*,nsWineURI**); static const char *debugstr_nsacstr(const nsACString *nsstr) { @@ -264,7 +264,7 @@ static nsresult before_async_open(nsChannel *channel, NSContainer *container, BO return NS_OK; } -HRESULT load_nsuri(HTMLWindow *window, nsWineURI *uri, nsChannelBSC *channelbsc, DWORD flags) +HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsChannelBSC *channelbsc, DWORD flags) { nsIWebNavigation *web_navigation; nsIDocShell *doc_shell; @@ -314,7 +314,7 @@ static void set_uri_nscontainer(nsWineURI *This, NSContainer *nscontainer) This->container = nscontainer; } -static void set_uri_window(nsWineURI *This, HTMLWindow *window) +static void set_uri_window(nsWineURI *This, HTMLOuterWindow *window) { if(This->window_ref) { if(This->window_ref->window == window) @@ -874,9 +874,9 @@ static nsresult NSAPI nsChannel_Open(nsIHttpChannel *iface, nsIInputStream **_re return NS_ERROR_NOT_IMPLEMENTED; } -static HTMLWindow *get_window_from_load_group(nsChannel *This) +static HTMLOuterWindow *get_window_from_load_group(nsChannel *This) { - HTMLWindow *window; + HTMLOuterWindow *window; nsIChannel *channel; nsIRequest *req; nsWineURI *wine_uri; @@ -915,17 +915,17 @@ static HTMLWindow *get_window_from_load_group(nsChannel *This) window = wine_uri->window_ref ? wine_uri->window_ref->window : NULL; if(window) - IHTMLWindow2_AddRef(&window->IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); nsIURI_Release(&wine_uri->nsIURL_iface); return window; } -static HTMLWindow *get_channel_window(nsChannel *This) +static HTMLOuterWindow *get_channel_window(nsChannel *This) { nsIWebProgress *web_progress; nsIDOMWindow *nswindow; - HTMLWindow *window; + HTMLOuterWindow *window; nsresult nsres; if(This->load_group) { @@ -965,7 +965,7 @@ static HTMLWindow *get_channel_window(nsChannel *This) nsIDOMWindow_Release(nswindow); if(window) - IHTMLWindow2_AddRef(&window->IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); else FIXME("NULL window for %p\n", nswindow); return window; @@ -992,7 +992,7 @@ static void start_binding_task_destr(task_t *_task) heap_free(task); } -static nsresult async_open(nsChannel *This, HTMLWindow *window, BOOL is_doc_channel, nsIStreamListener *listener, +static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, nsIStreamListener *listener, nsISupports *context) { nsChannelBSC *bscallback; @@ -1034,7 +1034,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen nsISupports *aContext) { nsChannel *This = impl_from_nsIHttpChannel(iface); - HTMLWindow *window = NULL; + HTMLOuterWindow *window = NULL; BOOL cancel = FALSE; nsresult nsres = NS_OK; @@ -1073,7 +1073,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen if(!window) { if(This->uri->window_ref && This->uri->window_ref->window) { window = This->uri->window_ref->window; - IHTMLWindow2_AddRef(&window->IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); }else { /* FIXME: Analyze removing get_window_from_load_group call */ if(This->load_group) @@ -1119,7 +1119,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen ERR("AddRequest failed: %08x\n", nsres); } - IHTMLWindow2_Release(&window->IHTMLWindow2_iface); + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); return nsres; } @@ -2823,7 +2823,7 @@ static const nsIStandardURLVtbl nsStandardURLVtbl = { nsStandardURL_Init }; -static nsresult create_nsuri(IUri *iuri, HTMLWindow *window, NSContainer *container, nsWineURI **_retval) +static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, NSContainer *container, nsWineURI **_retval) { nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI)); @@ -2843,7 +2843,7 @@ static nsresult create_nsuri(IUri *iuri, HTMLWindow *window, NSContainer *contai return NS_OK; } -HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsWineURI **ret) +HRESULT create_doc_uri(HTMLOuterWindow *window, WCHAR *url, nsWineURI **ret) { nsWineURI *uri; IUri *iuri; @@ -2898,7 +2898,7 @@ static nsresult create_nschannel(nsWineURI *uri, nsChannel **ret) HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsChannel **ret) { - HTMLWindow *window = NULL; + HTMLOuterWindow *window = NULL; nsChannel *channel; nsWineURI *uri; IUri *iuri; @@ -3183,7 +3183,7 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString * { nsWineURI *wine_uri, *base_wine_uri = NULL; WCHAR new_spec[INTERNET_MAX_URL_LENGTH]; - HTMLWindow *window = NULL; + HTMLOuterWindow *window = NULL; const char *spec = NULL; IUri *urlmon_uri; nsresult nsres; diff --git a/dlls/mshtml/nsservice.c b/dlls/mshtml/nsservice.c index dd6fb22d54b..141ece190b1 100644 --- a/dlls/mshtml/nsservice.c +++ b/dlls/mshtml/nsservice.c @@ -77,7 +77,7 @@ static nsrefcnt NSAPI nsPromptService_Release(nsIPromptService *iface) static nsresult NSAPI nsPromptService_Alert(nsIPromptService *iface, nsIDOMWindow *aParent, const PRUnichar *aDialogTitle, const PRUnichar *aText) { - HTMLWindow *window; + HTMLOuterWindow *window; BSTR text; TRACE("(%p %s %s)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText)); @@ -89,7 +89,7 @@ static nsresult NSAPI nsPromptService_Alert(nsIPromptService *iface, nsIDOMWindo } text = SysAllocString(aText); - IHTMLWindow2_alert(&window->IHTMLWindow2_iface, text); + IHTMLWindow2_alert(&window->base.IHTMLWindow2_iface, text); SysFreeString(text); return NS_OK; diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 3acd5622aa9..9d206278516 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -325,7 +325,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite IWebBrowser2 *wb; V_VT(&var) = VT_UNKNOWN; - V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface; + V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface; IOleCommandTarget_Exec(cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0, &var, NULL); hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser, diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 5ad6104c04f..226e26c37be 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -54,7 +54,7 @@ typedef struct { LPOLESTR url; } download_proc_task_t; -static BOOL use_gecko_script(HTMLWindow *window) +static BOOL use_gecko_script(HTMLOuterWindow *window) { DWORD zone; HRESULT hres; @@ -98,7 +98,7 @@ static void notify_travellog_update(HTMLDocumentObj *doc) } } -void set_current_uri(HTMLWindow *window, IUri *uri) +void set_current_uri(HTMLOuterWindow *window, IUri *uri) { if(window->uri) { IUri_Release(window->uri); @@ -117,7 +117,7 @@ void set_current_uri(HTMLWindow *window, IUri *uri) IUri_GetDisplayUri(uri, &window->url); } -void set_current_mon(HTMLWindow *This, IMoniker *mon) +void set_current_mon(HTMLOuterWindow *This, IMoniker *mon) { IUriContainer *uri_container; IUri *uri = NULL; @@ -171,7 +171,7 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon) set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); } -HRESULT create_relative_uri(HTMLWindow *window, const WCHAR *rel_uri, IUri **uri) +HRESULT create_relative_uri(HTMLOuterWindow *window, const WCHAR *rel_uri, IUri **uri) { return window->uri ? CoInternetCombineUrlEx(window->uri, rel_uri, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, uri, 0) @@ -325,7 +325,7 @@ void prepare_for_binding(HTMLDocument *This, IMoniker *mon, BOOL navigated_bindi IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); }else { V_VT(&var) = VT_UNKNOWN; - V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface; + V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface; V_VT(&out) = VT_EMPTY; hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out); if(SUCCEEDED(hres)) @@ -399,7 +399,7 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannel return S_OK; } -void set_ready_state(HTMLWindow *window, READYSTATE readystate) +void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate) { window->readystate = readystate; diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index fcb080c31f7..2a85376a566 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -1216,7 +1216,7 @@ static HRESULT WINAPI PHServiceProvider_QueryService(IServiceProvider *iface, RE return E_NOINTERFACE; } - return IServiceProvider_QueryService(&This->doc->basedoc.window->IServiceProvider_iface, + return IServiceProvider_QueryService(&This->doc->basedoc.window->base.IServiceProvider_iface, guidService, riid, ppv); } diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 25ae0b676f1..a62d20a227c 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -66,7 +66,7 @@ struct ScriptHost { SCRIPTSTATE script_state; - HTMLWindow *window; + HTMLOuterWindow *window; GUID guid; struct list entry; @@ -211,7 +211,7 @@ static void release_script_engine(ScriptHost *This) This->script_state = SCRIPTSTATE_UNINITIALIZED; } -void connect_scripts(HTMLWindow *window) +void connect_scripts(HTMLOuterWindow *window) { ScriptHost *iter; @@ -320,7 +320,7 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC return E_FAIL; /* FIXME: Return proxy object */ - *ppiunkItem = (IUnknown*)&This->window->IHTMLWindow2_iface; + *ppiunkItem = (IUnknown*)&This->window->base.IHTMLWindow2_iface; IUnknown_AddRef(*ppiunkItem); return S_OK; @@ -591,7 +591,7 @@ static const IServiceProviderVtbl ASServiceProviderVtbl = { ASServiceProvider_QueryService }; -static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid) +static ScriptHost *create_script_host(HTMLOuterWindow *window, const GUID *guid) { ScriptHost *ret; HRESULT hres; @@ -796,7 +796,7 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid) return ret; } -static ScriptHost *get_script_host(HTMLWindow *window, const GUID *guid) +static ScriptHost *get_script_host(HTMLOuterWindow *window, const GUID *guid) { ScriptHost *iter; @@ -808,7 +808,7 @@ static ScriptHost *get_script_host(HTMLWindow *window, const GUID *guid) return create_script_host(window, guid); } -void doc_insert_script(HTMLWindow *window, nsIDOMHTMLScriptElement *nsscript) +void doc_insert_script(HTMLOuterWindow *window, nsIDOMHTMLScriptElement *nsscript) { ScriptHost *script_host; GUID guid; @@ -831,7 +831,7 @@ void doc_insert_script(HTMLWindow *window, nsIDOMHTMLScriptElement *nsscript) parse_script_elem(script_host, nsscript); } -IDispatch *script_parse_event(HTMLWindow *window, LPCWSTR text) +IDispatch *script_parse_event(HTMLOuterWindow *window, LPCWSTR text) { ScriptHost *script_host; GUID guid = CLSID_JScript; @@ -885,7 +885,7 @@ IDispatch *script_parse_event(HTMLWindow *window, LPCWSTR text) return disp; } -HRESULT exec_script(HTMLWindow *window, const WCHAR *code, const WCHAR *lang, VARIANT *ret) +HRESULT exec_script(HTMLOuterWindow *window, const WCHAR *code, const WCHAR *lang, VARIANT *ret) { ScriptHost *script_host; EXCEPINFO ei; @@ -936,7 +936,7 @@ IDispatch *get_script_disp(ScriptHost *script_host) return disp; } -BOOL find_global_prop(HTMLWindow *window, BSTR name, DWORD flags, ScriptHost **ret_host, DISPID *ret_id) +BOOL find_global_prop(HTMLOuterWindow *window, BSTR name, DWORD flags, ScriptHost **ret_host, DISPID *ret_id) { IDispatchEx *dispex; IDispatch *disp; @@ -987,7 +987,7 @@ static BOOL is_jscript_available(void) return available; } -void set_script_mode(HTMLWindow *window, SCRIPTMODE mode) +void set_script_mode(HTMLOuterWindow *window, SCRIPTMODE mode) { nsIWebBrowserSetup *setup; nsresult nsres; @@ -1015,7 +1015,7 @@ void set_script_mode(HTMLWindow *window, SCRIPTMODE mode) ERR("JavaScript setup failed: %08x\n", nsres); } -void release_script_hosts(HTMLWindow *window) +void release_script_hosts(HTMLOuterWindow *window) { ScriptHost *iter;