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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_tab_helper.cc

Issue 2973433003: Block redirects to renderer-debug urls. (Closed)
Patch Set: Nit: Charlie Harrison Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/captive_portal/captive_portal_tab_helper.h" 5 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/dump_without_crashing.h" 8 #include "base/debug/dump_without_crashing.h"
9 #include "chrome/browser/captive_portal/captive_portal_login_detector.h" 9 #include "chrome/browser/captive_portal/captive_portal_login_detector.h"
10 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" 10 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 void CaptivePortalTabHelper::DidStartNavigation( 58 void CaptivePortalTabHelper::DidStartNavigation(
59 content::NavigationHandle* navigation_handle) { 59 content::NavigationHandle* navigation_handle) {
60 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 60 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
61 if (!navigation_handle->IsInMainFrame() || 61 if (!navigation_handle->IsInMainFrame() ||
62 navigation_handle->IsSameDocument()) { 62 navigation_handle->IsSameDocument()) {
63 return; 63 return;
64 } 64 }
65 65
66 // TODO(clamy): Remove this when we understand the root cause behind 66 // TODO(clamy): The root cause behind crbug.com/704892 is known.
67 // crbug.com/704892. 67 // Remove this code if it is never reached until ~ 2017-July-10.
Charlie Reis 2017/07/07 17:12:59 Sorry for the delayed review. Might want to bump
arthursonzogni 2017/07/10 16:07:03 Done.
68 if (navigation_handle == navigation_handle_) 68 if (navigation_handle == navigation_handle_)
69 base::debug::DumpWithoutCrashing(); 69 base::debug::DumpWithoutCrashing();
70 70
71 bool was_tracking_navigation = !!navigation_handle_; 71 bool was_tracking_navigation = !!navigation_handle_;
72 navigation_handle_ = navigation_handle; 72 navigation_handle_ = navigation_handle;
73 73
74 // Always track the latest navigation. If a navigation was already tracked, 74 // Always track the latest navigation. If a navigation was already tracked,
75 // and it committed (either the navigation proper or an error page), it is 75 // and it committed (either the navigation proper or an error page), it is
76 // safe to start tracking the new navigation. Otherwise simulate an abort 76 // safe to start tracking the new navigation. Otherwise simulate an abort
77 // before reporting the start of the new navigation. 77 // before reporting the start of the new navigation.
(...skipping 11 matching lines...) Expand all
89 return; 89 return;
90 DCHECK(navigation_handle->IsInMainFrame()); 90 DCHECK(navigation_handle->IsInMainFrame());
91 tab_reloader_->OnRedirect( 91 tab_reloader_->OnRedirect(
92 navigation_handle->GetURL().SchemeIsCryptographic()); 92 navigation_handle->GetURL().SchemeIsCryptographic());
93 } 93 }
94 94
95 void CaptivePortalTabHelper::DidFinishNavigation( 95 void CaptivePortalTabHelper::DidFinishNavigation(
96 content::NavigationHandle* navigation_handle) { 96 content::NavigationHandle* navigation_handle) {
97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
98 98
99 // TODO(clamy): Remove this when we understand the root cause behind
100 // crbug.com/704892.
101 if (navigation_handle_ && !navigation_handle_->IsInMainFrame())
102 base::debug::DumpWithoutCrashing();
103
104 // Exclude subframe navigations. 99 // Exclude subframe navigations.
105 if (!navigation_handle->IsInMainFrame()) 100 if (!navigation_handle->IsInMainFrame())
106 return; 101 return;
107 102
108 // Exclude same-document navigations and aborted navigations that were not 103 // Exclude same-document navigations and aborted navigations that were not
109 // being tracked. 104 // being tracked.
110 if (navigation_handle_ != navigation_handle && 105 if (navigation_handle_ != navigation_handle &&
111 (!navigation_handle->HasCommitted() || 106 (!navigation_handle->HasCommitted() ||
112 navigation_handle->IsSameDocument())) { 107 navigation_handle->IsSameDocument())) {
113 return; 108 return;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 204 }
210 205
211 void CaptivePortalTabHelper::SetTabReloaderForTest( 206 void CaptivePortalTabHelper::SetTabReloaderForTest(
212 CaptivePortalTabReloader* tab_reloader) { 207 CaptivePortalTabReloader* tab_reloader) {
213 tab_reloader_.reset(tab_reloader); 208 tab_reloader_.reset(tab_reloader);
214 } 209 }
215 210
216 CaptivePortalTabReloader* CaptivePortalTabHelper::GetTabReloaderForTest() { 211 CaptivePortalTabReloader* CaptivePortalTabHelper::GetTabReloaderForTest() {
217 return tab_reloader_.get(); 212 return tab_reloader_.get();
218 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698