Changeset 181895 in webkit
- Timestamp:
- Mar 24, 2015, 9:50:55 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-no-body-expected.txt (added)
-
LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-no-body.html (added)
-
LayoutTests/http/tests/cache/disk-cache/resources/generate-response-no-body.cgi (added)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/NetworkProcess/cache/NetworkCacheDataCocoa.mm (modified) (1 diff)
-
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181894 r181895 1 2015-03-24 Chris Dumez <cdumez@apple.com> 2 3 [WK2] NetworkCache retrievals fail for entries with no body 4 https://bugs.webkit.org/show_bug.cgi?id=142979 5 <rdar://problem/20264100> 6 7 Reviewed by Antti Koivisto. 8 9 Add network disk cache validation test for resources that have no body 10 (only headers). 11 12 * http/tests/cache/disk-cache/disk-cache-validation-no-body-expected.txt: Added. 13 * http/tests/cache/disk-cache/disk-cache-validation-no-body.html: Added. 14 * http/tests/cache/disk-cache/resources/generate-response-no-body.cgi: Added. 15 1 16 2015-03-24 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebKit2/ChangeLog
r181894 r181895 1 2015-03-24 Chris Dumez <cdumez@apple.com> 2 3 [WK2] NetworkCache retrievals fail for entries with no body 4 https://bugs.webkit.org/show_bug.cgi?id=142979 5 <rdar://problem/20264100> 6 7 Reviewed by Antti Koivisto. 8 9 NetworkCache retrievals were failing for entries with no body because 10 decodeEntry() doesn't correctly handle this case. In particular, the 11 following check fails: 12 "metaData.bodyOffset + metaData.bodySize == fileData.size()". 13 This is because bodyOffset is pageSize-aligned. 14 15 As a result, the following resource on apple.com is stored in the cache 16 but we fail to reuse it and reload it from the network every time: 17 http://images.apple.com/home/styles/promos.css 18 19 This patch updates decodeEntry() to create a null Data object for the 20 body if bodySize is 0. 21 22 * NetworkProcess/cache/NetworkCacheDataCocoa.mm: 23 (WebKit::NetworkCache::Data::data): 24 Do not attempt to initialize m_data if m_dispatchData is null as the 25 call to dispatch_data_create_map() would then crash. We now return 26 null in this case. This is needed as decodeStorageEntry() in 27 NetworkCache.cpp constructs a SharedBuffer from 28 storageEntry.body.data() and the body may be null. 29 30 * NetworkProcess/cache/NetworkCacheStorage.cpp: 31 (WebKit::NetworkCache::decodeEntry): 32 1 33 2015-03-24 Chris Dumez <cdumez@apple.com> 2 34 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheDataCocoa.mm
r181160 r181895 50 50 const uint8_t* Data::data() const 51 51 { 52 if (!m_data ) {52 if (!m_data && m_dispatchData) { 53 53 const void* data; 54 54 size_t size; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
r181816 r181895 213 213 if (metaData.key != key) 214 214 return nullptr; 215 if (metaData.bodyOffset + metaData.bodySize != fileData.size()) 216 return nullptr; 217 218 auto bodyData = mapFile(fd, metaData.bodyOffset, metaData.bodySize); 219 if (bodyData.isNull()) { 220 LOG(NetworkCacheStorage, "(NetworkProcess) map failed"); 221 return nullptr; 222 } 223 224 if (metaData.bodyChecksum != hashData(bodyData)) { 225 LOG(NetworkCacheStorage, "(NetworkProcess) data checksum mismatch"); 226 return nullptr; 215 216 Data bodyData; 217 if (metaData.bodySize) { 218 if (metaData.bodyOffset + metaData.bodySize != fileData.size()) 219 return nullptr; 220 221 bodyData = mapFile(fd, metaData.bodyOffset, metaData.bodySize); 222 if (bodyData.isNull()) { 223 LOG(NetworkCacheStorage, "(NetworkProcess) map failed"); 224 return nullptr; 225 } 226 227 if (metaData.bodyChecksum != hashData(bodyData)) { 228 LOG(NetworkCacheStorage, "(NetworkProcess) data checksum mismatch"); 229 return nullptr; 230 } 227 231 } 228 232
Note:
See TracChangeset
for help on using the changeset viewer.