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

Unified Diff: extensions/browser/extension_navigation_throttle.cc

Issue 2881733006: ExtensionNavigationThrottle: Enforce the same rules on redirect as we (Closed)
Patch Set: Merge branch 'kill_107_reboot2' into kill_107_reboot2_s Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_navigation_throttle.cc
diff --git a/extensions/browser/extension_navigation_throttle.cc b/extensions/browser/extension_navigation_throttle.cc
index 37ead6b0182a5c7869ac4802805a5671b8542f09..59761df67e22c5ae26849d8e88661b730967010a 100644
--- a/extensions/browser/extension_navigation_throttle.cc
+++ b/extensions/browser/extension_navigation_throttle.cc
@@ -32,7 +32,7 @@ ExtensionNavigationThrottle::ExtensionNavigationThrottle(
ExtensionNavigationThrottle::~ExtensionNavigationThrottle() {}
content::NavigationThrottle::ThrottleCheckResult
-ExtensionNavigationThrottle::WillStartRequest() {
+ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::WebContents* web_contents = navigation_handle()->GetWebContents();
ExtensionRegistry* registry =
@@ -153,6 +153,22 @@ ExtensionNavigationThrottle::WillStartRequest() {
return content::NavigationThrottle::PROCEED;
}
+content::NavigationThrottle::ThrottleCheckResult
+ExtensionNavigationThrottle::WillStartRequest() {
+ return WillStartOrRedirectRequest();
+}
+
+content::NavigationThrottle::ThrottleCheckResult
+ExtensionNavigationThrottle::WillRedirectRequest() {
+ ThrottleCheckResult result = WillStartOrRedirectRequest();
+ if (result == BLOCK_REQUEST) {
+ // BLOCK_REQUEST is on redirect does not work without PlzNavigate, so
Devlin 2017/05/18 15:22:44 s/is on/on Should this be a TODO? And should we
ncarter (slow) 2017/05/22 22:55:59 Added a TODO. The least risky thing to do, I thin
+ // translate these errors into CANCEL.
+ return CANCEL;
+ }
+ return result;
+}
+
const char* ExtensionNavigationThrottle::GetNameForLogging() {
return "ExtensionNavigationThrottle";
}

Powered by Google App Engine
This is Rietveld 408576698