Bug 1607984 - P12-4. Start parent load via DocumentChannel. r=mayhemer,nika,mattwoodrow,necko-reviewers

Add ParentProcessDocumentChannel object. This object is a DocumentChannel that will start a channel load from the parent process via a DocumentChannel.

The aim of this task is two-fold.
1- Be consistent on how we handle redirects before continuing the load on the final channel.
2- Prepare to initiate a process switch when needed without having to go via an intermediary content process, saving a process switch. This task will be done in a follow-up task.

The behaviour of the ParentProcessDocumentChannel is similar in logic to the DocumentChannelChild/DocumentChannelParent pair. The ParentProcessDocumentChannel sets up a DocumentLoadListener, have it handle the redirects and upon completion continue the load on the final channel.

Differential Revision: https://phabricator.services.mozilla.com/D70009
This commit is contained in:
Jean-Yves Avenard
2020-04-24 01:58:23 +00:00
parent 5ed9e02da8
commit 31f1e6e50c
9 changed files with 249 additions and 17 deletions

View File

@@ -5712,7 +5712,8 @@ void nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
// of redirects handled in the parent process.
// Query the full redirect chain directly, so that we can add history
// entries for them.
if (RefPtr<DocumentChannel> docChannel = do_QueryObject(aOldChannel)) {
RefPtr<DocumentChannel> docChannel = do_QueryObject(aOldChannel);
if (docChannel) {
nsCOMPtr<nsIURI> previousURI;
uint32_t previousFlags = 0;
docChannel->GetLastVisit(getter_AddRefs(previousURI), &previousFlags);
@@ -5760,7 +5761,7 @@ void nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
// check if the new load should go through the application cache.
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(aNewChannel);
if (appCacheChannel) {
if (appCacheChannel && !docChannel) {
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Permission will be checked in the parent process.
appCacheChannel->SetChooseApplicationCache(true);