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("cookie_url", url.possibly_invalid_spec()); |
| 258 base::debug::ScopedCrashKey( |
| 259 "cookie_first_party", |
| 260 first_party_for_cookies.possibly_invalid_spec()); |
| 261 base::debug::DumpWithoutCrashing(); |
| 262 } |
| 263 |
252 bad_message::ReceivedBadMessage(this, | 264 bad_message::ReceivedBadMessage(this, |
253 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); | 265 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); |
254 return; | 266 return; |
255 } | 267 } |
256 | 268 |
257 net::CookieOptions options; | 269 net::CookieOptions options; |
258 bool experimental_web_platform_features_enabled = | 270 bool experimental_web_platform_features_enabled = |
259 base::CommandLine::ForCurrentProcess()->HasSwitch( | 271 base::CommandLine::ForCurrentProcess()->HasSwitch( |
260 switches::kEnableExperimentalWebPlatformFeatures); | 272 switches::kEnableExperimentalWebPlatformFeatures); |
261 const std::string enforce_strict_secure_group = | 273 const std::string enforce_strict_secure_group = |
(...skipping 13 matching lines...) Expand all Loading... |
275 } | 287 } |
276 } | 288 } |
277 | 289 |
278 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, | 290 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, |
279 const GURL& url, | 291 const GURL& url, |
280 const GURL& first_party_for_cookies, | 292 const GURL& first_party_for_cookies, |
281 IPC::Message* reply_msg) { | 293 IPC::Message* reply_msg) { |
282 ChildProcessSecurityPolicyImpl* policy = | 294 ChildProcessSecurityPolicyImpl* policy = |
283 ChildProcessSecurityPolicyImpl::GetInstance(); | 295 ChildProcessSecurityPolicyImpl::GetInstance(); |
284 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { | 296 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { |
| 297 { |
| 298 // TODO(nick): Remove this once we understand http://crbug.com/600441 |
| 299 auto origin_lock = policy->GetOriginLockCrashKey(render_process_id_); |
| 300 base::debug::ScopedCrashKey("cookie_url", url.possibly_invalid_spec()); |
| 301 base::debug::ScopedCrashKey( |
| 302 "cookie_first_party", |
| 303 first_party_for_cookies.possibly_invalid_spec()); |
| 304 base::debug::DumpWithoutCrashing(); |
| 305 } |
| 306 |
285 bad_message::ReceivedBadMessage(this, | 307 bad_message::ReceivedBadMessage(this, |
286 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); | 308 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); |
287 delete reply_msg; | 309 delete reply_msg; |
288 return; | 310 return; |
289 } | 311 } |
290 | 312 |
291 // If we crash here, figure out what URL the renderer was requesting. | 313 // If we crash here, figure out what URL the renderer was requesting. |
292 // http://crbug.com/99242 | 314 // http://crbug.com/99242 |
293 char url_buf[128]; | 315 char url_buf[128]; |
294 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); | 316 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 net::URLRequestContext* context = | 541 net::URLRequestContext* context = |
520 GetContentClient()->browser()->OverrideRequestContextForURL( | 542 GetContentClient()->browser()->OverrideRequestContextForURL( |
521 url, resource_context_); | 543 url, resource_context_); |
522 if (!context) | 544 if (!context) |
523 context = request_context_->GetURLRequestContext(); | 545 context = request_context_->GetURLRequestContext(); |
524 | 546 |
525 return context; | 547 return context; |
526 } | 548 } |
527 | 549 |
528 } // namespace content | 550 } // namespace content |
OLD | NEW |