Commit 917ec2db authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Store minimum compat mode required for events in the ctor table.

Since such event types don't exist as separate event types in older modes, this prevents confusing leaks without bloating the constructors with more boilerplate. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 1544be25
...@@ -3122,9 +3122,6 @@ static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_ ...@@ -3122,9 +3122,6 @@ static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_
{ {
DOMProgressEvent *progress_event; DOMProgressEvent *progress_event;
if(compat_mode < COMPAT_MODE_IE10)
return event_ctor(sizeof(DOMEvent), &DOMEvent_dispex, NULL, NULL, nsevent, event_id, compat_mode);
if(!(progress_event = event_ctor(sizeof(DOMProgressEvent), &DOMProgressEvent_dispex, if(!(progress_event = event_ctor(sizeof(DOMProgressEvent), &DOMProgressEvent_dispex,
DOMProgressEvent_query_interface, DOMProgressEvent_destroy, nsevent, event_id, compat_mode))) DOMProgressEvent_query_interface, DOMProgressEvent_destroy, nsevent, event_id, compat_mode)))
return NULL; return NULL;
...@@ -3154,6 +3151,7 @@ static DOMEvent *storage_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t ...@@ -3154,6 +3151,7 @@ static DOMEvent *storage_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t
static const struct { static const struct {
REFIID iid; REFIID iid;
DOMEvent *(*ctor)(void *iface, nsIDOMEvent *nsevent, eventid_t, compat_mode_t); DOMEvent *(*ctor)(void *iface, nsIDOMEvent *nsevent, eventid_t, compat_mode_t);
compat_mode_t min_compat_mode;
} event_types_ctor_table[] = { } event_types_ctor_table[] = {
[EVENT_TYPE_EVENT] = { NULL, generic_event_ctor }, [EVENT_TYPE_EVENT] = { NULL, generic_event_ctor },
[EVENT_TYPE_UIEVENT] = { &IID_nsIDOMUIEvent, ui_event_ctor }, [EVENT_TYPE_UIEVENT] = { &IID_nsIDOMUIEvent, ui_event_ctor },
...@@ -3164,7 +3162,7 @@ static const struct { ...@@ -3164,7 +3162,7 @@ static const struct {
[EVENT_TYPE_DRAG] = { NULL, generic_event_ctor }, [EVENT_TYPE_DRAG] = { NULL, generic_event_ctor },
[EVENT_TYPE_PAGETRANSITION] = { NULL, page_transition_event_ctor }, [EVENT_TYPE_PAGETRANSITION] = { NULL, page_transition_event_ctor },
[EVENT_TYPE_CUSTOM] = { &IID_nsIDOMCustomEvent, custom_event_ctor }, [EVENT_TYPE_CUSTOM] = { &IID_nsIDOMCustomEvent, custom_event_ctor },
[EVENT_TYPE_PROGRESS] = { &IID_nsIDOMProgressEvent, progress_event_ctor }, [EVENT_TYPE_PROGRESS] = { &IID_nsIDOMProgressEvent, progress_event_ctor, COMPAT_MODE_IE10 },
[EVENT_TYPE_MESSAGE] = { NULL, message_event_ctor }, [EVENT_TYPE_MESSAGE] = { NULL, message_event_ctor },
[EVENT_TYPE_STORAGE] = { NULL, storage_event_ctor }, [EVENT_TYPE_STORAGE] = { NULL, storage_event_ctor },
}; };
...@@ -3175,6 +3173,9 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev ...@@ -3175,6 +3173,9 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev
void *iface = NULL; void *iface = NULL;
DOMEvent *event; DOMEvent *event;
if(compat_mode < event_types_ctor_table[event_type].min_compat_mode)
event_type = EVENT_TYPE_EVENT;
if(event_types_ctor_table[event_type].iid) if(event_types_ctor_table[event_type].iid)
nsIDOMEvent_QueryInterface(nsevent, event_types_ctor_table[event_type].iid, &iface); nsIDOMEvent_QueryInterface(nsevent, event_types_ctor_table[event_type].iid, &iface);
......
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