Bug 1333901 - support document.createEvent(ErrorEvent), r=masayuki
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 26 Jan 2017 12:00:16 +0200
changeset 466873 42112710614b3a7d397728647a810b3c10b5f78f
parent 466872 4999d0f84b57e620b483c04b737fad9b22916391
child 466874 e2957aeef3ed74d7538af604abac7077affb0081
push id43026
push userbmo:npang@mozilla.com
push dateThu, 26 Jan 2017 19:17:39 +0000
reviewersmasayuki
bugs1333901
milestone54.0a1
Bug 1333901 - support document.createEvent(ErrorEvent), r=masayuki
dom/events/EventDispatcher.cpp
testing/web-platform/meta/workers/Worker_dispatchEvent_ErrorEvent.htm.ini
toolkit/components/telemetry/Histograms.json
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -21,16 +21,17 @@
 #include "DeviceMotionEvent.h"
 #include "DragEvent.h"
 #include "GeckoProfiler.h"
 #include "KeyboardEvent.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/dom/CloseEvent.h"
 #include "mozilla/dom/CustomEvent.h"
 #include "mozilla/dom/DeviceOrientationEvent.h"
+#include "mozilla/dom/ErrorEvent.h"
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/FocusEvent.h"
 #include "mozilla/dom/HashChangeEvent.h"
 #include "mozilla/dom/InputEvent.h"
 #include "mozilla/dom/MessageEvent.h"
 #include "mozilla/dom/MouseScrollEvent.h"
 #include "mozilla/dom/MutationEvent.h"
 #include "mozilla/dom/NotifyPaintEvent.h"
@@ -1159,16 +1160,23 @@ EventDispatcher::CreateEvent(EventTarget
   }
   if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
     LOG_EVENT_CREATION(STORAGEEVENT);
     RefPtr<Event> event =
       StorageEvent::Constructor(aOwner, EmptyString(), StorageEventInit());
     event->MarkUninitialized();
     return event.forget();
   }
+  if (aEventType.LowerCaseEqualsLiteral("errorevent")) {
+    LOG_EVENT_CREATION(ERROREVENT);
+    RefPtr<Event> event =
+      ErrorEvent::Constructor(aOwner, EmptyString(), ErrorEventInit());
+    event->MarkUninitialized();
+    return event.forget();
+  }
 
 #undef LOG_EVENT_CREATION
 
   // NEW EVENT TYPES SHOULD NOT BE ADDED HERE; THEY SHOULD USE ONLY EVENT
   // CONSTRUCTORS
 
   return nullptr;
 }
deleted file mode 100644
--- a/testing/web-platform/meta/workers/Worker_dispatchEvent_ErrorEvent.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[Worker_dispatchEvent_ErrorEvent.htm]
-  type: testharness
-  [document.createEvent('ErrorEvent')]
-    expected: FAIL
-
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -277,16 +277,23 @@
   },
   "CREATE_EVENT_DRAGEVENTS" : {
     "alert_emails": ["ayg@aryeh.name"],
     "description": "Was document.createEvent(\"dragevents\") ever called",
     "expires_in_version": "56",
     "kind": "count",
     "bug_numbers": [1295588, 1251198]
   },
+  "CREATE_EVENT_ERROREVENT" : {
+    "alert_emails": ["ayg@aryeh.name"],
+    "description": "Was document.createEvent(\"errorevent\") ever called",
+    "expires_in_version": "56",
+    "kind": "count",
+    "bug_numbers": [1295588, 1251198, 1333901]
+  },
   "CREATE_EVENT_EVENT" : {
     "alert_emails": ["ayg@aryeh.name"],
     "description": "Was document.createEvent(\"event\") ever called",
     "expires_in_version": "56",
     "kind": "count",
     "bug_numbers": [1295588, 1251198]
   },
   "CREATE_EVENT_EVENTS" : {