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

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

Issue 2429623002: LoadURLParams::extra_headers should not apply to subresource requests. (Closed)
Patch Set: 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 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after
4213 extra_data->set_render_frame_id(routing_id_); 4213 extra_data->set_render_frame_id(routing_id_);
4214 extra_data->set_is_main_frame(!parent); 4214 extra_data->set_is_main_frame(!parent);
4215 extra_data->set_frame_origin( 4215 extra_data->set_frame_origin(
4216 url::Origin(frame->document().getSecurityOrigin()).GetURL()); 4216 url::Origin(frame->document().getSecurityOrigin()).GetURL());
4217 extra_data->set_parent_is_main_frame(parent && !parent->parent()); 4217 extra_data->set_parent_is_main_frame(parent && !parent->parent());
4218 extra_data->set_parent_render_frame_id(parent_routing_id); 4218 extra_data->set_parent_render_frame_id(parent_routing_id);
4219 extra_data->set_allow_download( 4219 extra_data->set_allow_download(
4220 navigation_state->common_params().allow_download); 4220 navigation_state->common_params().allow_download);
4221 extra_data->set_transition_type(transition_type); 4221 extra_data->set_transition_type(transition_type);
4222 extra_data->set_should_replace_current_entry(should_replace_current_entry); 4222 extra_data->set_should_replace_current_entry(should_replace_current_entry);
4223 // TODO(lukasza): https://crbug.com/656179: Navigational things (e.g.
4224 // StartNavigationParams) should not apply to subresource requests.
4223 extra_data->set_transferred_request_child_id( 4225 extra_data->set_transferred_request_child_id(
4224 navigation_state->start_params().transferred_request_child_id); 4226 navigation_state->start_params().transferred_request_child_id);
4225 extra_data->set_transferred_request_request_id( 4227 extra_data->set_transferred_request_request_id(
4226 navigation_state->start_params().transferred_request_request_id); 4228 navigation_state->start_params().transferred_request_request_id);
4227 extra_data->set_service_worker_provider_id(provider_id); 4229 extra_data->set_service_worker_provider_id(provider_id);
4228 extra_data->set_stream_override(std::move(stream_override)); 4230 extra_data->set_stream_override(std::move(stream_override));
4229 bool is_prefetch = 4231 bool is_prefetch =
4230 GetContentClient()->renderer()->IsPrefetchOnly(this, request); 4232 GetContentClient()->renderer()->IsPrefetchOnly(this, request);
4231 extra_data->set_is_prefetch(is_prefetch); 4233 extra_data->set_is_prefetch(is_prefetch);
4232 extra_data->set_download_to_network_cache_only( 4234 extra_data->set_download_to_network_cache_only(
(...skipping 14 matching lines...) Expand all
4247 } 4249 }
4248 } 4250 }
4249 4251
4250 // This is an instance where we embed a copy of the routing id 4252 // This is an instance where we embed a copy of the routing id
4251 // into the data portion of the message. This can cause problems if we 4253 // into the data portion of the message. This can cause problems if we
4252 // don't register this id on the browser side, since the download manager 4254 // don't register this id on the browser side, since the download manager
4253 // expects to find a RenderViewHost based off the id. 4255 // expects to find a RenderViewHost based off the id.
4254 request.setRequestorID(render_view_->GetRoutingID()); 4256 request.setRequestorID(render_view_->GetRoutingID());
4255 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); 4257 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture());
4256 4258
4257 if (!navigation_state->start_params().extra_headers.empty()) { 4259 if (!navigation_state->start_params().extra_headers.empty() &&
4260 request.getFrameType() != WebURLRequest::FrameTypeNone) {
Charlie Reis 2016/10/17 22:46:18 nit: Please add a comment here, similar to the TOD
Łukasz Anforowicz 2016/10/17 23:47:56 Done.
4258 for (net::HttpUtil::HeadersIterator i( 4261 for (net::HttpUtil::HeadersIterator i(
4259 navigation_state->start_params().extra_headers.begin(), 4262 navigation_state->start_params().extra_headers.begin(),
4260 navigation_state->start_params().extra_headers.end(), "\n"); 4263 navigation_state->start_params().extra_headers.end(), "\n");
4261 i.GetNext();) { 4264 i.GetNext();) {
4262 if (base::LowerCaseEqualsASCII(i.name(), "referer")) { 4265 if (base::LowerCaseEqualsASCII(i.name(), "referer")) {
4263 WebString referrer = WebSecurityPolicy::generateReferrerHeader( 4266 WebString referrer = WebSecurityPolicy::generateReferrerHeader(
4264 blink::WebReferrerPolicyDefault, 4267 blink::WebReferrerPolicyDefault,
4265 request.url(), 4268 request.url(),
4266 WebString::fromUTF8(i.values())); 4269 WebString::fromUTF8(i.values()));
4267 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); 4270 request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault);
(...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after
6554 // event target. Potentially a Pepper plugin will receive the event. 6557 // event target. Potentially a Pepper plugin will receive the event.
6555 // In order to tell whether a plugin gets the last mouse event and which it 6558 // In order to tell whether a plugin gets the last mouse event and which it
6556 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6559 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6557 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6560 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6558 // |pepper_last_mouse_event_target_|. 6561 // |pepper_last_mouse_event_target_|.
6559 pepper_last_mouse_event_target_ = nullptr; 6562 pepper_last_mouse_event_target_ = nullptr;
6560 #endif 6563 #endif
6561 } 6564 }
6562 6565
6563 } // namespace content 6566 } // 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