mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 08:45:46 +00:00
Bug 1590864 - part1 : get the user activation state from top-level browsing context. r=edgar
As `ApproverDocOf()` uses `docshell::GetInProcessSameTypeRootTreeItem()`, which is not compatible in Fission because we are not able to get the top document if we are in the remote process. Therefore, we should check browsering content directly instead, because the user activation state would be sync automatically for each top-level browsing context among different processes. Differential Revision: https://phabricator.services.mozilla.com/D51427 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
decdfa79d9
commit
230fbfc8d4
@ -93,6 +93,14 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<BrowsingContext> topLevelBC = aWindow->GetBrowsingContext()->Top();
|
||||
if (topLevelBC->HasBeenUserGestureActivated()) {
|
||||
AUTOPLAY_LOG(
|
||||
"Allow autoplay as top-level context has been activated by user "
|
||||
"gesture.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!aWindow->GetExtantDoc()) {
|
||||
return false;
|
||||
}
|
||||
@ -102,11 +110,6 @@ static bool IsWindowAllowedToPlay(nsPIDOMWindowInner* aWindow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (approver->HasBeenUserGestureActivated()) {
|
||||
AUTOPLAY_LOG("Allow autoplay as document activated by user gesture.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (approver->IsExtensionPage()) {
|
||||
AUTOPLAY_LOG("Allow autoplay as in extension document.");
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user