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

Unified Diff: third_party/WebKit/Source/platform/network/NetworkUtils.cpp

Issue 2702503002: Block renderer-initiated main frame navigations to data URLs (Closed)
Patch Set: Cleanup 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: third_party/WebKit/Source/platform/network/NetworkUtils.cpp
diff --git a/third_party/WebKit/Source/platform/network/NetworkUtils.cpp b/third_party/WebKit/Source/platform/network/NetworkUtils.cpp
index ec49e5c3d93895bd2ef91c63c55c8e3093611b31..c0721f5078af5f9a0485b7fa88775bb88cb4259b 100644
--- a/third_party/WebKit/Source/platform/network/NetworkUtils.cpp
+++ b/third_party/WebKit/Source/platform/network/NetworkUtils.cpp
@@ -78,6 +78,19 @@ PassRefPtr<SharedBuffer> parseDataURL(const KURL& url,
return nullptr;
}
+PLATFORM_EXPORT bool getDataURLMimeType(const KURL& url,
+ AtomicString& mimetype,
+ bool* isSupportedMimeType) {
+ std::string utf8MimeType;
+ std::string utf8Charset;
+ if (net::DataURL::Parse(WebStringToGURL(url.getString()), &utf8MimeType,
+ &utf8Charset, nullptr)) {
+ *isSupportedMimeType = mime_util::IsSupportedMimeType(utf8MimeType);
+ return true;
+ }
+ return false;
+}
+
bool isRedirectResponseCode(int responseCode) {
return net::HttpResponseHeaders::IsRedirectResponseCode(responseCode);
}

Powered by Google App Engine
This is Rietveld 408576698