OLD | NEW |
---|---|
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/browser/frame_host/render_frame_message_filter.h" | 5 #include "content/browser/frame_host/render_frame_message_filter.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | |
9 #include "base/debug/dump_without_crashing.h" | |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "content/browser/bad_message.h" | 14 #include "content/browser/bad_message.h" |
13 #include "content/browser/child_process_security_policy_impl.h" | 15 #include "content/browser/child_process_security_policy_impl.h" |
14 #include "content/browser/frame_host/render_frame_host_impl.h" | 16 #include "content/browser/frame_host/render_frame_host_impl.h" |
15 #include "content/browser/gpu/gpu_data_manager_impl.h" | 17 #include "content/browser/gpu/gpu_data_manager_impl.h" |
16 #include "content/browser/renderer_host/render_widget_helper.h" | 18 #include "content/browser/renderer_host/render_widget_helper.h" |
17 #include "content/common/frame_messages.h" | 19 #include "content/common/frame_messages.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 params.frame_owner_properties, *new_routing_id)); | 244 params.frame_owner_properties, *new_routing_id)); |
243 } | 245 } |
244 | 246 |
245 void RenderFrameMessageFilter::OnSetCookie(int render_frame_id, | 247 void RenderFrameMessageFilter::OnSetCookie(int render_frame_id, |
246 const GURL& url, | 248 const GURL& url, |
247 const GURL& first_party_for_cookies, | 249 const GURL& first_party_for_cookies, |
248 const std::string& cookie) { | 250 const std::string& cookie) { |
249 ChildProcessSecurityPolicyImpl* policy = | 251 ChildProcessSecurityPolicyImpl* policy = |
250 ChildProcessSecurityPolicyImpl::GetInstance(); | 252 ChildProcessSecurityPolicyImpl::GetInstance(); |
251 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { | 253 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { |
254 { | |
255 // TODO(nick): Remove this once we understand http://crbug.com/600441 | |
256 auto origin_lock = policy->GetOriginLockCrashKey(render_process_id_); | |
257 base::debug::ScopedCrashKey("setcookies_url", | |
258 url.possibly_invalid_spec()); | |
259 base::debug::ScopedCrashKey( | |
260 "setcookies_first_party", | |
261 first_party_for_cookies.possibly_invalid_spec()); | |
262 base::debug::DumpWithoutCrashing(); | |
263 } | |
264 | |
252 bad_message::ReceivedBadMessage(this, | 265 bad_message::ReceivedBadMessage(this, |
253 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); | 266 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); |
254 return; | 267 return; |
255 } | 268 } |
256 | 269 |
257 net::CookieOptions options; | 270 net::CookieOptions options; |
258 bool experimental_web_platform_features_enabled = | 271 bool experimental_web_platform_features_enabled = |
259 base::CommandLine::ForCurrentProcess()->HasSwitch( | 272 base::CommandLine::ForCurrentProcess()->HasSwitch( |
260 switches::kEnableExperimentalWebPlatformFeatures); | 273 switches::kEnableExperimentalWebPlatformFeatures); |
261 const std::string enforce_strict_secure_group = | 274 const std::string enforce_strict_secure_group = |
(...skipping 14 matching lines...) Expand all Loading... | |
276 } | 289 } |
277 | 290 |
278 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, | 291 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, |
279 const GURL& url, | 292 const GURL& url, |
280 const GURL& first_party_for_cookies, | 293 const GURL& first_party_for_cookies, |
281 IPC::Message* reply_msg) { | 294 IPC::Message* reply_msg) { |
282 ChildProcessSecurityPolicyImpl* policy = | 295 ChildProcessSecurityPolicyImpl* policy = |
283 ChildProcessSecurityPolicyImpl::GetInstance(); | 296 ChildProcessSecurityPolicyImpl::GetInstance(); |
284 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { | 297 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { |
285 bad_message::ReceivedBadMessage(this, | 298 bad_message::ReceivedBadMessage(this, |
286 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); | 299 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); |
Charlie Reis
2016/05/03 17:33:34
Isn't this the more frequent kill? Maybe we shoul
ncarter (slow)
2016/05/03 18:50:34
Done.
| |
287 delete reply_msg; | 300 delete reply_msg; |
288 return; | 301 return; |
289 } | 302 } |
290 | 303 |
291 // If we crash here, figure out what URL the renderer was requesting. | 304 // If we crash here, figure out what URL the renderer was requesting. |
292 // http://crbug.com/99242 | 305 // http://crbug.com/99242 |
293 char url_buf[128]; | 306 char url_buf[128]; |
294 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); | 307 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); |
295 base::debug::Alias(url_buf); | 308 base::debug::Alias(url_buf); |
296 | 309 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 net::URLRequestContext* context = | 532 net::URLRequestContext* context = |
520 GetContentClient()->browser()->OverrideRequestContextForURL( | 533 GetContentClient()->browser()->OverrideRequestContextForURL( |
521 url, resource_context_); | 534 url, resource_context_); |
522 if (!context) | 535 if (!context) |
523 context = request_context_->GetURLRequestContext(); | 536 context = request_context_->GetURLRequestContext(); |
524 | 537 |
525 return context; | 538 return context; |
526 } | 539 } |
527 | 540 |
528 } // namespace content | 541 } // namespace content |
OLD | NEW |