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

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

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: also block ref urls 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..fd4f970b33ae8ee85a567a5553f7fafd678c90aa 100644
--- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
+++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -42,6 +42,9 @@ class PreloadRequest {
const ClientHintsPreferences& clientHintsPreferences =
ClientHintsPreferences(),
RequestType requestType = RequestTypePreload) {
+ // Never preload data or ref urls.
+ if (resourceURL.startsWith("#") || 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