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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2652123002: PlzNavigate: Attempt to fix blink layout tests which fail due to duplicate output from WebFrameClie… (Closed)
Patch Set: Revert changes to blink ResourceRequest Created 3 years, 11 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 d005abc8ee4b5192f990e7cb6ce681db76665d1c..43b7e714b14b184674d646ca9d4dab8ec8cfd9dd 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -555,7 +555,8 @@ bool IsTopLevelNavigation(WebFrame* frame) {
WebURLRequest CreateURLRequestForNavigation(
const CommonNavigationParams& common_params,
std::unique_ptr<StreamOverrideParameters> stream_override,
- bool is_view_source_mode_enabled) {
+ bool is_view_source_mode_enabled,
+ int nav_entry_id) {
WebURLRequest request(common_params.url);
if (is_view_source_mode_enabled)
request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad);
@@ -578,6 +579,7 @@ WebURLRequest CreateURLRequestForNavigation(
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_stream_override(std::move(stream_override));
+ extra_data->set_navigation_initiated_by_renderer(nav_entry_id == 0);
request.setExtraData(extra_data);
// Set the ui timestamp for this navigation. Currently the timestamp here is
@@ -4349,6 +4351,16 @@ void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame,
navigation_state->start_params().transferred_request_child_id);
extra_data->set_transferred_request_request_id(
navigation_state->start_params().transferred_request_request_id);
+
+ // For navigation requests, we should copy the flag which indicates if this
+ // was a navigation initiated by the renderer to the new RequestExtraData
+ // instance.
+ RequestExtraData* current_request_data = static_cast<RequestExtraData*>(
+ request.getExtraData());
+ if (current_request_data) {
+ extra_data->set_navigation_initiated_by_renderer(
+ current_request_data->navigation_initiated_by_renderer());
+ }
}
request.setExtraData(extra_data);
@@ -5209,7 +5221,7 @@ void RenderFrameImpl::OnFailedNavigation(
CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
WebURLRequest failed_request = CreateURLRequestForNavigation(
common_params, std::unique_ptr<StreamOverrideParameters>(),
- frame_->isViewSourceModeEnabled());
+ frame_->isViewSourceModeEnabled(), request_params.nav_entry_id);
if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
// The browser expects this frame to be loading an error page. Inform it
@@ -5900,7 +5912,8 @@ void RenderFrameImpl::NavigateInternal(
WebHistoryItem item_for_history_navigation;
WebURLRequest request =
CreateURLRequestForNavigation(common_params, std::move(stream_params),
- frame_->isViewSourceModeEnabled());
+ frame_->isViewSourceModeEnabled(),
+ request_params.nav_entry_id);
request.setFrameType(IsTopLevelNavigation(frame_)
? blink::WebURLRequest::FrameTypeTopLevel
: blink::WebURLRequest::FrameTypeNested);

Powered by Google App Engine
This is Rietveld 408576698