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

Side by Side 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, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PreloadRequest_h 5 #ifndef PreloadRequest_h
6 #define PreloadRequest_h 6 #define PreloadRequest_h
7 7
8 #include "core/fetch/ClientHintsPreferences.h" 8 #include "core/fetch/ClientHintsPreferences.h"
9 #include "core/fetch/FetchRequest.h" 9 #include "core/fetch/FetchRequest.h"
10 #include "core/fetch/IntegrityMetadata.h" 10 #include "core/fetch/IntegrityMetadata.h"
(...skipping 24 matching lines...) Expand all
35 const TextPosition& initiatorPosition, 35 const TextPosition& initiatorPosition,
36 const String& resourceURL, 36 const String& resourceURL,
37 const KURL& baseURL, 37 const KURL& baseURL,
38 Resource::Type resourceType, 38 Resource::Type resourceType,
39 const ReferrerPolicy referrerPolicy, 39 const ReferrerPolicy referrerPolicy,
40 const FetchRequest::ResourceWidth& resourceWidth = 40 const FetchRequest::ResourceWidth& resourceWidth =
41 FetchRequest::ResourceWidth(), 41 FetchRequest::ResourceWidth(),
42 const ClientHintsPreferences& clientHintsPreferences = 42 const ClientHintsPreferences& clientHintsPreferences =
43 ClientHintsPreferences(), 43 ClientHintsPreferences(),
44 RequestType requestType = RequestTypePreload) { 44 RequestType requestType = RequestTypePreload) {
45 // Never preload data or ref urls.
46 if (resourceURL.startsWith("#") || protocolIs(resourceURL, "data"))
47 return nullptr;
45 return wrapUnique(new PreloadRequest( 48 return wrapUnique(new PreloadRequest(
46 initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, 49 initiatorName, initiatorPosition, resourceURL, baseURL, resourceType,
47 resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); 50 resourceWidth, clientHintsPreferences, requestType, referrerPolicy));
48 } 51 }
49 52
50 bool isSafeToSendToAnotherThread() const; 53 bool isSafeToSendToAnotherThread() const;
51 54
52 FetchRequest resourceRequest(Document*); 55 FetchRequest resourceRequest(Document*);
53 56
54 const String& charset() const { return m_charset; } 57 const String& charset() const { return m_charset; }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 136
134 // Used for deprecation warnings. 137 // Used for deprecation warnings.
135 bool m_hasInvalidTypeOrLanguage = false; 138 bool m_hasInvalidTypeOrLanguage = false;
136 }; 139 };
137 140
138 typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream; 141 typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream;
139 142
140 } // namespace blink 143 } // namespace blink
141 144
142 #endif 145 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698