Commit 9d6af171 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Associate HTMLWindow with HTMLIFrame.

parent bdb92707
......@@ -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;
}
......@@ -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;
......
......@@ -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,9 +259,13 @@ 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))
if(SUCCEEDED(hres)) {
if(ret)
*ret = window;
else
IHTMLWindow2_Release(HTMLWINDOW2(window));
}
}
nsIDOMWindow_Release(nswindow);
return NS_OK;
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment