From: Gabriel Ivăncescu gabrielopcode@gmail.com
We don't use Gecko for these events, so we have to handle them ourselves.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 44 +++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 1ee8ce3db34..219152430a1 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -240,6 +240,28 @@ static eventid_t attr_to_eid(const WCHAR *str) return EVENTID_LAST; }
+static BOOL is_non_gecko_event_type(const WCHAR *type, eventid_t *event_id) +{ + /* Keep this in same order as the eventid_t enum */ + static const eventid_t list[] = { + EVENTID_MESSAGE, + EVENTID_STORAGE, + }; + unsigned i; + + for(i = 0; i < ARRAY_SIZE(list); i++) { + unsigned len = wcslen(event_info[list[i]].name); + if(!wcsnicmp(type, event_info[list[i]].name, len)) { + if(!wcsicmp(type + len, L"Event")) { + *event_id = list[i]; + return TRUE; + } + break; + } + } + return FALSE; +} + const WCHAR *get_event_name(eventid_t eid) { return event_info[eid].name; @@ -3063,7 +3085,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM nsAString nsstr; nsresult nsres;
- nsAString_InitDepend(&nsstr, type); + nsAString_InitDepend(&nsstr, is_non_gecko_event_type(type, &event_id) ? L"Event" : type); nsres = nsIDOMHTMLDocument_CreateEvent(doc->nsdoc, &nsstr, &nsevent); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { @@ -3071,16 +3093,18 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM return E_FAIL; }
- nsAString_Init(&nsstr, NULL); - nsres = nsIDOMEvent_GetType(nsevent, &nsstr); - if(NS_SUCCEEDED(nsres)) { - const WCHAR *t; - nsAString_GetData(&nsstr, &t); - event_id = str_to_eid(t); - if(event_id == EVENTID_LAST) - FIXME("unknown event type %s\n", debugstr_w(t)); + if(event_id == EVENTID_LAST) { + nsAString_Init(&nsstr, NULL); + nsres = nsIDOMEvent_GetType(nsevent, &nsstr); + if(NS_SUCCEEDED(nsres)) { + const WCHAR *t; + nsAString_GetData(&nsstr, &t); + event_id = str_to_eid(t); + if(event_id == EVENTID_LAST) + FIXME("unknown event type %s\n", debugstr_w(t)); + } + nsAString_Finish(&nsstr); } - nsAString_Finish(&nsstr);
event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), event_id); nsIDOMEvent_Release(nsevent);