Bug 1362272 - Part 1: Add onrejectionhandled and onunhandledrejection EventHandler; r=smaug
authorEdgar Chen <echen@mozilla.com>
Wed, 24 Apr 2019 11:15:27 +0000
changeset 534782 a9ccbfb3293c624c3b1a728e9149467791dd9673
parent 534781 cd4a75c0bee4b6827bb41fcd7695a35297aa8da8
child 534783 d7eaeddfd71d0eac39d7e99bbc918fc1df62bedf
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1362272
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1362272 - Part 1: Add onrejectionhandled and onunhandledrejection EventHandler; r=smaug Differential Revision: https://phabricator.services.mozilla.com/D17237
dom/events/EventNameList.h
dom/webidl/EventHandler.webidl
dom/webidl/WorkerGlobalScope.webidl
dom/workers/WorkerScope.h
widget/EventMessageList.h
xpcom/ds/StaticAtoms.py
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -302,22 +302,22 @@ WINDOW_EVENT(orientationchange, eOrienta
 #endif
 WINDOW_EVENT(pagehide, ePageHide, EventNameType_HTMLBodyOrFramesetOnly,
              eBasicEventClass)
 WINDOW_EVENT(pageshow, ePageShow, EventNameType_HTMLBodyOrFramesetOnly,
              eBasicEventClass)
 WINDOW_EVENT(popstate, ePopState,
              EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
              eBasicEventClass)
-// Not supported yet
-// WINDOW_EVENT(redo)
+WINDOW_EVENT(rejectionhandled, eRejectionHandled,
+             EventNameType_HTMLBodyOrFramesetOnly, eBasicEventClass)
 WINDOW_EVENT(storage, eStorage, EventNameType_HTMLBodyOrFramesetOnly,
              eBasicEventClass)
-// Not supported yet
-// WINDOW_EVENT(undo)
+WINDOW_EVENT(unhandledrejection, eUnhandledRejection,
+             EventNameType_HTMLBodyOrFramesetOnly, eBasicEventClass)
 WINDOW_EVENT(unload, eUnload,
              (EventNameType_XUL | EventNameType_SVGSVG |
               EventNameType_HTMLBodyOrFramesetOnly),
              eBasicEventClass)
 
 WINDOW_ONLY_EVENT(devicemotion, eDeviceMotion, EventNameType_None,
                   eBasicEventClass)
 WINDOW_ONLY_EVENT(deviceorientation, eDeviceOrientation, EventNameType_None,
--- a/dom/webidl/EventHandler.webidl
+++ b/dom/webidl/EventHandler.webidl
@@ -150,17 +150,21 @@ interface WindowEventHandlers {
            attribute EventHandler onlanguagechange;
            attribute EventHandler onmessage;
            attribute EventHandler onmessageerror;
            attribute EventHandler onoffline;
            attribute EventHandler ononline;
            attribute EventHandler onpagehide;
            attribute EventHandler onpageshow;
            attribute EventHandler onpopstate;
+           [Func="mozilla::dom::DOMPrefs::dom_promise_rejection_events_enabled"]
+           attribute EventHandler onrejectionhandled;
            attribute EventHandler onstorage;
+           [Func="mozilla::dom::DOMPrefs::dom_promise_rejection_events_enabled"]
+           attribute EventHandler onunhandledrejection;
            attribute EventHandler onunload;
 };
 
 [NoInterfaceObject]
 interface DocumentAndElementEventHandlers {
   attribute EventHandler oncopy;
   attribute EventHandler oncut;
   attribute EventHandler onpaste;
--- a/dom/webidl/WorkerGlobalScope.webidl
+++ b/dom/webidl/WorkerGlobalScope.webidl
@@ -21,16 +21,20 @@ interface WorkerGlobalScope : EventTarge
 
   [Throws]
   void importScripts(DOMString... urls);
 
   attribute OnErrorEventHandler onerror;
 
   attribute EventHandler onoffline;
   attribute EventHandler ononline;
+  [Func="mozilla::dom::DOMPrefs::dom_promise_rejection_events_enabled"]
+  attribute EventHandler onrejectionhandled;
+  [Func="mozilla::dom::DOMPrefs::dom_promise_rejection_events_enabled"]
+  attribute EventHandler onunhandledrejection;
   // also has additional members in a partial interface
 };
 
 WorkerGlobalScope implements GlobalCrypto;
 WorkerGlobalScope implements WindowOrWorkerGlobalScope;
 
 // Not implemented yet: bug 1072107.
 // WorkerGlobalScope implements FontFaceSource;
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -125,16 +125,18 @@ class WorkerGlobalScope : public DOMEven
 
   void GetOrigin(nsAString& aOrigin) const;
 
   void Atob(const nsAString& aAtob, nsAString& aOutput, ErrorResult& aRv) const;
   void Btoa(const nsAString& aBtoa, nsAString& aOutput, ErrorResult& aRv) const;
 
   IMPL_EVENT_HANDLER(online)
   IMPL_EVENT_HANDLER(offline)
+  IMPL_EVENT_HANDLER(rejectionhandled)
+  IMPL_EVENT_HANDLER(unhandledrejection)
 
   void Dump(const Optional<nsAString>& aString) const;
 
   Performance* GetPerformance();
 
   Performance* GetPerformanceIfExists() const { return mPerformance; }
 
   static bool IsInAutomation(JSContext* aCx, JSObject* /* unused */);
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -110,17 +110,19 @@ NS_EVENT_MESSAGE(eContextMenu)
 
 NS_EVENT_MESSAGE(eLoad)
 NS_EVENT_MESSAGE(eUnload)
 NS_EVENT_MESSAGE(eHashChange)
 NS_EVENT_MESSAGE(eImageAbort)
 NS_EVENT_MESSAGE(eLoadError)
 NS_EVENT_MESSAGE(eLoadEnd)
 NS_EVENT_MESSAGE(ePopState)
+NS_EVENT_MESSAGE(eRejectionHandled)
 NS_EVENT_MESSAGE(eStorage)
+NS_EVENT_MESSAGE(eUnhandledRejection)
 NS_EVENT_MESSAGE(eBeforeUnload)
 NS_EVENT_MESSAGE(eReadyStateChange)
 
 NS_EVENT_MESSAGE(eFormSubmit)
 NS_EVENT_MESSAGE(eFormReset)
 NS_EVENT_MESSAGE(eFormChange)
 NS_EVENT_MESSAGE(eFormSelect)
 NS_EVENT_MESSAGE(eFormInvalid)
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -858,16 +858,17 @@ STATIC_ATOMS = [
     Atom("onpopuppositioned", "onpopuppositioned"),
     Atom("onpopupshowing", "onpopupshowing"),
     Atom("onpopupshown", "onpopupshown"),
     Atom("onprocessorerror", "onprocessorerror"),
     Atom("onpush", "onpush"),
     Atom("onpushsubscriptionchange", "onpushsubscriptionchange"),
     Atom("onRadioStateChange", "onRadioStateChange"),
     Atom("onreadystatechange", "onreadystatechange"),
+    Atom("onrejectionhandled", "onrejectionhandled"),
     Atom("onrequestprogress", "onrequestprogress"),
     Atom("onresourcetimingbufferfull", "onresourcetimingbufferfull"),
     Atom("onresponseprogress", "onresponseprogress"),
     Atom("onRequest", "onRequest"),
     Atom("onreset", "onreset"),
     Atom("onresize", "onresize"),
     Atom("onscroll", "onscroll"),
     Atom("onselect", "onselect"),
@@ -889,16 +890,17 @@ STATIC_ATOMS = [
     Atom("ontouchend", "ontouchend"),
     Atom("ontouchmove", "ontouchmove"),
     Atom("ontouchcancel", "ontouchcancel"),
     Atom("ontransitioncancel", "ontransitioncancel"),
     Atom("ontransitionend", "ontransitionend"),
     Atom("ontransitionrun", "ontransitionrun"),
     Atom("ontransitionstart", "ontransitionstart"),
     Atom("onunderflow", "onunderflow"),
+    Atom("onunhandledrejection", "onunhandledrejection"),
     Atom("onunload", "onunload"),
     Atom("onunmute", "onunmute"),
     Atom("onupdatefound", "onupdatefound"),
     Atom("onupdateready", "onupdateready"),
     Atom("onupgradeneeded", "onupgradeneeded"),
     Atom("onversionchange", "onversionchange"),
     Atom("onvisibilitychange", "onvisibilitychange"),
     Atom("onvoiceschanged", "onvoiceschanged"),