Jacek Caban (@jacek) commented about dlls/mshtml/htmlevent.c:
+static event_type_t get_non_gecko_event_type(const WCHAR *type) +{ + /* Keep these sorted by their string from event_types[] */ + static const event_type_t list[] = { + EVENT_TYPE_MESSAGE, + EVENT_TYPE_STORAGE, + }; + unsigned i; + + for(i = 0; i < ARRAY_SIZE(list); i++) + if(!wcsicmp(type, event_types[list[i]])) + return list[i]; + + return EVENT_TYPE_EVENT; +}
You could just iterate over event_types, there is no need to special-case anything here. We could also move querying nsIDOMEvent interfaces from alloc_event() to create_event_from_nsevent() and just depend on properly passed event type to alloc_event(). We could then get rid of even more special-casing in alloc_event(). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/856#note_9015