Changeset 213672 in webkit
- Timestamp:
- Mar 9, 2017 2:29:39 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r213671 r213672 1 2017-03-09 Yoav Weiss <yoav@yoav.ws> 2 3 [link preload] Double downloads of preloaded CSS 4 https://bugs.webkit.org/show_bug.cgi?id=169274 5 6 Reviewed by Antti Koivisto. 7 8 Added tests making sure that header based preloads also trigger a single download, 9 and that we properly handle multiple charsets for the same preloaded resource. 10 11 * http/tests/preload/single_download_preload_headers-expected.txt: Added. 12 * http/tests/preload/single_download_preload_headers.php: Added. 13 * http/tests/preload/preload-encoding-expected.txt: Added. 14 * http/tests/preload/preload-encoding.php: Added. 15 1 16 2017-03-09 Jiewen Tan <jiewen_tan@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r213671 r213672 1 2017-03-09 Yoav Weiss <yoav@yoav.ws> 2 3 [link preload] Double downloads of preloaded CSS 4 https://bugs.webkit.org/show_bug.cgi?id=169274 5 6 Reviewed by Antti Koivisto. 7 8 Avoid reloading link preloads in case of a charset mismatch. 9 10 Charset mismatch can happen for header based preloads, as they are requested before 11 the HTML's `<meta charset>` tag is processed. This change makes sure that in those 12 cases, we modify the resource's encoding setting instead of reloading it. 13 14 Test: http/tests/preload/single_download_preload_headers.php 15 16 * loader/cache/CachedResource.cpp: 17 (WebCore::CachedResource::CachedResource): Initialize m_unknownCharset to be the same as the preload flag. 18 * loader/cache/CachedResource.h: 19 (WebCore::CachedResource::hasUnknownEncoding): 20 (WebCore::CachedResource::setHasUnknownEncoding): 21 * loader/cache/CachedResourceLoader.cpp: 22 (WebCore::CachedResourceLoader::determineRevalidationPolicy): In case of a charset 23 mismatch, set the encoding of the Resource instead of reloading it if the charset is unknown. 24 1 25 2017-03-09 Jiewen Tan <jiewen_tan@apple.com> 2 26 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r213350 r213672 124 124 , m_initiatorName(request.initiatorName()) 125 125 , m_isLinkPreload(request.isLinkPreload()) 126 , m_hasUnknownEncoding(request.isLinkPreload()) 126 127 , m_type(type) 127 128 { -
trunk/Source/WebCore/loader/cache/CachedResource.h
r212993 r213672 233 233 bool isLinkPreload() { return m_isLinkPreload; } 234 234 void setLinkPreload() { m_isLinkPreload = true; } 235 bool hasUnknownEncoding() { return m_hasUnknownEncoding; } 236 void setHasUnknownEncoding(bool hasUnknownEncoding) { m_hasUnknownEncoding = hasUnknownEncoding; } 235 237 236 238 void registerHandle(CachedResourceHandleBase*); … … 335 337 bool m_loading { false }; 336 338 bool m_isLinkPreload { false }; 339 bool m_hasUnknownEncoding { false }; 337 340 338 341 bool m_switchingClientsToRevalidatedResource { false }; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r212449 r213672 923 923 924 924 auto* textDecoder = existingResource->textResourceDecoder(); 925 if (textDecoder && !textDecoder->hasEqualEncodingForCharset(cachedResourceRequest.charset())) 926 return Reload; 925 if (textDecoder && !textDecoder->hasEqualEncodingForCharset(cachedResourceRequest.charset())) { 926 if (!existingResource->hasUnknownEncoding()) 927 return Reload; 928 existingResource->setHasUnknownEncoding(false); 929 existingResource->setEncoding(cachedResourceRequest.charset()); 930 } 927 931 928 932 // FIXME: We should use the same cache policy for all resource types. The raw resource policy is overly strict
Note: See TracChangeset
for help on using the changeset viewer.