Commit 50303274 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 3a1ce6a8
......@@ -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)
......
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