Bug 1382495 - Fix assert in imgRequestProxy::Dispatch to accept a listener or a tab group. r=me
authorAndrew Osmond <aosmond@mozilla.com>
Thu, 20 Jul 2017 07:53:53 -0400
changeset 418664 760368896800947676137055fbfc907088e2437b
parent 418663 84f072290811909edb1d2f4b31c238b6643f4d0a
child 418665 e860f6becefb1237a3bc7625f7f4a45260fbcb86
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1382495
milestone56.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 1382495 - Fix assert in imgRequestProxy::Dispatch to accept a listener or a tab group. r=me imgRequestProxy::IsOnEventTarget must return false in order for imgRequestProxy::Dispatch to be called. Typically we check for mListener before any of this but in imgRequest::OnLoadComplete, we have other things to do besides notifying the listener. As such, we want to dispatch even if there is no listener, and that is when the assert can fail. Since IsOnEventTarget can only return false if it has either a tab group *or* a listener, we can change the assert to match.
image/imgRequestProxy.cpp
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -285,17 +285,17 @@ imgRequestProxy::GetEventTarget() const
   return target.forget();
 }
 
 void
 imgRequestProxy::Dispatch(already_AddRefed<nsIRunnable> aEvent)
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::Dispatch");
 
-  MOZ_ASSERT(mListener);
+  MOZ_ASSERT(mListener || mTabGroup);
   MOZ_ASSERT(mEventTarget);
 
   mHadDispatch = true;
   mEventTarget->Dispatch(Move(aEvent), NS_DISPATCH_NORMAL);
 }
 
 void
 imgRequestProxy::AddToOwner(nsIDocument* aLoadingDocument)