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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 2855163002: Avoid sending mixed-content requests for ImageSet contexts (Closed)
Patch Set: Better check and a test Created 3 years, 7 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/HTMLPreloadScanner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
index c3dd9fcdfeca29200ff2710f62b937b5f17a958d..5c6106355a1ee952024bca5d718f3cad37d19518 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -236,6 +236,11 @@ class TokenPreloadScanner::StartTagScanner {
source_size_set = picture_data.source_size_set;
source_size = picture_data.source_size;
}
+ ResourceFetcher::IsImageSet is_image_set =
+ (picture_data.picked || !srcset_image_candidate_.IsEmpty())
+ ? ResourceFetcher::kImageIsImageSet
+ : ResourceFetcher::kImageNotImageSet;
+
if (source_size_set) {
resource_width.width = source_size;
resource_width.is_set = true;
@@ -252,7 +257,7 @@ class TokenPreloadScanner::StartTagScanner {
auto request = PreloadRequest::CreateIfNeeded(
InitiatorFor(tag_impl_), position, url_to_load_, predicted_base_url,
type.value(), referrer_policy, PreloadRequest::kDocumentIsReferrer,
- resource_width, client_hints_preferences, request_type);
+ is_image_set, resource_width, client_hints_preferences, request_type);
if (!request)
return nullptr;
@@ -805,8 +810,10 @@ void TokenPreloadScanner::ScanCommon(const Token& token,
in_script_ = false;
return;
}
- if (Match(tag_impl, pictureTag))
+ if (Match(tag_impl, pictureTag)) {
in_picture_ = false;
+ picture_data_.picked = false;
+ }
return;
}
case HTMLToken::kStartTag: {

Powered by Google App Engine
This is Rietveld 408576698