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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: PlzNavigate: preserve SourceLocation when navigating Created 3 years, 10 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 4af9b671725620814b3f5d10384a881f4c68d83a..68465f26085c8c1ede979a5127e4f6ec561a950d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -675,6 +675,13 @@ CommonNavigationParams MakeCommonNavigationParams(
navigation_type = FrameMsg_Navigate_Type::RELOAD;
}
+ base::Optional<SourceLocation> source_location;
+ if (info.hasSourceLocation) {
+ source_location = SourceLocation(info.sourceLocation.url.latin1(),
+ info.sourceLocation.lineNumber,
+ info.sourceLocation.columnNumber);
+ }
+
const RequestExtraData* extra_data =
static_cast<RequestExtraData*>(info.urlRequest.getExtraData());
DCHECK(extra_data);
@@ -684,7 +691,7 @@ CommonNavigationParams MakeCommonNavigationParams(
report_type, GURL(), GURL(),
static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
- GetRequestBodyForWebURLRequest(info.urlRequest));
+ GetRequestBodyForWebURLRequest(info.urlRequest), source_location);
}
media::Context3D GetSharedMainThreadContext3D(
@@ -3415,6 +3422,20 @@ void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame,
// UnloadEventStart and UnloadEventEnd are still missing.
}
+ // PlzNavigate: update the source location before processing the navigation
+ // commit.
+ if (IsBrowserSideNavigationEnabled() &&
+ navigation_state->common_params().source_location.has_value()) {
+ blink::WebSourceLocation source_location;
+ source_location.url = WebString::fromLatin1(
+ navigation_state->common_params().source_location->url);
+ source_location.lineNumber =
+ navigation_state->common_params().source_location->line_number;
+ source_location.columnNumber =
+ navigation_state->common_params().source_location->column_number;
+ datasource->setSourceLocation(source_location);
+ }
+
// Create the serviceworker's per-document network observing object if it
// does not exist (When navigation happens within a page, the provider already
// exists).
@@ -6079,6 +6100,14 @@ void RenderFrameImpl::NavigateInternal(
// In case LoadRequest failed before didCreateDataSource was called.
pending_navigation_params_.reset();
+
+ // PlzNavigate: reset the source location now that the commit checks have been
+ // processed.
+ if (IsBrowserSideNavigationEnabled()) {
+ frame_->dataSource()->resetSourceLocation();
Nate Chapin 2017/03/01 23:22:19 Rather than needing to expose resetSourceLocation(
clamy 2017/03/02 13:34:32 The problem is that we're going to do an IPC befor
Nate Chapin 2017/03/03 00:17:05 So the flow of that case would be: * Start navigat
clamy 2017/03/06 13:27:53 That's the case I'm concerned about. Given how the
Nate Chapin 2017/03/13 17:45:42 Ok, I think I can live with this. The combination
+ if (frame_->provisionalDataSource())
+ frame_->provisionalDataSource()->resetSourceLocation();
+ }
}
void RenderFrameImpl::UpdateEncoding(WebFrame* frame,

Powered by Google App Engine
This is Rietveld 408576698