зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1592167 - part2 : using browsing content to check if the video document is in the top-level context. r=jya
Our policy is to allow video document to autoplay only when it's in the top-level window. However, `docshell::GetInProcessSameTypeRootTreeItem()` is not compatible with Fission so that we are not able to get the top-level document if we are in the remote process. Therefore, we should use `BrowsingContext` instead, to check if the video document is in the top-level context. Differential Revision: https://phabricator.services.mozilla.com/D51216 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
016684ed90
Коммит
67e0814f07
|
@ -101,11 +101,19 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!aWindow->GetExtantDoc()) {
|
||||
Document* currentDoc = aWindow->GetExtantDoc();
|
||||
if (!currentDoc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Document* approver = ApproverDocOf(*aWindow->GetExtantDoc());
|
||||
bool isTopLevelContent = !aWindow->GetBrowsingContext()->GetParent();
|
||||
if (currentDoc->MediaDocumentKind() == Document::MediaDocumentKind::Video &&
|
||||
isTopLevelContent) {
|
||||
AUTOPLAY_LOG("Allow top-level video document to autoplay.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Document* approver = ApproverDocOf(*currentDoc);
|
||||
if (!approver) {
|
||||
return false;
|
||||
}
|
||||
|
@ -115,11 +123,6 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (approver->MediaDocumentKind() == Document::MediaDocumentKind::Video) {
|
||||
AUTOPLAY_LOG("Allow video document to autoplay.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче