| 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" | |
| 10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 11 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 12 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 14 #include "content/browser/bad_message.h" | 12 #include "content/browser/bad_message.h" |
| 15 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
| 16 #include "content/browser/frame_host/render_frame_host_impl.h" | 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 17 #include "content/browser/gpu/gpu_data_manager_impl.h" | 15 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 18 #include "content/browser/renderer_host/render_widget_helper.h" | 16 #include "content/browser/renderer_host/render_widget_helper.h" |
| 19 #include "content/common/frame_messages.h" | 17 #include "content/common/frame_messages.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 params.frame_owner_properties, *new_routing_id)); | 242 params.frame_owner_properties, *new_routing_id)); |
| 245 } | 243 } |
| 246 | 244 |
| 247 void RenderFrameMessageFilter::OnSetCookie(int render_frame_id, | 245 void RenderFrameMessageFilter::OnSetCookie(int render_frame_id, |
| 248 const GURL& url, | 246 const GURL& url, |
| 249 const GURL& first_party_for_cookies, | 247 const GURL& first_party_for_cookies, |
| 250 const std::string& cookie) { | 248 const std::string& cookie) { |
| 251 ChildProcessSecurityPolicyImpl* policy = | 249 ChildProcessSecurityPolicyImpl* policy = |
| 252 ChildProcessSecurityPolicyImpl::GetInstance(); | 250 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 253 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { | 251 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 | |
| 264 bad_message::ReceivedBadMessage(this, | 252 bad_message::ReceivedBadMessage(this, |
| 265 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); | 253 bad_message::RFMF_SET_COOKIE_BAD_ORIGIN); |
| 266 return; | 254 return; |
| 267 } | 255 } |
| 268 | 256 |
| 269 net::CookieOptions options; | 257 net::CookieOptions options; |
| 270 bool experimental_web_platform_features_enabled = | 258 bool experimental_web_platform_features_enabled = |
| 271 base::CommandLine::ForCurrentProcess()->HasSwitch( | 259 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 272 switches::kEnableExperimentalWebPlatformFeatures); | 260 switches::kEnableExperimentalWebPlatformFeatures); |
| 273 const std::string enforce_strict_secure_group = | 261 const std::string enforce_strict_secure_group = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 287 } | 275 } |
| 288 } | 276 } |
| 289 | 277 |
| 290 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, | 278 void RenderFrameMessageFilter::OnGetCookies(int render_frame_id, |
| 291 const GURL& url, | 279 const GURL& url, |
| 292 const GURL& first_party_for_cookies, | 280 const GURL& first_party_for_cookies, |
| 293 IPC::Message* reply_msg) { | 281 IPC::Message* reply_msg) { |
| 294 ChildProcessSecurityPolicyImpl* policy = | 282 ChildProcessSecurityPolicyImpl* policy = |
| 295 ChildProcessSecurityPolicyImpl::GetInstance(); | 283 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 296 if (!policy->CanAccessDataForOrigin(render_process_id_, url)) { | 284 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 | |
| 307 bad_message::ReceivedBadMessage(this, | 285 bad_message::ReceivedBadMessage(this, |
| 308 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); | 286 bad_message::RFMF_GET_COOKIES_BAD_ORIGIN); |
| 309 delete reply_msg; | 287 delete reply_msg; |
| 310 return; | 288 return; |
| 311 } | 289 } |
| 312 | 290 |
| 313 // If we crash here, figure out what URL the renderer was requesting. | 291 // If we crash here, figure out what URL the renderer was requesting. |
| 314 // http://crbug.com/99242 | 292 // http://crbug.com/99242 |
| 315 char url_buf[128]; | 293 char url_buf[128]; |
| 316 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); | 294 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 net::URLRequestContext* context = | 519 net::URLRequestContext* context = |
| 542 GetContentClient()->browser()->OverrideRequestContextForURL( | 520 GetContentClient()->browser()->OverrideRequestContextForURL( |
| 543 url, resource_context_); | 521 url, resource_context_); |
| 544 if (!context) | 522 if (!context) |
| 545 context = request_context_->GetURLRequestContext(); | 523 context = request_context_->GetURLRequestContext(); |
| 546 | 524 |
| 547 return context; | 525 return context; |
| 548 } | 526 } |
| 549 | 527 |
| 550 } // namespace content | 528 } // namespace content |
| OLD | NEW |