mshtml: Keep reference to document node in onload event handler.
This commit is contained in:
parent
3a1ce6a864
commit
503032749b
|
@ -235,6 +235,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
||||||
HTMLDocumentNode *doc = This->This->doc;
|
HTMLDocumentNode *doc = This->This->doc;
|
||||||
nsIDOMHTMLElement *nsbody = NULL;
|
nsIDOMHTMLElement *nsbody = NULL;
|
||||||
HTMLDocumentObj *doc_obj = NULL;
|
HTMLDocumentObj *doc_obj = NULL;
|
||||||
|
nsresult nsres = NS_OK;
|
||||||
|
|
||||||
TRACE("(%p)\n", doc);
|
TRACE("(%p)\n", doc);
|
||||||
|
|
||||||
|
@ -245,6 +246,8 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
||||||
|
|
||||||
connect_scripts(doc->window);
|
connect_scripts(doc->window);
|
||||||
|
|
||||||
|
htmldoc_addref(&doc->basedoc);
|
||||||
|
|
||||||
if(doc_obj)
|
if(doc_obj)
|
||||||
handle_docobj_load(doc_obj);
|
handle_docobj_load(doc_obj);
|
||||||
|
|
||||||
|
@ -264,18 +267,19 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
|
||||||
IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service,
|
IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service,
|
||||||
&doc->basedoc.window->base.IHTMLWindow2_iface, 0);
|
&doc->basedoc.window->base.IHTMLWindow2_iface, 0);
|
||||||
|
|
||||||
if(!doc->nsdoc) {
|
if(doc->nsdoc) {
|
||||||
ERR("NULL nsdoc\n");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
|
nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
|
||||||
if(nsbody) {
|
if(nsbody) {
|
||||||
fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event, (IDispatch*)&doc->window->base.IDispatchEx_iface);
|
fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event, (IDispatch*)&doc->window->base.IDispatchEx_iface);
|
||||||
nsIDOMHTMLElement_Release(nsbody);
|
nsIDOMHTMLElement_Release(nsbody);
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
ERR("NULL nsdoc\n");
|
||||||
|
nsres = NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
htmldoc_release(&doc->basedoc);
|
||||||
|
return nsres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *event)
|
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *event)
|
||||||
|
|
Loading…
Reference in New Issue