mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1190040 - Do not dispatch media-playback notifications for media elements that do not have an audio track; r=baku
This commit is contained in:
parent
9b6236a10a
commit
09c21cd547
@ -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
|
||||
|
BIN
dom/base/test/noaudio.webm
Normal file
BIN
dom/base/test/noaudio.webm
Normal file
Binary file not shown.
81
dom/base/test/test_noAudioNotification.html
Normal file
81
dom/base/test/test_noAudioNotification.html
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for video controller in windows</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var observer = {
|
||||
observe: function(subject, topic, data) {
|
||||
ok(false, "should not receive media-playback notification!");
|
||||
}
|
||||
};
|
||||
|
||||
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
|
||||
var video = document.createElement("video");
|
||||
video.loop = true;
|
||||
video.src = "noaudio.webm";
|
||||
|
||||
video.onplay = video.onpause = function() {
|
||||
// Yield to the event loop a few times to make sure that media-playback is not dispatched.
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
runTest();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var tests = [
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.addObserver(observer, "media-playback", false);
|
||||
ok(true, "Observer set");
|
||||
runTest();
|
||||
},
|
||||
|
||||
function() {
|
||||
video.play();
|
||||
},
|
||||
|
||||
function() {
|
||||
video.pause();
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.removeObserver(observer, "media-playback");
|
||||
ok(true, "Observer removed");
|
||||
runTest();
|
||||
}
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
if (!tests.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user