mshtml: Associate HTMLWindow with HTMLIFrame.

This commit is contained in:
Jacek Caban 2009-11-01 19:19:19 +01:00 committed by Alexandre Julliard
parent bdb9270705
commit 9d6af171e5
3 changed files with 25 additions and 9 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;