Bug 1638559 - return a deny action when the window context is null. r=bryce

I suspect that when enabling Fission, in some situation, we might get a null window context which results in a crash. Therefore, returning a deny action if we are not able to get a window context.

Differential Revision: https://phabricator.services.mozilla.com/D76196
This commit is contained in:
alwu 2020-05-20 21:12:13 +00:00
Родитель c524d44aa8
Коммит 0445af8ee7
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -60,9 +60,13 @@ static uint32_t SiteAutoplayPerm(nsPIDOMWindowInner* aWindow) {
if (!aWindow || !aWindow->GetBrowsingContext()) {
return nsIPermissionManager::DENY_ACTION;
}
return aWindow->GetBrowsingContext()
->GetTopWindowContext()
->GetAutoplayPermission();
WindowContext* topContext =
aWindow->GetBrowsingContext()->GetTopWindowContext();
if (!topContext) {
return nsIPermissionManager::DENY_ACTION;
}
return topContext->GetAutoplayPermission();
}
static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {