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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1180933002: Revert of Ensure the new navigation classifier works in the real world. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/render_frame_host_impl.h ('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/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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 // notification containing parameters identifying the navigation. 781 // notification containing parameters identifying the navigation.
782 // 782 //
783 // Subframes are identified by the page transition type. For subframes loaded 783 // Subframes are identified by the page transition type. For subframes loaded
784 // as part of a wider page load, the page_id will be the same as for the top 784 // as part of a wider page load, the page_id will be the same as for the top
785 // level frame. If the user explicitly requests a subframe navigation, we will 785 // level frame. If the user explicitly requests a subframe navigation, we will
786 // get a new page_id because we need to create a new navigation entry for that 786 // get a new page_id because we need to create a new navigation entry for that
787 // action. 787 // action.
788 void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) { 788 void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
789 // Read the parameters out of the IPC message directly to avoid making another 789 // Read the parameters out of the IPC message directly to avoid making another
790 // copy when we filter the URLs. 790 // copy when we filter the URLs.
791 ++commit_count_;
792 base::PickleIterator iter(msg); 791 base::PickleIterator iter(msg);
793 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; 792 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params;
794 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: 793 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>::
795 Read(&msg, &iter, &validated_params)) { 794 Read(&msg, &iter, &validated_params))
796 base::debug::SetCrashKeyValue("369661-earlyreturn",
797 CommitCountString() + "/badipc");
798 return; 795 return;
799 }
800 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDidCommitProvisionalLoad", 796 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDidCommitProvisionalLoad",
801 "url", validated_params.url.possibly_invalid_spec()); 797 "url", validated_params.url.possibly_invalid_spec());
802 798
803 // Sanity-check the page transition for frame type. 799 // Sanity-check the page transition for frame type.
804 DCHECK_EQ(ui::PageTransitionIsMainFrame(validated_params.transition), 800 DCHECK_EQ(ui::PageTransitionIsMainFrame(validated_params.transition),
805 !GetParent()); 801 !GetParent());
806 802
807 // If we're waiting for a cross-site beforeunload ack from this renderer and 803 // If we're waiting for a cross-site beforeunload ack from this renderer and
808 // we receive a Navigate message from the main frame, then the renderer was 804 // we receive a Navigate message from the main frame, then the renderer was
809 // navigating already and sent it before hearing the FrameMsg_Stop message. 805 // navigating already and sent it before hearing the FrameMsg_Stop message.
810 // We do not want to cancel the pending navigation in this case, since the 806 // We do not want to cancel the pending navigation in this case, since the
811 // old page will soon be stopped. Instead, treat this as a beforeunload ack 807 // old page will soon be stopped. Instead, treat this as a beforeunload ack
812 // to allow the pending navigation to continue. 808 // to allow the pending navigation to continue.
813 if (is_waiting_for_beforeunload_ack_ && 809 if (is_waiting_for_beforeunload_ack_ &&
814 unload_ack_is_for_navigation_ && 810 unload_ack_is_for_navigation_ &&
815 !GetParent()) { 811 !GetParent()) {
816 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_; 812 base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_;
817 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now()); 813 OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now());
818 base::debug::SetCrashKeyValue("369661-earlyreturn",
819 CommitCountString() + "/beforeunloadwait");
820 return; 814 return;
821 } 815 }
822 816
823 // If we're waiting for an unload ack from this renderer and we receive a 817 // If we're waiting for an unload ack from this renderer and we receive a
824 // Navigate message, then the renderer was navigating before it received the 818 // Navigate message, then the renderer was navigating before it received the
825 // unload request. It will either respond to the unload request soon or our 819 // unload request. It will either respond to the unload request soon or our
826 // timer will expire. Either way, we should ignore this message, because we 820 // timer will expire. Either way, we should ignore this message, because we
827 // have already committed to closing this renderer. 821 // have already committed to closing this renderer.
828 if (IsWaitingForUnloadACK()) { 822 if (IsWaitingForUnloadACK())
829 base::debug::SetCrashKeyValue("369661-earlyreturn",
830 CommitCountString() + "/unloadwait");
831 return; 823 return;
832 }
833 824
834 if (validated_params.report_type == 825 if (validated_params.report_type ==
835 FrameMsg_UILoadMetricsReportType::REPORT_LINK) { 826 FrameMsg_UILoadMetricsReportType::REPORT_LINK) {
836 UMA_HISTOGRAM_CUSTOM_TIMES( 827 UMA_HISTOGRAM_CUSTOM_TIMES(
837 "Navigation.UI_OnCommitProvisionalLoad.Link", 828 "Navigation.UI_OnCommitProvisionalLoad.Link",
838 base::TimeTicks::Now() - validated_params.ui_timestamp, 829 base::TimeTicks::Now() - validated_params.ui_timestamp,
839 base::TimeDelta::FromMilliseconds(10), base::TimeDelta::FromMinutes(10), 830 base::TimeDelta::FromMilliseconds(10), base::TimeDelta::FromMinutes(10),
840 100); 831 100);
841 } else if (validated_params.report_type == 832 } else if (validated_params.report_type ==
842 FrameMsg_UILoadMetricsReportType::REPORT_INTENT) { 833 FrameMsg_UILoadMetricsReportType::REPORT_INTENT) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 process->FilterURL(false, &(*it)); 865 process->FilterURL(false, &(*it));
875 } 866 }
876 process->FilterURL(true, &validated_params.searchable_form_url); 867 process->FilterURL(true, &validated_params.searchable_form_url);
877 868
878 // Without this check, the renderer can trick the browser into using 869 // Without this check, the renderer can trick the browser into using
879 // filenames it can't access in a future session restore. 870 // filenames it can't access in a future session restore.
880 if (!render_view_host_->CanAccessFilesOfPageState( 871 if (!render_view_host_->CanAccessFilesOfPageState(
881 validated_params.page_state)) { 872 validated_params.page_state)) {
882 bad_message::ReceivedBadMessage( 873 bad_message::ReceivedBadMessage(
883 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); 874 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE);
884 base::debug::SetCrashKeyValue("369661-earlyreturn",
885 CommitCountString() + "/fileaccess");
886 return; 875 return;
887 } 876 }
888 877
889 accessibility_reset_count_ = 0; 878 accessibility_reset_count_ = 0;
890 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 879 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
891 880
892 // PlzNavigate 881 // PlzNavigate
893 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 882 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
894 switches::kEnableBrowserSideNavigation)) { 883 switches::kEnableBrowserSideNavigation)) {
895 pending_commit_ = false; 884 pending_commit_ = false;
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 2067
2079 // We may be returning to an existing NavigationEntry that had been granted 2068 // We may be returning to an existing NavigationEntry that had been granted
2080 // file access. If this is a different process, we will need to grant the 2069 // file access. If this is a different process, we will need to grant the
2081 // access again. The files listed in the page state are validated when they 2070 // access again. The files listed in the page state are validated when they
2082 // are received from the renderer to prevent abuse. 2071 // are received from the renderer to prevent abuse.
2083 if (request_params.page_state.IsValid()) { 2072 if (request_params.page_state.IsValid()) {
2084 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); 2073 render_view_host_->GrantFileAccessFromPageState(request_params.page_state);
2085 } 2074 }
2086 } 2075 }
2087 2076
2088 std::string RenderFrameHostImpl::CommitCountString() {
2089 std::string result = base::Int64ToString(reinterpret_cast<int64_t>(this));
2090 result += "/";
2091 result += base::IntToString(commit_count_);
2092 return result;
2093 }
2094
2095 } // namespace content 2077 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698