Navigation: Introducing the NavigationClient mojo interface.
This CL introduces a new interface called NavigationClient,
implemented on the renderer side. This interface should allow to
solve a number of race conditions as well as enabling
other things. See the related BUG for more information on this.
As a first step we replace two IPCs by reworking BeginNavigation.
The idea is to send an interface pointer over BeginNavigation
to allow for further control of the navigation.
An important part of this CL is getting the proper lifetime for the
Interface. We think that provisional_document_loader_ in the
FrameLoader is a good candidate to own the binding. On the browser
side,the NavigationRequest is in charge of holding the interface
endpoint.
BeginNavigation gets a new parameter: the AssociatedPtrInfo of the
transmitted interface. FrameMsg_DroppedNavigation is replaced by the
browser closing the pipe. FrameHostMsg_AbortNavigation is replaced by
the renderer closing the pipe.
The new interface duplicates the CommitNavigation and
CommitFailedNavigation methods of the FrameNavigationControl interface.
These new methods are used instead of the old interface ones for
navigations that originated from a BeginNavigation. In future patches,
it will be a complete replacement for both renderer and browser
initiated navigations.
Note: This patch is fully behind the PerNavigationMojoInterface flag.
Please see
https://chromium-review.googlesource.com/c/chromium/src/+/1072469
for the trybot runs with the PerNavigationMojoInterface flag on.
Bug: 784904
Change-Id: Ifca1b3f6bdab1b3988f867c7cce44b7292e6668e
Reviewed-on: https://chromium-review.googlesource.com/881043
Commit-Queue: Arthur Hemery <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#562790}
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index 09b5766..0fc0e56 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -4,6 +4,7 @@
module content.mojom;
+import "content/common/navigation_client.mojom";
import "content/common/navigation_params.mojom";
import "content/common/service_worker/controller_service_worker.mojom";
import "content/common/url_loader_factory_bundle.mojom";
@@ -52,6 +53,8 @@
// Implemented by the frame provider and currently must be associated with the
// legacy IPC channel.
+// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
+// These will eventually be removed from FrameNavigationControl.
interface FrameNavigationControl {
// Tells the renderer that a navigation is ready to commit.
//
@@ -60,8 +63,7 @@
// be the result of the committed navigation.
//
// Note: |url_loader_client_endpoints| will be empty iff the navigation URL
- // wasn't handled by the network stack (i.e. JavaScript URLs, renderer debug
- // URLs, same document navigations, about:blank, ...)
+ // wasn't handled by the network stack (i.e. about:blank, ...)
//
// When the Network Service is enabled, |subresource_loader_factories| may
// also be provided by the browser as a a means for the renderer to load
@@ -274,10 +276,16 @@
// cloneable, and thus can't contain mojo interfaces.
// If an invalid BlobURLToken is passed in, or if the token doesn't match the
// url in |common_params|, the navigation will result in a network error.
+ // |navigation_client| is passed to the renderer to allow for further control
+ // of the navigation. Allows for Commit and Cancels/Aborts. It is only valid
+ // when PerNavigationMojoInterface is enabled.
+ // TODO(ahemery): |navigation_client| should not be optional. Make it
+ // mandatory when removing PerNavigationMojoInterface feature flag.
BeginNavigation(
CommonNavigationParams common_params,
BeginNavigationParams begin_params,
- blink.mojom.BlobURLToken? blob_url_token);
+ blink.mojom.BlobURLToken? blob_url_token,
+ associated NavigationClient? navigation_client);
// Sent when a subresource response has started.
// |cert_status| is the bitmask of status info of the SSL certificate. (see