mshtml: Keep reference to document node in onload event handler.

This commit is contained in:
Jacek Caban 2013-05-15 12:52:52 +02:00 committed by Alexandre Julliard
parent 3a1ce6a864
commit 503032749b
1 changed files with 13 additions and 9 deletions

View File

@ -235,6 +235,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
HTMLDocumentNode *doc = This->This->doc;
nsIDOMHTMLElement *nsbody = NULL;
HTMLDocumentObj *doc_obj = NULL;
nsresult nsres = NS_OK;
TRACE("(%p)\n", doc);
@ -245,6 +246,8 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
connect_scripts(doc->window);
htmldoc_addref(&doc->basedoc);
if(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,
&doc->basedoc.window->base.IHTMLWindow2_iface, 0);
if(!doc->nsdoc) {
if(doc->nsdoc) {
nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
if(nsbody) {
fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event, (IDispatch*)&doc->window->base.IDispatchEx_iface);
nsIDOMHTMLElement_Release(nsbody);
}
}else {
ERR("NULL nsdoc\n");
return NS_ERROR_FAILURE;
nsres = NS_ERROR_FAILURE;
}
nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
if(nsbody) {
fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event, (IDispatch*)&doc->window->base.IDispatchEx_iface);
nsIDOMHTMLElement_Release(nsbody);
}
return NS_OK;
htmldoc_release(&doc->basedoc);
return nsres;
}
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *event)