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

Unified Diff: third_party/WebKit/Source/core/html/parser/PreloadRequest.h

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: fix up Created 4 years, 2 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/core/html/parser/PreloadRequest.h
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
index 3b5722e5c01b10eb24cfb89c77f39959128f56a8..2c4ceeb42b157b064dfd182ac1ee1359ecd5fea2 100644
--- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
+++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -30,6 +30,8 @@ class PreloadRequest {
RequestTypeLinkRelPreload
};
+ // TODO(csharrison): Move the implementation to the cpp file when html
+ // gets its own testing source set in html/BUILD.gn.
static std::unique_ptr<PreloadRequest> create(
Yoav Weiss 2016/10/24 15:00:32 Usually `create()` doesn't fail in normal circumst
Charlie Harrison 2016/10/24 17:39:48 Done.
const String& initiatorName,
const TextPosition& initiatorPosition,
@@ -42,6 +44,11 @@ class PreloadRequest {
const ClientHintsPreferences& clientHintsPreferences =
ClientHintsPreferences(),
RequestType requestType = RequestTypePreload) {
+ // Never preload data or ref urls.
+ if (resourceURL.isEmpty() || resourceURL.startsWith("#") ||
Yoav Weiss 2016/10/24 14:43:54 Are absolute ref URLs an issue? What would happen
Charlie Harrison 2016/10/24 14:49:31 I think absolute ref URLs are okay because we real
Yoav Weiss 2016/10/24 15:00:32 Thanks. Clarifying that in the comment would be in
Charlie Harrison 2016/10/24 17:39:48 Done.
+ protocolIs(resourceURL, "data")) {
+ return nullptr;
+ }
return wrapUnique(new PreloadRequest(
initiatorName, initiatorPosition, resourceURL, baseURL, resourceType,
resourceWidth, clientHintsPreferences, requestType, referrerPolicy));

Powered by Google App Engine
This is Rietveld 408576698