mshtml: Always alloc event_vector for documents.

This commit is contained in:
Jacek Caban 2011-08-02 11:08:32 +02:00 committed by Alexandre Julliard
parent be6dd66edf
commit 2610ef9c9c
3 changed files with 12 additions and 8 deletions

View File

@ -2164,8 +2164,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLWindow *wi
&doc->node.dispex.IDispatchEx_iface);
HTMLDocumentNode_SecMgr_Init(doc);
init_nsevents(doc);
list_init(&doc->bindings);
list_init(&doc->selection_list);
list_init(&doc->range_list);
@ -2188,6 +2186,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
nsIDOMHTMLDocument_AddRef(nsdoc);
doc->nsdoc = nsdoc;
init_document_mutation(doc);
doc_init_events(doc);
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
doc->node.vtbl = &HTMLDocumentNodeImplVtbl;

View File

@ -1182,12 +1182,6 @@ static HRESULT ensure_nsevent_handler(HTMLDocumentNode *doc, event_target_t *eve
if(!(event_info[eid].flags & EVENT_DEFAULTLISTENER))
return S_OK;
if(!doc->event_vector) {
doc->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!doc->event_vector)
return E_OUTOFMEMORY;
}
if(!doc->event_vector[eid]) {
doc->event_vector[eid] = TRUE;
add_nsevent_listener(doc, NULL, event_info[eid].name);
@ -1375,6 +1369,16 @@ void check_event_attr(HTMLDocumentNode *doc, nsIDOMElement *nselem)
nsAString_Finish(&attr_name_str);
}
HRESULT doc_init_events(HTMLDocumentNode *doc)
{
doc->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!doc->event_vector)
return E_OUTOFMEMORY;
init_nsevents(doc);
return S_OK;
}
void release_event_target(event_target_t *event_target)
{
int i, j;

View File

@ -53,6 +53,7 @@ HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HID
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
void update_cp_events(HTMLWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;