diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c index 83817be3357..b1d53e3ad93 100644 --- a/dlls/mshtml/htmlframebase.c +++ b/dlls/mshtml/htmlframebase.c @@ -257,8 +257,10 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv) void HTMLFrameBase_destructor(HTMLFrameBase *This) { - if(This->content_window) + if(This->content_window) { + This->content_window->frame_element = NULL; IHTMLWindow2_Release(HTMLWINDOW2(This->content_window)); + } HTMLElement_destructor(&This->element.node); } @@ -270,7 +272,9 @@ void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLEl HTMLElement_Init(&This->element, doc, nselem, dispex_data); - if(content_window) + if(content_window) { IHTMLWindow2_AddRef(HTMLWINDOW2(content_window)); + content_window->frame_element = This; + } This->content_window = content_window; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 340fefe51c6..570f0b11c82 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -159,6 +159,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); typedef struct HTMLDocumentNode HTMLDocumentNode; typedef struct HTMLDocumentObj HTMLDocumentObj; +typedef struct HTMLFrameBase HTMLFrameBase; typedef enum { SCRIPTMODE_GECKO, @@ -219,6 +220,7 @@ struct HTMLWindow { HTMLDocumentObj *doc_obj; nsIDOMWindow *nswindow; HTMLWindow *parent; + HTMLFrameBase *frame_element; nsChannelBSC *bscallback; IMoniker *mon; @@ -460,13 +462,13 @@ typedef struct { ConnectionPoint cp; } HTMLTextContainer; -typedef struct { +struct HTMLFrameBase { HTMLElement element; const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl; HTMLWindow *content_window; -} HTMLFrameBase; +}; typedef struct _mutation_queue_t { DWORD type; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 4999e266285..edcbbd7706e 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -246,7 +246,7 @@ static void pop_mutation_queue(HTMLDocumentNode *doc) heap_free(tmp); } -static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc) +static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc, HTMLWindow **ret) { nsIDOMWindow *nswindow; @@ -259,8 +259,12 @@ static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc) HRESULT hres; hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window); - if(SUCCEEDED(hres)) - IHTMLWindow2_Release(HTMLWINDOW2(window)); + if(SUCCEEDED(hres)) { + if(ret) + *ret = window; + else + IHTMLWindow2_Release(HTMLWINDOW2(window)); + } } nsIDOMWindow_Release(nswindow); @@ -270,6 +274,7 @@ static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc) static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk) { nsIDOMHTMLIFrameElement *nsiframe; + HTMLWindow *window = NULL; nsIDOMDocument *nsdoc; nsresult nsres; @@ -286,7 +291,12 @@ static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk) return nsres; } - nsres = init_nsdoc_window(doc, nsdoc); + nsres = init_nsdoc_window(doc, nsdoc, &window); + + if(window) { + HTMLIFrame_Create(doc, (nsIDOMHTMLElement*)nsiframe, window); + IHTMLWindow2_Release(HTMLWINDOW2(window)); + } nsIDOMDocument_Release(nsdoc); return nsres; @@ -311,7 +321,7 @@ static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk) return nsres; } - nsres = init_nsdoc_window(doc, nsdoc); + nsres = init_nsdoc_window(doc, nsdoc, NULL); nsIDOMDocument_Release(nsdoc); return nsres;