Bug 1591712 - Remove useless OwnerDoc() checks in MediaPlayackDelayPolicy. r=alwu
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 28 Oct 2019 17:29:08 +0000
changeset 499469 c65ef27b6fc78ec5140068913209bad3b55f1139
parent 499468 bb62609416c8981592cd5a39d8b8654964b918ec
child 499470 aec2718b33a4cfad83c95c66310e50dc60298292
push id114161
push userncsoregi@mozilla.com
push dateTue, 29 Oct 2019 21:34:24 +0000
treeherdermozilla-inbound@25bf8e097e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersalwu
bugs1591712
milestone72.0a1
first release with
nightly linux64
c65ef27b6fc7 / 72.0a1 / 20191028215046 / files
nightly mac
c65ef27b6fc7 / 72.0a1 / 20191028215046 / files
nightly linux32
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux64
nightly mac
Bug 1591712 - Remove useless OwnerDoc() checks in MediaPlayackDelayPolicy. r=alwu OwnerDoc() always return non-null. Differential Revision: https://phabricator.services.mozilla.com/D50703
dom/media/MediaPlaybackDelayPolicy.cpp
--- a/dom/media/MediaPlaybackDelayPolicy.cpp
+++ b/dom/media/MediaPlaybackDelayPolicy.cpp
@@ -63,17 +63,16 @@ NS_IMPL_ISUPPORTS(ResumeDelayedPlaybackA
 
 ResumeDelayedPlaybackAgent::ResumePlayDelegate::~ResumePlayDelegate() {
   MOZ_ASSERT(!mAudioChannelAgent);
 }
 
 bool ResumeDelayedPlaybackAgent::ResumePlayDelegate::Init(
     const HTMLMediaElement* aElement, bool aIsAudible) {
   MOZ_ASSERT(aElement);
-  MOZ_ASSERT(aElement->OwnerDoc());
   if (!aElement->OwnerDoc()->GetInnerWindow()) {
     return false;
   }
 
   MOZ_ASSERT(!mAudioChannelAgent);
   mAudioChannelAgent = new AudioChannelAgent();
   nsresult rv =
       mAudioChannelAgent->Init(aElement->OwnerDoc()->GetInnerWindow(), this);
@@ -146,20 +145,16 @@ ResumeDelayedPlaybackAgent::ResumePlayDe
 bool MediaPlaybackDelayPolicy::ShouldDelayPlayback(
     const HTMLMediaElement* aElement) {
   MOZ_ASSERT(aElement);
   if (!StaticPrefs::media_block_autoplay_until_in_foreground()) {
     return false;
   }
 
   const Document* doc = aElement->OwnerDoc();
-  if (!doc) {
-    return false;
-  }
-
   nsPIDOMWindowInner* inner = nsPIDOMWindowInner::From(doc->GetInnerWindow());
   nsPIDOMWindowOuter* outer = nsPIDOMWindowOuter::GetFromCurrentInner(inner);
   if (!outer) {
     return false;
   }
   return outer->GetMediaSuspend() == nsISuspendedTypes::SUSPENDED_BLOCK;
 }