Bug 966002 - Buffer async events to media elements while event delivery is paused like we do for sync events. r=roc
authorChris Pearce <cpearce@mozilla.com>
Fri, 31 Jan 2014 13:14:17 -0500
changeset 182323 111d77c40e201dffbe483f35e569ac2f5cdec62d
parent 182322 a2c030eb1c50e142fd1f3dcc664a19ef2607c4c3
child 182324 046c205bc5d301c3b780c40857fa400ab796ccb7
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs966002
milestone29.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 966002 - Buffer async events to media elements while event delivery is paused like we do for sync events. r=roc
content/html/content/src/HTMLMediaElement.cpp
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -3289,16 +3289,23 @@ nsresult HTMLMediaElement::DispatchEvent
                                               false);
 }
 
 nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName)
 {
   LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing event %s", this,
             NS_ConvertUTF16toUTF8(aName).get()));
 
+  // Save events that occur while in the bfcache. These will be dispatched
+  // if the page comes out of the bfcache.
+  if (mEventDeliveryPaused) {
+    mPendingEvents.AppendElement(aName);
+    return NS_OK;
+  }
+
   nsCOMPtr<nsIRunnable> event = new nsAsyncEventRunner(aName, this);
   NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
   return NS_OK;
 }
 
 nsresult HTMLMediaElement::DispatchPendingMediaEvents()
 {
   NS_ASSERTION(!mEventDeliveryPaused,