Bug 1520088 - part2 : ensure logging result can always be executed. r=cpearce

Ensure we can always see the debug log for the autoplay result.

Differential Revision: https://phabricator.services.mozilla.com/D16524

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-01-16 01:04:40 +00:00
Родитель 8c10894e80
Коммит fd9892991a
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -168,8 +168,7 @@ static bool IsEnableBlockingWebAudioByUserGesturePolicy() {
return IsAudioContextAllowedToPlay(aContext);
}
/* static */ bool AutoplayPolicy::IsAllowedToPlay(
const HTMLMediaElement& aElement) {
static bool IsAllowedToPlayInternal(const HTMLMediaElement& aElement) {
const uint32_t autoplayDefault = DefaultAutoplayBehaviour();
// TODO : this old way would be removed when user-gestures-needed becomes
// as a default option to block autoplay.
@ -190,12 +189,15 @@ static bool IsEnableBlockingWebAudioByUserGesturePolicy() {
return true;
}
const bool result = IsMediaElementAllowedToPlay(aElement) ||
return IsMediaElementAllowedToPlay(aElement) ||
autoplayDefault == nsIAutoplay::ALLOWED;
}
/* static */ bool AutoplayPolicy::IsAllowedToPlay(
const HTMLMediaElement& aElement) {
const bool result = IsAllowedToPlayInternal(aElement);
AUTOPLAY_LOG("IsAllowedToPlay, mediaElement=%p, isAllowToPlay=%s", &aElement,
result ? "allowed" : "blocked");
return result;
}