Bug 1192818 - part1 : dispatch DOMAudioPlaybackStopped when mute the tab. r=baku
☠☠ backed out by 2a6c1d9fec91 ☠ ☠
authorAlastor Wu <alwu@mozilla.com>
Tue, 21 Feb 2017 18:41:09 +0800
changeset 373036 38fa2ec33fa499fa7dbd49fabc9f043434604121
parent 373035 7104a8fa9806abebbfb205679266300aca624d9e
child 373037 042e5fbe7846af33ee8f5bfcf93913033ae7e334
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1192818, 1302280
milestone54.0a1
Bug 1192818 - part1 : dispatch DOMAudioPlaybackStopped when mute the tab. r=baku The root cause of the intermittent fail is because "DOMAudioPlaybackStopped" has no directly relationship with browser.mute()/unmute(). In [1], the "DOMAudioPlaybackStopped" is caused by audio stop playing, not by calling the browser.mute(). If the audio stops playing before calling the wait_for_event(), the test would be time-out. I guess the bug 1302280 is also caused by same reason. So this patch would do two thinngs, 1. dispatch "DOMAudioPlaybackStopped" when we mute tab 2. loop the audio in test file, to make sure the "DOMAudioPlaybackStopped" is dispatched when muting the audio, not the file ended. [1] https://goo.gl/ymUv8P MozReview-Commit-ID: 703JHj9dICT
dom/html/HTMLMediaElement.cpp
toolkit/content/tests/browser/file_mediaPlayback2.html
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -991,17 +991,17 @@ private:
             mSuspended == nsISuspendedTypes::SUSPENDED_PAUSE_DISPOSABLE ||
             mSuspended == nsISuspendedTypes::SUSPENDED_BLOCK);
   }
 
   AudibleState
   IsOwnerAudible() const
   {
     // Muted or the volume should not be ~0
-    if (mOwner->Muted() || (std::fabs(mOwner->Volume()) <= 1e-7)) {
+    if (mOwner->mMuted || (std::fabs(mOwner->Volume()) <= 1e-7)) {
       return AudioChannelService::AudibleState::eNotAudible;
     }
 
     // No audio track.
     if (!mOwner->HasAudio()) {
       return AudioChannelService::AudibleState::eNotAudible;
     }
 
--- a/toolkit/content/tests/browser/file_mediaPlayback2.html
+++ b/toolkit/content/tests/browser/file_mediaPlayback2.html
@@ -2,11 +2,12 @@
 <body>
 <script type="text/javascript">
 var audio = new Audio();
 audio.oncanplay = function() {
   audio.oncanplay = null;
   audio.play();
 };
 audio.src = "audio.ogg";
+audio.loop = true;
 document.body.appendChild(audio);
 </script>
 </body>