Bug 1480281 - part1 : add autoplay debug log module. r=cpearce

Add new log module which allow us to debug by using "MOZ_LOG=Autoplay:5".

MozReview-Commit-ID: 9CG5JyCw21G
This commit is contained in:
alwu
2018-08-01 17:30:59 -07:00
parent c0626a2f47
commit 46f05f8766
2 changed files with 51 additions and 11 deletions

View File

@@ -127,6 +127,10 @@
mozilla::LazyLogModule gMediaElementLog("nsMediaElement");
static mozilla::LazyLogModule gMediaElementEventsLog("nsMediaElementEvents");
extern mozilla::LazyLogModule gAutoplayPermissionLog;
#define AUTOPLAY_LOG(msg, ...) \
MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
#define LOG(type, msg) MOZ_LOG(gMediaElementLog, type, msg)
#define LOG_EVENT(type, msg) MOZ_LOG(gMediaElementEventsLog, type, msg)
@@ -3068,6 +3072,7 @@ HTMLMediaElement::PauseIfShouldNotBePlaying()
return;
}
if (AutoplayPolicy::IsAllowedToPlay(*this) != nsIAutoplay::ALLOWED) {
AUTOPLAY_LOG("pause because not allowed to play, element=%p", this);
ErrorResult rv;
Pause(rv);
OwnerDoc()->SetDocTreeHadPlayRevoked();