Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2538)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2734633002: PlzNavigate: Fix the http/tests/loading/307-after-303-after-post.html and the http/tests/loading/re… (Closed)
Patch Set: Fix comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/web_frame_test_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 361093328fa14c5bef4a6bdd64d30120784e44be..15df435d5671f3f1cf8873cef03cd8172129ad12 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -3423,8 +3423,8 @@ void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame,
content_initiated));
}
-void RenderFrameImpl::didStartProvisionalLoad(
- blink::WebDataSource* data_source) {
+void RenderFrameImpl::didStartProvisionalLoad(blink::WebDataSource* data_source,
+ blink::WebURLRequest& request) {
// In fast/loader/stop-provisional-loads.html, we abort the load before this
// callback is invoked.
if (!data_source)
@@ -3433,6 +3433,27 @@ void RenderFrameImpl::didStartProvisionalLoad(
TRACE_EVENT2("navigation,benchmark,rail",
"RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
"url", data_source->getRequest().url().string().utf8());
+
+ // PlzNavigate:
+ // If we have a pending navigation to be sent to the browser send it here.
+ if (pending_navigation_info_.get()) {
+ DCHECK(IsBrowserSideNavigationEnabled());
+ NavigationPolicyInfo info(request);
+ info.navigationType = pending_navigation_info_->navigation_type;
+ info.defaultPolicy = pending_navigation_info_->policy;
+ info.replacesCurrentHistoryItem =
+ pending_navigation_info_->replaces_current_history_item;
+ info.isHistoryNavigationInNewChildFrame =
+ pending_navigation_info_->history_navigation_in_new_child_frame;
+ info.isClientRedirect = pending_navigation_info_->client_redirect;
+ info.isCacheDisabled = pending_navigation_info_->cache_disabled;
+ info.form = pending_navigation_info_->form;
+
+ pending_navigation_info_.reset(nullptr);
+
+ BeginNavigation(info);
+ }
+
DocumentState* document_state = DocumentState::FromDataSource(data_source);
NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
document_state->navigation_state());
@@ -5477,7 +5498,9 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
info.urlRequest.checkForBrowserSideNavigation() &&
ShouldMakeNetworkRequestForURL(url)) {
if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) {
- BeginNavigation(info);
+ // The BeginNavigation() call happens in didStartProvisionalLoad(). We
+ // need to save information about the navigation here.
+ pending_navigation_info_.reset(new PendingNavigationInfo(info));
return blink::WebNavigationPolicyHandledByClient;
} else {
LoadURLExternally(info.urlRequest, info.defaultPolicy);
@@ -5855,6 +5878,11 @@ void RenderFrameImpl::NavigateInternal(
std::unique_ptr<StreamOverrideParameters> stream_params) {
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
+ // PlzNavigate
+ // Clear pending navigations which weren't sent to the browser because we
+ // did not get a didStartProvisionalLoad() notification for them.
+ pending_navigation_info_.reset(nullptr);
+
// Lower bound for browser initiated navigation start time.
base::TimeTicks renderer_navigation_start = base::TimeTicks::Now();
bool is_reload =
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/web_frame_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698