зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572798 - Make content browsing contexts for tabs start as inactive. r=nika
Otherwise autoplay blocking until-in-foreground breaks with the other patch in this bug, because it unblocks media playback once a browsing context is active for the first time. Differential Revision: https://phabricator.services.mozilla.com/D42329
This commit is contained in:
Родитель
fdaca8c7bc
Коммит
a713e37be6
|
@ -2000,6 +2000,7 @@
|
|||
uriIsAboutBlank,
|
||||
userContextId,
|
||||
skipLoad,
|
||||
initiallyActive,
|
||||
} = {}) {
|
||||
let b = document.createXULElement("browser");
|
||||
// Use the JSM global to create the permanentKey, so that if the
|
||||
|
@ -2032,6 +2033,10 @@
|
|||
b.setAttribute(attribute, defaultBrowserAttributes[attribute]);
|
||||
}
|
||||
|
||||
if (!initiallyActive) {
|
||||
b.setAttribute("initiallyactive", "false");
|
||||
}
|
||||
|
||||
if (userContextId) {
|
||||
b.setAttribute("usercontextid", userContextId);
|
||||
}
|
||||
|
|
|
@ -344,8 +344,19 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
|||
}
|
||||
|
||||
nsContentUtils::GenerateUUIDInPlace(fields.mHistoryID);
|
||||
fields.mExplicitActive =
|
||||
parentBC ? ExplicitActiveStatus::None : ExplicitActiveStatus::Active;
|
||||
fields.mExplicitActive = [&] {
|
||||
if (parentBC) {
|
||||
// Non-root browsing-contexts inherit their status from its parent.
|
||||
return ExplicitActiveStatus::None;
|
||||
}
|
||||
if (aType == Type::Content) {
|
||||
// Content gets managed by the chrome front-end / embedder element and
|
||||
// starts as inactive.
|
||||
return ExplicitActiveStatus::Inactive;
|
||||
}
|
||||
// Chrome starts as active.
|
||||
return ExplicitActiveStatus::Active;
|
||||
}();
|
||||
|
||||
fields.mFullZoom = parentBC ? parentBC->FullZoom() : 1.0f;
|
||||
fields.mTextZoom = parentBC ? parentBC->TextZoom() : 1.0f;
|
||||
|
@ -633,8 +644,12 @@ void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
|
|||
if (XRE_IsParentProcess() && IsTopContent()) {
|
||||
nsAutoString messageManagerGroup;
|
||||
if (aEmbedder->IsXULElement()) {
|
||||
aEmbedder->GetAttr(kNameSpaceID_None, nsGkAtoms::messagemanagergroup,
|
||||
messageManagerGroup);
|
||||
aEmbedder->GetAttr(nsGkAtoms::messagemanagergroup, messageManagerGroup);
|
||||
if (!aEmbedder->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::initiallyactive,
|
||||
nsGkAtoms::_false, eIgnoreCase)) {
|
||||
txn.SetExplicitActive(ExplicitActiveStatus::Active);
|
||||
}
|
||||
}
|
||||
txn.SetMessageManagerGroup(messageManagerGroup);
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ var PrintUtils = {
|
|||
userContextId: browsingContext.originAttributes.userContextId,
|
||||
initialBrowsingContextGroupId: browsingContext.group.id,
|
||||
skipLoad: true,
|
||||
initiallyActive: true,
|
||||
});
|
||||
browser.addEventListener("DOMWindowClose", function(e) {
|
||||
// Ignore close events from printing, see the code creating browsers in
|
||||
|
|
|
@ -2218,6 +2218,7 @@ STATIC_ATOMS = [
|
|||
Atom("forcemessagemanager", "forcemessagemanager"),
|
||||
Atom("preloadedState", "preloadedState"),
|
||||
Atom("initialBrowsingContextGroupId", "initialBrowsingContextGroupId"),
|
||||
Atom("initiallyactive", "initiallyactive"),
|
||||
# windows media query names
|
||||
Atom("windows_win7", "windows-win7"),
|
||||
Atom("windows_win8", "windows-win8"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче