forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnavigation_client.mojom
257 lines (218 loc) · 11.1 KB
/
navigation_client.mojom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module content.mojom;
import "content/common/frame_messages.mojom";
import "content/common/navigation_params.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/host_resolver.mojom";
import "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
import "services/network/public/mojom/url_response_head.mojom";
import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
import "third_party/blink/public/mojom/permissions_policy/document_policy_feature.mojom";
import "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom";
import "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom";
import "third_party/blink/public/mojom/permissions_policy/policy_value.mojom";
import "third_party/blink/public/mojom/frame/policy_container.mojom";
import "third_party/blink/public/mojom/loader/referrer.mojom";
import "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom";
import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
import "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/url.mojom";
[Native]
enum NavigationGesture;
[Native]
enum PageTransition;
[Native]
struct PageState;
// Parameters structure used in the IPC:
// - FrameHost.DidCommitProvisionalLoad
// - FrameHost.DidCommitSameDocumentNavigation
// - NavigationClient.CommitNavigationCallback
// - NavigationClient.CommitFailedNavigationCallback
struct DidCommitProvisionalLoadParams {
// The item sequence number identifies each stop in the session history. It
// is unique within the renderer process and makes a best effort to be unique
// across browser sessions (using a renderer process timestamp).
int64 item_sequence_number = -1;
// The document sequence number is used to identify cross-document navigations
// in session history. It increments for each new document and is unique in
// the same way as |item_sequence_number|. In-page navigations get a new item
// sequence number but the same document sequence number.
int64 document_sequence_number = -1;
// Identifies a specific "slot" in the session history for the appHistory API.
// appHistory.goTo() is given a key, which matches against this to find the
// correct entry to navigate to.
string app_history_key;
// URL of the page being loaded.
url.mojom.Url url;
// URL of the referrer of this load. WebKit generates this based on the
// source of the event that caused the load.
blink.mojom.Referrer referrer;
// The type of transition.
// [Native] enums are by default initialized to 0 (i.e. PAGE_TRANSITION_LINK)
PageTransition transition;
// Set to false if we want to update the session history but not update
// the browser history. E.g., on unreachable urls.
bool should_update_history = false;
// Contents MIME type of main frame.
string contents_mime_type;
// This is the value from the browser (copied from the navigation request)
// indicating whether it intended to make a new entry. TODO(avi): Remove this
// when the pending entry situation is made sane and the browser keeps them
// around long enough to match them via nav_entry_id.
bool intended_as_new_entry;
// Whether this commit created a new entry.
bool did_create_new_entry;
// Whether this commit should replace the current entry.
bool should_replace_current_entry;
// The gesture that initiated this navigation.
NavigationGesture gesture;
// The HTTP method used by the navigation.
string method;
// The POST body identifier. -1 if it doesn't exist.
int64 post_id;
// The status code of the HTTP request.
int32 http_status_code;
// This flag is used to warn if the renderer is displaying an error page,
// so that we can set the appropriate page type.
bool url_is_unreachable;
// Serialized history item state to store in the navigation entry.
PageState page_state;
// User agent override used to navigate.
bool is_overriding_user_agent;
// Notifies the browser that for this navigation, the session history was
// successfully cleared.
bool history_list_was_cleared;
// Origin of the frame. This will be replicated to any associated
// RenderFrameProxies.
url.mojom.Origin origin;
// The 'Permissions-Policy' headers applied to the document.
// https://w3c.github.io/webappsec-permissions-policy/#permissions-policy-http-header-field
// Note: For backward compatibility, this field also contains
// 'Feature-Policy' headers applied to the document.
array<blink.mojom.ParsedPermissionsPolicyDeclaration>
permissions_policy_header;
// The 'Document-Policy' headers applied to the document.
// https://w3c.github.io/webappsec-permissions-policy/document-policy.html
map<blink.mojom.DocumentPolicyFeature, blink.mojom.PolicyValue>
document_policy_header;
// The insecure request policy the document for the load is enforcing.
blink.mojom.InsecureRequestPolicy insecure_request_policy;
// The upgrade insecure navigations set the document for the load is
// enforcing.
array<uint32> insecure_navigations_set;
// True if the document for the load is a unique origin that should be
// considered potentially trustworthy.
bool has_potentially_trustworthy_unique_origin;
// Request ID generated by the renderer.
int32 request_id;
// A token that has been passed by the browser process when it asked the
// renderer process to commit the navigation.
mojo_base.mojom.UnguessableToken navigation_token;
// An embedding token used to signify the relationship between a document and
// its parent. This is populated for cross-document navigations including
// sub-documents and the main document.
mojo_base.mojom.UnguessableToken? embedding_token;
// Start and end timestamps for running the unload event on the old document
// before this navigation replaced it. This is only valid for same-process
// navigations, where the unload handler on the old document runs
// synchronously before the new document is allowed to commit.
mojo_base.mojom.TimeTicks? unload_start;
mojo_base.mojom.TimeTicks? unload_end;
// Timestamp of when this frame committed its navigation.
mojo_base.mojom.TimeTicks? commit_navigation_end;
};
// Similar to DidCommitProvisionalLoadParams, but only used for
// FrameHost.DidCommitSameDocumentNavigation. Eventually, all parameters in
// DidCommitProvisionalLoadParams will either get removed or moved to
// DidCommitSameDocumentNavigationParams.
// See https://crbug.com/1133115, https://crbug.com/1131832
struct DidCommitSameDocumentNavigationParams {
// Will be true if the navigation is the result of history.pushState or
// history.replaceState.
// TODO(crbug.com/1131832): Port SameDocumentNavigationSource enum to mojo
// and use that instead of bool here.
bool is_history_api_navigation = false;
// Whether the navigation is a result of a client redirect (e.g. a
// script-initiated navigation) or not (e.g. a link click).
bool is_client_redirect = false;
};
interface NavigationClient {
// Tells the renderer that a navigation is ready to commit.
//
// The renderer should bind the |url_loader_client_endpoints| to an
// URLLoaderClient implementation to continue loading the document that will
// 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. about:blank, ...)
//
// Note: |response_body| will be invalid iff the navigation URL 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
// subresources where applicable.
//
// |controller_service_worker_info| may also be provided by the browser if the
// frame that is being navigated is supposed to be controlled by a Service
// Worker.
// |container_info| may also be provided if the browser has created a
// ServiceWorkerContainerHost for this navigation.
// |prefetch_loader_factory| is populated only when Network Service is
// enabled. The pointer is used to start a prefetch loading via the browser
// process.
//
// For automation driver-initiated navigations over the devtools protocol,
// |devtools_navigation_token_| is used to tag the navigation. This navigation
// token is then sent into the renderer and lands on the DocumentLoader. That
// way subsequent Blink-level frame lifecycle events can be associated with
// the concrete navigation.
// - The value should not be sent back to the browser.
// - The value on DocumentLoader may be generated in the renderer in some
// cases, and thus shouldn't be trusted.
// TODO(crbug.com/783506): Replace devtools navigation token with the generic
// navigation token that can be passed from renderer to the browser.
CommitNavigation(
CommonNavigationParams common_params,
CommitNavigationParams request_params,
network.mojom.URLResponseHead response_head,
handle<data_pipe_consumer>? response_body,
network.mojom.URLLoaderClientEndpoints? url_loader_client_endpoints,
blink.mojom.URLLoaderFactoryBundle? subresource_loader_factories,
array<blink.mojom.TransferrableURLLoader>? subresource_overrides,
blink.mojom.ControllerServiceWorkerInfo? controller_service_worker_info,
blink.mojom.ServiceWorkerContainerInfoForClient? container_info,
pending_remote<network.mojom.URLLoaderFactory>? prefetch_loader_factory,
mojo_base.mojom.UnguessableToken devtools_navigation_token,
blink.mojom.PolicyContainer policy_container)
=> (DidCommitProvisionalLoadParams params,
DidCommitProvisionalLoadInterfaceParams? interface_params);
// Tells the renderer that a failed navigation is ready to commit.
//
// The result of this commit usually results in displaying an error page.
// Note |error_page_content| may contain the content of the error page
// (i.e. flattened HTML, JS, CSS).
//
// When the Network Service is enabled, |subresource_loader_factories| may
// also be provided by the browser as a means for the renderer to load
// subresources where applicable.
CommitFailedNavigation(
CommonNavigationParams common_params,
CommitNavigationParams request_params,
bool has_stale_copy_in_cache,
int32 error_code,
int32 extended_error_code,
network.mojom.ResolveErrorInfo resolve_error_info,
string? error_page_content,
blink.mojom.URLLoaderFactoryBundle? subresource_loader_factories,
blink.mojom.PolicyContainer policy_container)
=> (DidCommitProvisionalLoadParams params,
DidCommitProvisionalLoadInterfaceParams? interface_params);
};