diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-07 08:27:34 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-07 18:33:23 -0500 |
commit | ef2cd8749ff41c3d87a19b598d8d3be1430b75bf (patch) | |
tree | 3fda50cfd9bebaa0d02d8257a2eee18c8b636e2b | |
parent | 2e3b937f4ee13e70584c881e0c65200e439ff7fa (diff) | |
download | uxp-ef2cd8749ff41c3d87a19b598d8d3be1430b75bf.tar.gz |
Bug 1322938 - Emit close event when HTMLDialogElement.prototype.close() is called.
Tag #1343
-rw-r--r-- | dom/events/EventNameList.h | 4 | ||||
-rw-r--r-- | dom/html/HTMLDialogElement.cpp | 3 | ||||
-rw-r--r-- | dom/html/HTMLDialogElement.h | 1 | ||||
-rw-r--r-- | dom/webidl/EventHandler.webidl | 2 | ||||
-rw-r--r-- | widget/EventMessageList.h | 3 |
5 files changed, 12 insertions, 1 deletions
diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h index 214b844e7d..c299133e39 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, diff --git a/dom/html/HTMLDialogElement.cpp b/dom/html/HTMLDialogElement.cpp index 1f796f9a6c..1f65b602f2 100644 --- a/dom/html/HTMLDialogElement.cpp +++ b/dom/html/HTMLDialogElement.cpp @@ -30,6 +30,9 @@ HTMLDialogElement::Close(const mozilla::dom::Optional<nsAString>& aReturnValue) ErrorResult ignored; SetOpen(false, ignored); ignored.SuppressException(); + RefPtr<AsyncEventDispatcher> 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 7abaee81ca..2222cd2f7c 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 1edc45ac93..b92e3a2bb0 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 372ca90fbc..890a26dcdf 100644 --- a/widget/EventMessageList.h +++ b/widget/EventMessageList.h @@ -457,6 +457,9 @@ NS_EVENT_MESSAGE(eVisibilityChange) // 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 |