Bug 1324311 - window-less agent can't own audio focus. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 19 Dec 2016 15:04:16 +0800
changeset 450882 ccce484b49e8bcff489d7a0fcd0eb748f09a4b28
parent 449758 b1ab720c6d3e412ede797b08dfe63dca170f6ee0
child 539860 1dbfa46f5ba5e1611d62b9895ff79c93f2d057bd
push id38982
push useralwu@mozilla.com
push dateMon, 19 Dec 2016 07:04:43 +0000
bugs1324311
milestone53.0a1
Bug 1324311 - window-less agent can't own audio focus. MozReview-Commit-ID: HBieQMoIGOv
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -1049,16 +1049,21 @@ AudioChannelService::RefreshAgentsAudioF
   }
 }
 
 void
 AudioChannelService::AudioChannelWindow::RequestAudioFocus(AudioChannelAgent* aAgent)
 {
   MOZ_ASSERT(aAgent);
 
+  // Don't need to check audio focus for window-less agent.
+  if (!aAgent->Window()) {
+    return;
+  }
+
   // We already have the audio focus. No operation is needed.
   if (mOwningAudioFocus) {
     return;
   }
 
   // Only foreground window can request audio focus, but it would still own the
   // audio focus even it goes to background. Audio focus would be abandoned
   // only when other foreground window starts audio competing.