Bug 1299096 - Remove the event-based play() method out from nsIDOMHTMLMediaElement.idl; r=bz
authorKaku Kuo <kaku@mozilla.com>
Tue, 13 Dec 2016 16:04:45 +0800
changeset 328529 3b46fcc012e52d208c9a9381d56e7d566915117c
parent 328528 c00b89907a83d023448bffe7ad48e65dbc2a900a
child 328530 afdccbbb363ded460ba209b8f8107cbbe3102aad
push id31178
push userkwierso@gmail.com
push dateTue, 10 Jan 2017 00:30:08 +0000
treeherdermozilla-central@6bcc24319ba5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1299096
milestone53.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 1299096 - Remove the event-based play() method out from nsIDOMHTMLMediaElement.idl; r=bz MozReview-Commit-ID: 3pHsSsADPLu
dom/html/HTMLMediaElement.cpp
dom/interfaces/html/nsIDOMHTMLMediaElement.idl
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -880,19 +880,22 @@ private:
     if (!IsSuspended()) {
       MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
              ("HTMLMediaElement::AudioChannelAgentCallback, ResumeFromAudioChannel, "
               "this = %p, Error : resume without suspended!\n", this));
       return;
     }
 
     SetSuspended(nsISuspendedTypes::NONE_SUSPENDED);
-    nsresult rv = mOwner->Play();
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return;
+    IgnoredErrorResult rv;
+    RefPtr<Promise> toBeIgnored = mOwner->Play(rv);
+    MOZ_ASSERT_IF(toBeIgnored && toBeIgnored->State() == Promise::PromiseState::Rejected,
+                  rv.Failed());
+    if (rv.Failed()) {
+      NS_WARNING("Not able to resume from AudioChannel.");
     }
   }
 
   void
   Suspend(SuspendTypes aSuspend)
   {
     if (IsSuspended()) {
       return;
@@ -3862,33 +3865,16 @@ HTMLMediaElement::PlayInternal(ErrorResu
 void
 HTMLMediaElement::MaybeDoLoad()
 {
   if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
     DoLoad();
   }
 }
 
-NS_IMETHODIMP HTMLMediaElement::Play()
-{
-  if (mAudioChannelWrapper && mAudioChannelWrapper->IsPlaybackBlocked()) {
-    MaybeDoLoad();
-    return NS_OK;
-  }
-
-  ErrorResult rv;
-  RefPtr<Promise> toBeIgnored = PlayInternal(rv);
-  if (rv.Failed()) {
-    return rv.StealNSResult();
-  }
-
-  UpdateCustomPolicyAfterPlayed();
-  return NS_OK;
-}
-
 HTMLMediaElement::WakeLockBoolWrapper&
 HTMLMediaElement::WakeLockBoolWrapper::operator=(bool val)
 {
   if (mValue == val) {
     return *this;
   }
 
   mValue = val;
--- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
@@ -60,17 +60,16 @@ interface nsIDOMHTMLMediaElement : nsISu
            attribute double playbackRate;
            attribute boolean mozPreservesPitch;
   readonly attribute nsIDOMTimeRanges played;
   readonly attribute nsIDOMTimeRanges seekable;
   readonly attribute boolean ended;
   readonly attribute boolean mozAutoplayEnabled;
            attribute boolean autoplay;
            attribute boolean loop;
-  void play();
   void pause();
 
   // controls
            attribute boolean controls;
            attribute double volume;
            attribute boolean muted;
            attribute boolean defaultMuted;