Bug 1653390 - part1 : remove start check. r=bryce
authoralwu <alwu@mozilla.com>
Thu, 23 Jul 2020 21:32:43 +0000
changeset 541862 e2dc8fd47bc2873b9bd7b17ccc643de77a82d884
parent 541861 cce1c9388eebdaee2e5d21277e67d1b0598b005d
child 541863 f42e3e5a600d50db4c482ef83b8d5ee1a6eec5a7
push id37633
push userccoroiu@mozilla.com
push dateFri, 24 Jul 2020 09:32:06 +0000
treeherdermozilla-central@141543043270 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1653390
milestone80.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 1653390 - part1 : remove start check. r=bryce The reason of checking those conditions before calling `StartListeningMediaControlKeyIfNeeded()` is because we was only starting the listener after media starts, which has been modified in D79234. Now we would start the listener before media starts, so we can remove that check. Differential Revision: https://phabricator.services.mozilla.com/D84114
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6541,21 +6541,17 @@ void HTMLMediaElement::SuspendOrResumeEl
     // If the media element has been blocked and isn't still allowed to play
     // when it comes back from the bfcache, we would notify front end to show
     // the blocking icon in order to inform user that the site is still being
     // blocked.
     if (mHasEverBeenBlockedForAutoplay &&
         !AutoplayPolicy::IsAllowedToPlay(*this)) {
       MaybeNotifyAutoplayBlocked();
     }
-    // If we stopped listening to the event when we suspended media element,
-    // then we should restart to listen to the event if we haven't done so yet.
-    if (mMediaControlKeyListener && !mMediaControlKeyListener->IsStarted()) {
-      StartListeningMediaControlKeyIfNeeded();
-    }
+    StartListeningMediaControlKeyIfNeeded();
   }
   if (StaticPrefs::media_testing_only_events()) {
     auto dispatcher = MakeRefPtr<AsyncEventDispatcher>(
         this, u"MozMediaSuspendChanged"_ns, CanBubble::eYes,
         ChromeOnlyDispatch::eYes);
     dispatcher->PostDOMEvent();
   }
 }