Changeset 221024 in webkit
- Timestamp:
- Aug 22, 2017 11:02:43 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r221023 r221024 1 2017-08-22 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Add support for overwriting responses with put on an existing record 4 https://bugs.webkit.org/show_bug.cgi?id=175825 5 6 Reviewed by Geoffrey Garen. 7 8 Adding update counter for response 9 Skipping new test on WK1. 10 11 * platform/ios-wk1/TestExpectations: 12 * platform/mac-wk1/TestExpectations: 13 * http/wpt/cache-storage/cache-put-keys.https.any-expected.txt: Added. 14 * http/wpt/cache-storage/cache-put-keys.https.any.html: Added. 15 * http/wpt/cache-storage/cache-put-keys.https.any.js: Added. 16 (cache_test): 17 * http/wpt/cache-storage/cache-put-keys.https.any.worker-expected.txt: Added. 18 * http/wpt/cache-storage/cache-put-keys.https.any.worker.html: Added. 19 1 20 2017-08-22 Matt Lewis <jlewis3@apple.com> 2 21 -
trunk/LayoutTests/imported/w3c/ChangeLog
r221020 r221024 1 2017-08-22 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Add support for overwriting responses with put on an existing record 4 https://bugs.webkit.org/show_bug.cgi?id=175825 5 6 Reviewed by Geoffrey Garen. 7 8 * web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt: 9 * web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt: 10 1 11 2017-08-22 Andy Estes <aestes@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt
r220984 r221024 9 9 PASS Cache.put with HTTP 206 response 10 10 PASS Cache.put with HTTP 500 response 11 FAIL Cache.put called twice with matching Requests and different Responses assert_equals: Cache put should store new response body. expected "New body" but got "Old body" 12 FAIL Cache.put called twice with request URLs that differ only by a fragment assert_equals: Cache put should store new response body. expected "New body" but got "Old body" 11 PASS Cache.put called twice with matching Requests and different Responses 12 PASS Cache.put called twice with request URLs that differ only by a fragment 13 13 PASS Cache.put with a string request 14 14 PASS Cache.put with an invalid response -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt
r220998 r221024 9 9 PASS Cache.put with HTTP 206 response 10 10 PASS Cache.put with HTTP 500 response 11 FAIL Cache.put called twice with matching Requests and different Responses assert_equals: Cache put should store new response body. expected "New body" but got "Old body" 12 FAIL Cache.put called twice with request URLs that differ only by a fragment assert_equals: Cache put should store new response body. expected "New body" but got "Old body" 11 PASS Cache.put called twice with matching Requests and different Responses 12 PASS Cache.put called twice with request URLs that differ only by a fragment 13 13 PASS Cache.put with a string request 14 14 PASS Cache.put with an invalid response -
trunk/LayoutTests/platform/ios-wk1/TestExpectations
r220941 r221024 10 10 # No service worker implementation for WK1 11 11 imported/w3c/web-platform-tests/service-workers [ Skip ] 12 http/wpt/cache-storage [ Skip ] 12 13 13 14 # Skip WebRTC for now in WK1 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r220981 r221024 97 97 # No service worker implementation for WK1 98 98 imported/w3c/web-platform-tests/service-workers [ Skip ] 99 http/wpt/cache-storage [ Skip ] 99 100 100 101 # Skip WebRTC for now in WK1 -
trunk/Source/WebCore/ChangeLog
r221022 r221024 1 2017-08-22 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Add support for overwriting responses with put on an existing record 4 https://bugs.webkit.org/show_bug.cgi?id=175825 5 6 Reviewed by Geoffrey Garen. 7 8 Tests: http/wpt/cache-storage/cache-put-keys.https.any.html 9 http/wpt/cache-storage/cache-put-keys.https.any.worker.html 10 11 Adding support for the new response update counter. 12 Overwriting local cached response with new retrieved response when the counter is different. 13 Adding support for passing this value from/to workers. 14 15 * Modules/cache/Cache.cpp: 16 (WebCore::Cache::queryCacheWithTargetStorage): 17 (WebCore::toConnectionRecord): 18 (WebCore::Cache::updateRecords): 19 * Modules/cache/CacheStorageConnection.cpp: 20 (WebCore::CacheStorageConnection::Record::copy const): 21 * Modules/cache/CacheStorageConnection.h: 22 * Modules/cache/CacheStorageRecord.h: 23 * Modules/cache/WorkerCacheStorageConnection.cpp: 24 (WebCore::toCrossThreadRecordData): 25 (WebCore::fromCrossThreadRecordData): 26 1 27 2017-08-22 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Source/WebCore/Modules/cache/Cache.cpp
r220998 r221024 412 412 for (auto& record : targetStorage) { 413 413 if (queryCacheMatch(request, record.request.get(), record.response->resourceResponse(), options)) 414 records.append({ record.identifier, record. request.copyRef(), record.response.copyRef() });414 records.append({ record.identifier, record.updateResponseCounter, record.request.copyRef(), record.response.copyRef() }); 415 415 } 416 416 return records; … … 441 441 ASSERT(!cachedResponse.isNull()); 442 442 443 return { 0, 443 return { 0, 0, 444 444 request.headers().guard(), WTFMove(cachedRequest), request.fetchOptions(), request.internalRequestReferrer(), 445 445 response.headers().guard(), WTFMove(cachedResponse), WTFMove(responseBody) … … 473 473 for (auto& record : records) { 474 474 size_t index = m_records.findMatching([&](const auto& item) { return item.identifier == record.identifier; }); 475 if (index != notFound) 476 newRecords.append(WTFMove(m_records[index])); 477 else { 475 if (index != notFound) { 476 auto& current = m_records[index]; 477 if (current.updateResponseCounter != record.updateResponseCounter) { 478 auto responseHeaders = FetchHeaders::create(record.responseHeadersGuard, HTTPHeaderMap { record.response.httpHeaderFields() }); 479 auto response = FetchResponse::create(*scriptExecutionContext(), std::nullopt, WTFMove(responseHeaders), WTFMove(record.response)); 480 response->setBodyData(WTFMove(record.responseBody)); 481 482 current.response = WTFMove(response); 483 current.updateResponseCounter = record.updateResponseCounter; 484 } 485 newRecords.append(WTFMove(current)); 486 } else { 478 487 auto requestHeaders = FetchHeaders::create(record.requestHeadersGuard, HTTPHeaderMap { record.request.httpHeaderFields() }); 479 488 FetchRequest::InternalRequest internalRequest = { WTFMove(record.request), WTFMove(record.options), WTFMove(record.referrer) }; … … 484 493 response->setBodyData(WTFMove(record.responseBody)); 485 494 486 newRecords.append(CacheStorageRecord { record.identifier, WTFMove(request), WTFMove(response) });495 newRecords.append(CacheStorageRecord { record.identifier, record.updateResponseCounter, WTFMove(request), WTFMove(response) }); 487 496 } 488 497 } -
trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp
r220928 r221024 181 181 CacheStorageConnection::Record CacheStorageConnection::Record::copy() const 182 182 { 183 return Record { identifier, requestHeadersGuard, request, options, referrer, responseHeadersGuard, response, copyResponseBody(responseBody) };183 return Record { identifier, updateResponseCounter, requestHeadersGuard, request, options, referrer, responseHeadersGuard, response, copyResponseBody(responseBody) }; 184 184 } 185 185 -
trunk/Source/WebCore/Modules/cache/CacheStorageConnection.h
r220928 r221024 68 68 69 69 uint64_t identifier; 70 uint64_t updateResponseCounter; 70 71 71 72 FetchHeaders::Guard requestHeadersGuard; -
trunk/Source/WebCore/Modules/cache/CacheStorageRecord.h
r220758 r221024 33 33 struct CacheStorageRecord { 34 34 uint64_t identifier; 35 uint64_t updateResponseCounter; 35 36 36 37 Ref<FetchRequest> request; -
trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp
r220928 r221024 41 41 struct CrossThreadRecordData { 42 42 uint64_t identifier; 43 uint64_t updateResponseCounter; 43 44 44 45 FetchHeaders::Guard requestHeadersGuard; … … 57 58 return CrossThreadRecordData { 58 59 record.identifier, 60 record.updateResponseCounter, 59 61 record.requestHeadersGuard, 60 62 record.request.isolatedCopy(), … … 71 73 return CacheStorageConnection::Record { 72 74 data.identifier, 75 data.updateResponseCounter, 73 76 data.requestHeadersGuard, 74 77 WTFMove(data.request), -
trunk/Source/WebKit/ChangeLog
r221022 r221024 1 2017-08-22 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Add support for overwriting responses with put on an existing record 4 https://bugs.webkit.org/show_bug.cgi?id=175825 5 6 Reviewed by Geoffrey Garen. 7 8 Add support for encoding/decoding the update counter. 9 Incrementing it when overwriting an existing response. 10 Storing the new body in addition to the new response. 11 12 * NetworkProcess/cache/CacheStorageEngine.cpp: 13 (WebKit::CacheStorageEngine::putRecords): 14 * Shared/WebCoreArgumentCoders.cpp: 15 (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode): 16 (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode): 17 1 18 2017-08-22 Alex Christensen <achristensen@webkit.org> 2 19 -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
r220928 r221024 175 175 existingRecord.responseHeadersGuard = record.responseHeadersGuard; 176 176 existingRecord.response = WTFMove(record.response); 177 existingRecord.responseBody = WTFMove(record.responseBody); 178 ++existingRecord.updateResponseCounter; 177 179 } 178 180 } -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r220928 r221024 312 312 encoder << record.responseHeadersGuard; 313 313 encoder << record.response; 314 encoder << record.updateResponseCounter; 314 315 315 316 WTF::switchOn(record.responseBody, [&](const Ref<SharedBuffer>& buffer) { … … 354 355 WebCore::ResourceResponse response; 355 356 if (!decoder.decode(response)) 357 return false; 358 359 uint64_t updateResponseCounter; 360 if (!decoder.decode(updateResponseCounter)) 356 361 return false; 357 362 … … 387 392 record.responseHeadersGuard = responseHeadersGuard; 388 393 record.response = WTFMove(response); 394 record.updateResponseCounter = updateResponseCounter; 389 395 record.responseBody = WTFMove(responseBody); 390 396
Note: See TracChangeset
for help on using the changeset viewer.