Bug 1443746, ensure DOM events aren't dispatched at unexpected time, r=masayuki
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 08 Mar 2018 16:59:25 +0900
changeset 407174 95d553c23d52e49433096f02de048556b78db577
parent 407173 fe859b4ec63cc8737ad26a1ca2bc2e7bfaa6dcdc
child 407175 6a6ce23602c1258fe907bd62c01524aa34f2f9ab
push id33594
push usercbrindusan@mozilla.com
push dateThu, 08 Mar 2018 18:01:12 +0000
treeherdermozilla-central@55d91695f4bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1443746
milestone60.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 1443746, ensure DOM events aren't dispatched at unexpected time, r=masayuki
dom/events/EventDispatcher.cpp
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -675,16 +675,18 @@ EventDispatcher::Dispatch(nsISupports* a
   // sure it is initialized!
   // If aTargets is non-null, the event isn't going to be dispatched.
   NS_ENSURE_TRUE(aEvent->mMessage || !aDOMEvent || aTargets,
                  NS_ERROR_DOM_INVALID_STATE_ERR);
 
   // Events shall not be fired while we are in stable state to prevent anything
   // visible from the scripts.
   MOZ_ASSERT(!nsContentUtils::IsInStableOrMetaStableState());
+  NS_ENSURE_TRUE(!nsContentUtils::IsInStableOrMetaStableState(),
+                 NS_ERROR_DOM_INVALID_STATE_ERR);
 
 #ifdef MOZ_TASK_TRACER
   if (MOZ_UNLIKELY(mozilla::tasktracer::IsStartLogging())) {
     nsAutoCString eventType;
     nsAutoString eventTypeU16;
     if (aDOMEvent) {
       aDOMEvent->GetType(eventTypeU16);
     } else {