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

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

Issue 2702503002: Block renderer-initiated main frame navigations to data URLs (Closed)
Patch Set: nasko comments Created 3 years, 8 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 f5e93f1e25675e1a3f1a32e084aa7697fb51726a..d728be05f44004791f96e10a85eb993c646f7e80 100644
--- a/third_party/WebKit/Source/platform/network/NetworkUtils.cpp
+++ b/third_party/WebKit/Source/platform/network/NetworkUtils.cpp
@@ -105,6 +105,19 @@ PassRefPtr<SharedBuffer> parseDataURLAndPopulateResponse(
return data;
}
+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,
kinuko 2017/04/07 07:52:34 WebURL(url) should work (and more efficient)
meacer 2017/04/11 01:08:51 I'm getting error: no viable conversion from 'bl
kinuko 2017/04/13 07:28:18 Um, ok sorry we're in blink where operator GURL is
+ &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