Bug 1505494 - not allow autoplay if we don't have a document. r=cpearce

In order to avoid the nullptr crash when using `approver`.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2018-11-12 17:39:51 +00:00
Родитель d40d607632
Коммит 5657ac5a73
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -91,6 +91,10 @@ IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow)
}
nsIDocument* approver = ApproverDocOf(*aWindow->GetExtantDoc());
if (!approver) {
return false;
}
if (nsContentUtils::IsExactSitePermAllow(approver->NodePrincipal(),
"autoplay-media")) {
AUTOPLAY_LOG("Allow autoplay as document has autoplay permission.");