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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2429623002: LoadURLParams::extra_headers should not apply to subresource requests. (Closed)
Patch Set: Added a comment explaining why extra_headers should only apply to navigations. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 4201 matching lines...) Expand 10 before | Expand all | Expand 10 after
4212 extra_data->set_render_frame_id(routing_id_); 4212 extra_data->set_render_frame_id(routing_id_);
4213 extra_data->set_is_main_frame(!parent); 4213 extra_data->set_is_main_frame(!parent);
4214 extra_data->set_frame_origin( 4214 extra_data->set_frame_origin(
4215 url::Origin(frame->document().getSecurityOrigin()).GetURL()); 4215 url::Origin(frame->document().getSecurityOrigin()).GetURL());
4216 extra_data->set_parent_is_main_frame(parent && !parent->parent()); 4216 extra_data->set_parent_is_main_frame(parent && !parent->parent());
4217 extra_data->set_parent_render_frame_id(parent_routing_id); 4217 extra_data->set_parent_render_frame_id(parent_routing_id);
4218 extra_data->set_allow_download( 4218 extra_data->set_allow_download(
4219 navigation_state->common_params().allow_download); 4219 navigation_state->common_params().allow_download);
4220 extra_data->set_transition_type(transition_type); 4220 extra_data->set_transition_type(transition_type);
4221 extra_data->set_should_replace_current_entry(should_replace_current_entry); 4221 extra_data->set_should_replace_current_entry(should_replace_current_entry);
4222 // TODO(lukasza): https://crbug.com/656179: Navigational things (e.g.
4223 // StartNavigationParams) should not apply to subresource requests.
4222 extra_data->set_transferred_request_child_id( 4224 extra_data->set_transferred_request_child_id(
4223 navigation_state->start_params().transferred_request_child_id); 4225 navigation_state->start_params().transferred_request_child_id);
4224 extra_data->set_transferred_request_request_id( 4226 extra_data->set_transferred_request_request_id(
4225 navigation_state->start_params().transferred_request_request_id); 4227 navigation_state->start_params().transferred_request_request_id);
4226 extra_data->set_service_worker_provider_id(provider_id); 4228 extra_data->set_service_worker_provider_id(provider_id);
4227 extra_data->set_stream_override(std::move(stream_override)); 4229 extra_data->set_stream_override(std::move(stream_override));
4228 bool is_prefetch = 4230 bool is_prefetch =
4229 GetContentClient()->renderer()->IsPrefetchOnly(this, request); 4231 GetContentClient()->renderer()->IsPrefetchOnly(this, request);
4230 extra_data->set_is_prefetch(is_prefetch); 4232 extra_data->set_is_prefetch(is_prefetch);
4231 extra_data->set_download_to_network_cache_only( 4233 extra_data->set_download_to_network_cache_only(
(...skipping 14 matching lines...) Expand all
4246 } 4248 }
4247 } 4249 }
4248 4250
4249 // This is an instance where we embed a copy of the routing id 4251 // This is an instance where we embed a copy of the routing id
4250 // into the data portion of the message. This can cause problems if we 4252 // into the data portion of the message. This can cause problems if we
4251 // don't register this id on the browser side, since the download manager 4253 // don't register this id on the browser side, since the download manager
4252 // expects to find a RenderViewHost based off the id. 4254 // expects to find a RenderViewHost based off the id.
4253 request.setRequestorID(render_view_->GetRoutingID()); 4255 request.setRequestorID(render_view_->GetRoutingID());
4254 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); 4256 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture());
4255 4257
4256 if (!navigation_state->start_params().extra_headers.empty()) { 4258 // StartNavigationParams should only apply to navigational requests (and not
4259 // to subresource requests). For example - Content-Type header provided via
4260 // OpenURLParams::extra_headers should only be applied to the original POST
4261 // navigation request (and not to subresource requests).
4262 if (!navigation_state->start_params().extra_headers.empty() &&
4263 request.getFrameType() != WebURLRequest::FrameTypeNone) {
4257 for (net::HttpUtil::HeadersIterator i( 4264 for (net::HttpUtil::HeadersIterator i(
4258 navigation_state->start_params().extra_headers.begin(), 4265 navigation_state->start_params().extra_headers.begin(),
4259 navigation_state->start_params().extra_headers.end(), "\n"); 4266 navigation_state->start_params().extra_headers.end(), "\n");
4260 i.GetNext();) { 4267 i.GetNext();) {
4261 if (base::LowerCaseEqualsASCII(i.name(), "referer")) { 4268 if (base::LowerCaseEqualsASCII(i.name(), "referer")) {
4262 WebString referrer = WebSecurityPolicy::generateReferrerHeader( 4269 WebString referrer = WebSecurityPolicy::generateReferrerHeader(
4263 blink::WebReferrerPolicyDefault, 4270 blink::WebReferrerPolicyDefault,
4264 request.url(), 4271 request.url(),
4265 WebString::fromUTF8(i.values())); 4272 WebString::fromUTF8(i.values()));
4266 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); 4273 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault);
(...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after
6548 // event target. Potentially a Pepper plugin will receive the event. 6555 // event target. Potentially a Pepper plugin will receive the event.
6549 // In order to tell whether a plugin gets the last mouse event and which it 6556 // In order to tell whether a plugin gets the last mouse event and which it
6550 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6557 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6551 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6558 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6552 // |pepper_last_mouse_event_target_|. 6559 // |pepper_last_mouse_event_target_|.
6553 pepper_last_mouse_event_target_ = nullptr; 6560 pepper_last_mouse_event_target_ = nullptr;
6554 #endif 6561 #endif
6555 } 6562 }
6556 6563
6557 } // namespace content 6564 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698