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_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/debug/crash_logging.h" | |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/metrics/user_metrics_action.h" | 13 #include "base/metrics/user_metrics_action.h" |
14 #include "base/strings/string_number_conversions.h" | |
13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
14 #include "content/browser/accessibility/accessibility_mode_helper.h" | 16 #include "content/browser/accessibility/accessibility_mode_helper.h" |
15 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
16 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 18 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
17 #include "content/browser/child_process_security_policy_impl.h" | 19 #include "content/browser/child_process_security_policy_impl.h" |
18 #include "content/browser/frame_host/cross_process_frame_connector.h" | 20 #include "content/browser/frame_host/cross_process_frame_connector.h" |
19 #include "content/browser/frame_host/cross_site_transferring_request.h" | 21 #include "content/browser/frame_host/cross_site_transferring_request.h" |
20 #include "content/browser/frame_host/frame_tree.h" | 22 #include "content/browser/frame_host/frame_tree.h" |
21 #include "content/browser/frame_host/frame_tree_node.h" | 23 #include "content/browser/frame_host/frame_tree_node.h" |
22 #include "content/browser/frame_host/navigator.h" | 24 #include "content/browser/frame_host/navigator.h" |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 GetProcess()->FilterURL(false, &validated_url); | 552 GetProcess()->FilterURL(false, &validated_url); |
551 | 553 |
552 frame_tree_node_->navigator()->DidFailLoadWithError( | 554 frame_tree_node_->navigator()->DidFailLoadWithError( |
553 this, validated_url, error_code, error_description); | 555 this, validated_url, error_code, error_description); |
554 } | 556 } |
555 | 557 |
556 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( | 558 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( |
557 int32 page_id, | 559 int32 page_id, |
558 const GURL& source_url, | 560 const GURL& source_url, |
559 const GURL& target_url) { | 561 const GURL& target_url) { |
562 if (render_view_host_->page_id_ != page_id) { | |
563 base::debug::SetCrashKeyValue("url1", | |
Charlie Reis
2014/08/20 20:22:30
Once we have the data, what will the URL tell us?
Avi (use Gerrit)
2014/08/20 20:29:20
I have no experience in debugging situations like
Charlie Reis
2014/08/20 20:44:47
Well, I could be wrong-- the URL might lead to a r
Avi (use Gerrit)
2014/08/20 21:00:02
No disagreement there.
| |
564 source_url.possibly_invalid_spec()); | |
565 base::debug::SetCrashKeyValue("url2", | |
566 target_url.possibly_invalid_spec()); | |
567 base::debug::SetCrashKeyValue( | |
568 "id1", base::IntToString(render_view_host_->page_id_)); | |
569 base::debug::SetCrashKeyValue("id2", | |
570 base::IntToString(page_id)); | |
571 CHECK(false); | |
572 } | |
560 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( | 573 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( |
561 this, page_id, source_url, target_url); | 574 this, render_view_host_->page_id_, source_url, target_url); |
562 } | 575 } |
563 | 576 |
564 // Called when the renderer navigates. For every frame loaded, we'll get this | 577 // Called when the renderer navigates. For every frame loaded, we'll get this |
565 // notification containing parameters identifying the navigation. | 578 // notification containing parameters identifying the navigation. |
566 // | 579 // |
567 // Subframes are identified by the page transition type. For subframes loaded | 580 // Subframes are identified by the page transition type. For subframes loaded |
568 // as part of a wider page load, the page_id will be the same as for the top | 581 // as part of a wider page load, the page_id will be the same as for the top |
569 // level frame. If the user explicitly requests a subframe navigation, we will | 582 // level frame. If the user explicitly requests a subframe navigation, we will |
570 // get a new page_id because we need to create a new navigation entry for that | 583 // get a new page_id because we need to create a new navigation entry for that |
571 // action. | 584 // action. |
572 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) { | 585 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) { |
573 // Read the parameters out of the IPC message directly to avoid making another | 586 // Read the parameters out of the IPC message directly to avoid making another |
574 // copy when we filter the URLs. | 587 // copy when we filter the URLs. |
575 PickleIterator iter(msg); | 588 PickleIterator iter(msg); |
576 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; | 589 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; |
577 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: | 590 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: |
578 Read(&msg, &iter, &validated_params)) | 591 Read(&msg, &iter, &validated_params)) |
579 return; | 592 return; |
580 | 593 |
594 // Update the RVH's current page ID so that future IPCs from the renderer | |
595 // correspond to the new page. | |
596 render_view_host_->page_id_ = validated_params.page_id; | |
597 | |
581 // If we're waiting for a cross-site beforeunload ack from this renderer and | 598 // If we're waiting for a cross-site beforeunload ack from this renderer and |
582 // we receive a Navigate message from the main frame, then the renderer was | 599 // we receive a Navigate message from the main frame, then the renderer was |
583 // navigating already and sent it before hearing the ViewMsg_Stop message. | 600 // navigating already and sent it before hearing the ViewMsg_Stop message. |
584 // We do not want to cancel the pending navigation in this case, since the | 601 // We do not want to cancel the pending navigation in this case, since the |
585 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 602 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
586 // to allow the pending navigation to continue. | 603 // to allow the pending navigation to continue. |
587 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 604 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
588 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 605 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
589 PageTransitionIsMainFrame(validated_params.transition)) { | 606 PageTransitionIsMainFrame(validated_params.transition)) { |
590 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 607 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 void RenderFrameHostImpl::OnDidDisownOpener() { | 912 void RenderFrameHostImpl::OnDidDisownOpener() { |
896 // This message is only sent for top-level frames. TODO(avi): when frame tree | 913 // This message is only sent for top-level frames. TODO(avi): when frame tree |
897 // mirroring works correctly, add a check here to enforce it. | 914 // mirroring works correctly, add a check here to enforce it. |
898 delegate_->DidDisownOpener(this); | 915 delegate_->DidDisownOpener(this); |
899 } | 916 } |
900 | 917 |
901 void RenderFrameHostImpl::OnUpdateTitle( | 918 void RenderFrameHostImpl::OnUpdateTitle( |
902 int32 page_id, | 919 int32 page_id, |
903 const base::string16& title, | 920 const base::string16& title, |
904 blink::WebTextDirection title_direction) { | 921 blink::WebTextDirection title_direction) { |
922 if (render_view_host_->page_id_ != page_id) { | |
923 base::debug::SetCrashKeyValue( | |
924 "url1", GetLastCommittedURL().possibly_invalid_spec()); | |
Charlie Reis
2014/08/20 20:22:30
It's possible for GetLastCommittedURL to return nu
Avi (use Gerrit)
2014/08/20 20:29:20
Would that be a failure, though? Before the commit
Charlie Reis
2014/08/20 20:44:47
Ah, you're right, GetLastCommittedEntry can return
| |
925 base::debug::SetCrashKeyValue( | |
926 "id1", base::IntToString(render_view_host_->page_id_)); | |
927 base::debug::SetCrashKeyValue("id2", | |
928 base::IntToString(page_id)); | |
929 CHECK(false); | |
930 } | |
905 // This message is only sent for top-level frames. TODO(avi): when frame tree | 931 // This message is only sent for top-level frames. TODO(avi): when frame tree |
906 // mirroring works correctly, add a check here to enforce it. | 932 // mirroring works correctly, add a check here to enforce it. |
907 if (title.length() > kMaxTitleChars) { | 933 if (title.length() > kMaxTitleChars) { |
908 NOTREACHED() << "Renderer sent too many characters in title."; | 934 NOTREACHED() << "Renderer sent too many characters in title."; |
909 return; | 935 return; |
910 } | 936 } |
911 | 937 |
912 delegate_->UpdateTitle(this, page_id, title, | 938 delegate_->UpdateTitle(this, render_view_host_->page_id_, title, |
913 WebTextDirectionToChromeTextDirection( | 939 WebTextDirectionToChromeTextDirection( |
914 title_direction)); | 940 title_direction)); |
915 } | 941 } |
916 | 942 |
917 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { | 943 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { |
918 // This message is only sent for top-level frames. TODO(avi): when frame tree | 944 // This message is only sent for top-level frames. TODO(avi): when frame tree |
919 // mirroring works correctly, add a check here to enforce it. | 945 // mirroring works correctly, add a check here to enforce it. |
920 delegate_->UpdateEncoding(this, encoding_name); | 946 delegate_->UpdateEncoding(this, encoding_name); |
921 } | 947 } |
922 | 948 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1236 } | 1262 } |
1237 | 1263 |
1238 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 1264 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
1239 // Clear any state if a pending navigation is canceled or preempted. | 1265 // Clear any state if a pending navigation is canceled or preempted. |
1240 if (suspended_nav_params_) | 1266 if (suspended_nav_params_) |
1241 suspended_nav_params_.reset(); | 1267 suspended_nav_params_.reset(); |
1242 navigations_suspended_ = false; | 1268 navigations_suspended_ = false; |
1243 } | 1269 } |
1244 | 1270 |
1245 } // namespace content | 1271 } // namespace content |
OLD | NEW |