diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index ddaaf3663efc..3773ceb84d28 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -242,6 +242,7 @@ support-files = file_webaudioLoop.html file_webaudioLoop2.html file_pluginAudio.html + noaudio.webm referrer_helper.js referrer_testserver.sjs script_postmessages_fileList.js @@ -299,6 +300,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1 [test_named_frames.html] [test_navigator_resolve_identity.html] [test_navigator_language.html] +[test_noAudioNotification.html] [test_openDialogChromeOnly.html] [test_open_null_features.html] skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Fails on b2g-desktop, tracked in bug 1011874 diff --git a/dom/base/test/noaudio.webm b/dom/base/test/noaudio.webm new file mode 100644 index 000000000000..9207017fb60e Binary files /dev/null and b/dom/base/test/noaudio.webm differ diff --git a/dom/base/test/test_noAudioNotification.html b/dom/base/test/test_noAudioNotification.html new file mode 100644 index 000000000000..6fa19ce7bfb0 --- /dev/null +++ b/dom/base/test/test_noAudioNotification.html @@ -0,0 +1,81 @@ + + +
+++ + + + + diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 02b2781f31b0..13a80aa64868 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -4504,6 +4504,11 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() void HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying) { + // Don't do anything if this element doesn't have any audio tracks. + if (!HasAudio()) { + return; + } + // Immediately check if this should go to the MSG instead of the normal // media playback route. WindowAudioCaptureChanged();