Bug 1721217 - Part 1: Enable parent controlled loads via DC, r=nika

Differential Revision: https://phabricator.services.mozilla.com/D126841
This commit is contained in:
Anny Gakhokidze 2021-11-30 16:31:34 +00:00
parent b364bab638
commit 64c6fca640
3 changed files with 8 additions and 8 deletions

View File

@ -2031,7 +2031,8 @@ bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
!StaticPrefs::browser_tabs_documentchannel_parent_controlled()) {
!StaticPrefs::browser_tabs_documentchannel_parent_controlled() ||
!mozilla::SessionHistoryInParent()) {
return false;
}
@ -2040,6 +2041,8 @@ bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
return false;
}
MOZ_ASSERT(!net::SchemeIsJavascript(aLoadState->URI()));
// Note: If successful, this will recurse into StartDocumentLoad and
// set mCurrentLoad to the DocumentLoadListener instance created.
// Ideally in the future we will only start loads from here, and we can
@ -2055,7 +2058,8 @@ bool CanonicalBrowsingContext::AttemptSpeculativeLoadInParent(
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
StaticPrefs::browser_tabs_documentchannel_parent_controlled()) {
(StaticPrefs::browser_tabs_documentchannel_parent_controlled() &&
mozilla::SessionHistoryInParent())) {
return false;
}
@ -2075,7 +2079,7 @@ bool CanonicalBrowsingContext::StartDocumentLoad(
// If we're controlling loads from the parent, then starting a new load means
// that we need to cancel any existing ones.
if (StaticPrefs::browser_tabs_documentchannel_parent_controlled() &&
mCurrentLoad) {
mozilla::SessionHistoryInParent() && mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
mCurrentLoad = aLoad;

View File

@ -1335,7 +1335,7 @@
# from parent-process BrowsingContexts
- name: browser.tabs.documentchannel.parent-controlled
type: bool
value: false
value: true
mirror: always
# Testing-only pref which makes data: URIs be loaded in a "web" content process

View File

@ -2234,10 +2234,6 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
DisconnectListeners(NS_BINDING_ABORTED, NS_BINDING_ABORTED, true);
// XXX(anny) This is currently a dead code path because parent-controlled
// DC pref is off. When we enable the pref, we might get extra STATE_START
// progress events
// Notify the docshell that it should load using the newly connected
// channel
browserParent->ResumeLoad(mLoadIdentifier);