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

Unified Diff: content/common/navigation_params.cc

Issue 2760463005: Fix handling of external protocols with PlzNavigate. (Closed)
Patch Set: review comments Created 3 years, 9 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: content/common/navigation_params.cc
diff --git a/content/common/navigation_params.cc b/content/common/navigation_params.cc
index b36b744ba17e28b3a3df92784dfe666e5a69f82d..16ddaf7c060b672da7795f08ee98a4cfa88d4ca3 100644
--- a/content/common/navigation_params.cc
+++ b/content/common/navigation_params.cc
@@ -12,6 +12,7 @@
#include "content/public/common/url_constants.h"
#include "url/gurl.h"
#include "url/url_constants.h"
+#include "url/url_util.h"
namespace content {
@@ -19,11 +20,19 @@ namespace content {
bool ShouldMakeNetworkRequestForURL(const GURL& url) {
CHECK(IsBrowserSideNavigationEnabled());
- // Javascript URLs, about:blank, srcdoc should not send a request
- // to the network stack.
- return !url.IsAboutBlank() && !url.SchemeIs(url::kJavaScriptScheme) &&
- !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
- url != content::kAboutSrcDocURL;
+ // Javascript URLs, srcdoc, schemes that don't load data should not send a
+ // request to the network stack.
+ if (url.SchemeIs(url::kJavaScriptScheme) || url.is_empty() ||
+ url.SchemeIs(url::kContentIDScheme) || url == content::kAboutSrcDocURL) {
+ return false;
+ }
+
+ for (const auto& scheme : url::GetEmptyDocumentSchemes()) {
+ if (url.SchemeIs(scheme))
+ return false;
+ }
+
+ return true;
}
SourceLocation::SourceLocation() : line_number(0), column_number(0) {}

Powered by Google App Engine
This is Rietveld 408576698