diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h index a995eb1cb445..20c225506275 100644 --- a/dom/events/EventNameList.h +++ b/dom/events/EventNameList.h @@ -172,6 +172,10 @@ EVENT(click, eMouseClick, EventNameType_All, eMouseEventClass) +EVENT(close, + eClose, + EventNameType_HTML, + eBasicEventClass) EVENT(contextmenu, eContextMenu, EventNameType_HTMLXUL, @@ -1090,4 +1094,3 @@ NON_IDL_EVENT(complete, #undef DOCUMENT_ONLY_EVENT #undef NON_IDL_EVENT #endif /* MESSAGE_TO_EVENT */ - diff --git a/dom/html/HTMLDialogElement.cpp b/dom/html/HTMLDialogElement.cpp index 1f796f9a6c8f..1f65b602f211 100644 --- a/dom/html/HTMLDialogElement.cpp +++ b/dom/html/HTMLDialogElement.cpp @@ -30,6 +30,9 @@ HTMLDialogElement::Close(const mozilla::dom::Optional& aReturnValue) ErrorResult ignored; SetOpen(false, ignored); ignored.SuppressException(); + RefPtr eventDispatcher = + new AsyncEventDispatcher(this, NS_LITERAL_STRING("close"), false); + eventDispatcher->PostDOMEvent(); } void diff --git a/dom/html/HTMLDialogElement.h b/dom/html/HTMLDialogElement.h index 7abaee81ca0b..2222cd2f7cda 100644 --- a/dom/html/HTMLDialogElement.h +++ b/dom/html/HTMLDialogElement.h @@ -7,6 +7,7 @@ #ifndef HTMLDialogElement_h #define HTMLDialogElement_h +#include "mozilla/AsyncEventDispatcher.h" #include "mozilla/Attributes.h" #include "nsGenericHTMLElement.h" #include "nsGkAtoms.h" diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 3949f80d0aab..971680abdaf0 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -38,7 +38,7 @@ interface GlobalEventHandlers { attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; - //(Not implemented)attribute EventHandler onclose; + attribute EventHandler onclose; attribute EventHandler oncontextmenu; //(Not implemented)attribute EventHandler oncuechange; attribute EventHandler ondblclick; diff --git a/widget/EventMessageList.h b/widget/EventMessageList.h index d3bff56380fc..4dbcd281a7f0 100644 --- a/widget/EventMessageList.h +++ b/widget/EventMessageList.h @@ -442,6 +442,9 @@ NS_EVENT_MESSAGE(eSelectionChange) // Details element events. NS_EVENT_MESSAGE(eToggle) +// Dialog element events. +NS_EVENT_MESSAGE(eClose) + #ifdef UNDEF_NS_EVENT_MESSAGE_FIRST_LAST #undef UNDEF_NS_EVENT_MESSAGE_FIRST_LAST #undef NS_EVENT_MESSAGE_FIRST_LAST