mshtml: Don't share nsframe and nsiframe reference with nsnode.

This commit is contained in:
Jacek Caban 2014-09-24 16:05:25 +02:00 committed by Alexandre Julliard
parent 5f149f52d1
commit 727c1ceb1e
3 changed files with 47 additions and 6 deletions

View File

@ -266,6 +266,26 @@ static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
return hres; return hres;
} }
static void HTMLFrameElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
if(This->framebase.nsframe)
note_cc_edge((nsISupports*)This->framebase.nsframe, "This->nsframe", cb);
}
static void HTMLFrameElement_unlink(HTMLDOMNode *iface)
{
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
if(This->framebase.nsframe) {
nsIDOMHTMLFrameElement *nsframe = This->framebase.nsframe;
This->framebase.nsframe = NULL;
nsIDOMHTMLFrameElement_Release(nsframe);
}
}
static const NodeImplVtbl HTMLFrameElementImplVtbl = { static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI, HTMLFrameElement_QI,
HTMLFrameElement_destructor, HTMLFrameElement_destructor,
@ -281,7 +301,9 @@ static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_get_readystate, HTMLFrameElement_get_readystate,
HTMLFrameElement_get_dispid, HTMLFrameElement_get_dispid,
HTMLFrameElement_invoke, HTMLFrameElement_invoke,
HTMLFrameElement_bind_to_tree HTMLFrameElement_bind_to_tree,
HTMLFrameElement_traverse,
HTMLFrameElement_unlink
}; };
static const tid_t HTMLFrameElement_iface_tids[] = { static const tid_t HTMLFrameElement_iface_tids[] = {

View File

@ -707,12 +707,9 @@ void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLEl
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
This->nsframe = NULL; This->nsframe = NULL;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode); assert(nsres == NS_OK);
}else { }else {
assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode); assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
This->nsiframe = NULL; This->nsiframe = NULL;
} }
/* Share the reference with nsnode */
nsIDOMNode_Release(This->element.node.nsnode);
} }

View File

@ -539,6 +539,26 @@ static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
return hres; return hres;
} }
static void HTMLIFrame_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
if(This->framebase.nsiframe)
note_cc_edge((nsISupports*)This->framebase.nsiframe, "This->nsiframe", cb);
}
static void HTMLIFrame_unlink(HTMLDOMNode *iface)
{
HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
if(This->framebase.nsiframe) {
nsIDOMHTMLIFrameElement *nsiframe = This->framebase.nsiframe;
This->framebase.nsiframe = NULL;
nsIDOMHTMLIFrameElement_Release(nsiframe);
}
}
static const NodeImplVtbl HTMLIFrameImplVtbl = { static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_QI, HTMLIFrame_QI,
HTMLIFrame_destructor, HTMLIFrame_destructor,
@ -554,7 +574,9 @@ static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_get_readystate, HTMLIFrame_get_readystate,
HTMLIFrame_get_dispid, HTMLIFrame_get_dispid,
HTMLIFrame_invoke, HTMLIFrame_invoke,
HTMLIFrame_bind_to_tree HTMLIFrame_bind_to_tree,
HTMLIFrame_traverse,
HTMLIFrame_unlink
}; };
static const tid_t HTMLIFrame_iface_tids[] = { static const tid_t HTMLIFrame_iface_tids[] = {