[Cache API] Add support for overwriting responses with put on an existing record
https://bugs.webkit.org/show_bug.cgi?id=175825
Patch by Youenn Fablet <youenn@apple.com> on 2017-08-22
Reviewed by Geoffrey Garen.
LayoutTests/imported/w3c:
* web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt:
Source/WebCore:
Tests: http/wpt/cache-storage/cache-put-keys.https.any.html
http/wpt/cache-storage/cache-put-keys.https.any.worker.html
Adding support for the new response update counter.
Overwriting local cached response with new retrieved response when the counter is different.
Adding support for passing this value from/to workers.
* Modules/cache/Cache.cpp:
(WebCore::Cache::queryCacheWithTargetStorage):
(WebCore::toConnectionRecord):
(WebCore::Cache::updateRecords):
* Modules/cache/CacheStorageConnection.cpp:
(WebCore::CacheStorageConnection::Record::copy const):
* Modules/cache/CacheStorageConnection.h:
* Modules/cache/CacheStorageRecord.h:
* Modules/cache/WorkerCacheStorageConnection.cpp:
(WebCore::toCrossThreadRecordData):
(WebCore::fromCrossThreadRecordData):
Source/WebKit:
Add support for encoding/decoding the update counter.
Incrementing it when overwriting an existing response.
Storing the new body in addition to the new response.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorageEngine::putRecords):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<CacheStorageConnection::Record>::encode):
(IPC::ArgumentCoder<CacheStorageConnection::Record>::decode):
LayoutTests:
Adding update counter for response
Skipping new test on WK1.
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:
* http/wpt/cache-storage/cache-put-keys.https.any-expected.txt: Added.
* http/wpt/cache-storage/cache-put-keys.https.any.html: Added.
* http/wpt/cache-storage/cache-put-keys.https.any.js: Added.
(cache_test):
* http/wpt/cache-storage/cache-put-keys.https.any.worker-expected.txt: Added.
* http/wpt/cache-storage/cache-put-keys.https.any.worker.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221024
268f45cc-cd09-0410-ab3c-
d52691b4dbfc