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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1002803002: Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: intended Created 5 years, 8 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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 1e7ead77c322959ec7507d72fa9a3ff93b87fd8b..91999d9cd13c91b8cf5fbe46d034fd823468cecd 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1142,6 +1142,10 @@ void RenderFrameImpl::OnNavigate(
} else if (is_history_navigation) {
// We must know the page ID of the page we are navigating back to.
DCHECK_NE(request_params.page_id, -1);
+ // We must know the nav entry ID of the page we are navigating back to,
+ // which should be the case because history navigations are routed via the
+ // browser.
+ DCHECK_NE(0, request_params.nav_entry_id);
scoped_ptr<HistoryEntry> entry =
PageStateToHistoryEntry(request_params.page_state);
if (entry) {
@@ -2617,6 +2621,10 @@ void RenderFrameImpl::didFailProvisionalLoad(
const WebURLRequest& failed_request = ds->request();
+ DocumentState* document_state = DocumentState::FromDataSource(ds);
+ NavigationStateImpl* navigation_state =
+ static_cast<NavigationStateImpl*>(document_state->navigation_state());
+
// Notify the browser that we failed a provisional load with an error.
//
// Note: It is important this notification occur before DidStopLoading so the
@@ -2628,7 +2636,10 @@ void RenderFrameImpl::didFailProvisionalLoad(
FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
DidFailProvisionalLoad(error));
- SendFailedProvisionalLoad(failed_request, error, frame);
+ SendFailedProvisionalLoad(failed_request,
+ error,
+ navigation_state->request_params().nav_entry_id,
+ frame);
if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL))
return;
@@ -2636,10 +2647,6 @@ void RenderFrameImpl::didFailProvisionalLoad(
// Make sure we never show errors in view source mode.
frame->enableViewSourceMode(false);
- DocumentState* document_state = DocumentState::FromDataSource(ds);
- NavigationStateImpl* navigation_state =
- static_cast<NavigationStateImpl*>(document_state->navigation_state());
-
// If this is a failed back/forward/reload navigation, then we need to do a
// 'replace' load. This is necessary to avoid messing up session history.
// Otherwise, we do a normal load, which simulates a 'go' navigation as far
@@ -2726,18 +2733,7 @@ void RenderFrameImpl::didCommitProvisionalLoad(
render_view_->history_list_offset_ + 1;
}
} else {
- // Inspect the navigation_state on this frame to see if the navigation
- // corresponds to a session history navigation... Note: |frame| may or
- // may not be the toplevel frame, but for the case of capturing session
- // history, the first committed frame suffices. We keep track of whether
- // we've seen this commit before so that only capture session history once
- // per navigation.
- //
- // Note that we need to check if the page ID changed. In the case of a
- // reload, the page ID doesn't change, and UpdateSessionHistory gets the
- // previous URL and the current page ID, which would be wrong.
- if (navigation_state->request_params().page_id != -1 &&
- navigation_state->request_params().page_id != render_view_->page_id_) {
+ if (navigation_state->request_params().page_id != -1) {
// This is a successful session history navigation!
render_view_->page_id_ = navigation_state->request_params().page_id;
@@ -3894,8 +3890,12 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
params.http_status_code = response.httpStatusCode();
params.url_is_unreachable = ds->hasUnreachableURL();
params.is_post = false;
+ params.did_create_new_entry = commit_type == blink::WebStandardCommit;
+ params.intended_as_new_entry =
Charlie Reis 2015/04/24 22:02:02 nit: Move above did_create_new_entry if you do tha
Avi (use Gerrit) 2015/04/24 22:17:15 Done.
+ navigation_state->request_params().intended_as_new_entry;
params.post_id = -1;
params.page_id = render_view_->page_id_;
+ params.nav_entry_id = navigation_state->request_params().nav_entry_id;
// We need to track the RenderViewHost routing_id because of downstream
// dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager,
// ResourceDispatcherHostImpl, MediaStreamUIProxy,
@@ -4187,7 +4187,8 @@ void RenderFrameImpl::OnFailedNavigation(
WebURLRequest failed_request = CreateURLRequestForNavigation(
common_params, scoped_ptr<StreamOverrideParameters>(),
frame_->isViewSourceModeEnabled());
- SendFailedProvisionalLoad(failed_request, error, frame_);
+ SendFailedProvisionalLoad(
+ failed_request, error, request_params.nav_entry_id, frame_);
if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
Send(new FrameHostMsg_DidDropNavigation(routing_id_));
@@ -4707,12 +4708,14 @@ void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params,
void RenderFrameImpl::SendFailedProvisionalLoad(
const blink::WebURLRequest& request,
const blink::WebURLError& error,
+ int nav_entry_id,
blink::WebLocalFrame* frame) {
bool show_repost_interstitial = (error.reason == net::ERR_CACHE_MISS &&
EqualsASCII(request.httpMethod(), "POST"));
FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
params.error_code = error.reason;
+ params.nav_entry_id = nav_entry_id;
GetContentClient()->renderer()->GetNavigationErrorStrings(
render_view_.get(), frame, request, error, NULL,
&params.error_description);

Powered by Google App Engine
This is Rietveld 408576698