Bug 1746524 - Enable browser.tabs.documentchannel.parent-controlled pref. r=smaug

This patch also does some cosmetic changes for when parent controlled
loads should be used, but more importantly introduces the pref
'browser.tabs.documentchannel.speculative-load' with the default value
false.

It turns out that speculatively loading in the parent when a parent
controlled load isn't possible is the cause for performance
regressions.

Differential Revision: https://phabricator.services.mozilla.com/D192489
This commit is contained in:
Andreas Farre 2023-11-09 07:00:42 +00:00
Родитель 9d50eaea5b
Коммит 1cecb92a88
2 изменённых файлов: 21 добавлений и 19 удалений

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

@ -2188,6 +2188,18 @@ bool CanonicalBrowsingContext::HasCreatedMediaController() const {
bool CanonicalBrowsingContext::SupportsLoadingInParent(
nsDocShellLoadState* aLoadState, uint64_t* aOuterWindowId) {
// We only support parent controlled navigation with Fission.
if (!StaticPrefs::browser_tabs_documentchannel_parent_controlled() ||
!mozilla::FissionAutostart()) {
return false;
}
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent()) {
return false;
}
// We currently don't support initiating loads in the parent when they are
// watched by devtools. This is because devtools tracks loads using content
// process notifications, which happens after the load is initiated in this
@ -2238,15 +2250,6 @@ bool CanonicalBrowsingContext::SupportsLoadingInParent(
bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
bool aSetNavigating) {
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
!StaticPrefs::browser_tabs_documentchannel_parent_controlled()) {
return false;
}
uint64_t outerWindowId = 0;
if (!SupportsLoadingInParent(aLoadState, &outerWindowId)) {
return false;
@ -2266,17 +2269,9 @@ bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
bool CanonicalBrowsingContext::AttemptSpeculativeLoadInParent(
nsDocShellLoadState* aLoadState) {
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
(StaticPrefs::browser_tabs_documentchannel_parent_controlled())) {
return false;
}
uint64_t outerWindowId = 0;
if (!SupportsLoadingInParent(aLoadState, &outerWindowId)) {
if (!StaticPrefs::browser_tabs_documentchannel_speculative_load() ||
!SupportsLoadingInParent(aLoadState, &outerWindowId)) {
return false;
}

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

@ -1614,6 +1614,13 @@
# If set, use DocumentChannel to directly initiate loads entirely
# from parent-process BrowsingContexts
- name: browser.tabs.documentchannel.parent-controlled
type: bool
value: true
mirror: always
# If set, use DocumentChannel to attempt a speculative load from the
# parent whenever it's not possible to directly load from the parent.
- name: browser.tabs.documentchannel.speculative-load
type: bool
value: false
mirror: always