Changeset 228326 in webkit
- Timestamp:
- Feb 9, 2018 10:27:13 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r228319 r228326 1 2018-02-09 Youenn Fablet <youenn@apple.com> 2 3 Add support for cache storage of blob response 4 https://bugs.webkit.org/show_bug.cgi?id=182637 5 6 Reviewed by Brady Eidson. 7 8 * web-platform-tests/service-workers/cache-storage/script-tests/cache-put.js: 9 (cache_test.async): 10 * web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt: 11 * web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt: 12 * web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt: 13 * web-platform-tests/service-workers/cache-storage/window/cache-put.https.html: 14 1 15 2018-02-09 Javier Fernandez <jfernandez@igalia.com> 2 16 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-put.js
r220223 r228326 336 336 }, 'Cache.put should store Response.redirect() correctly'); 337 337 338 cache_test(async (cache) => { 339 var request = new Request(test_url); 340 var response = new Response(new Blob([test_body])); 341 await cache.put(request, response); 342 var cachedResponse = await cache.match(request); 343 assert_equals(await cachedResponse.text(), test_body); 344 }, 'Cache.put called with simple Request and blob Response'); 345 338 346 done(); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt
r224250 r228326 24 24 PASS Cache.put with an embedded VARY:* Response 25 25 PASS Cache.put should store Response.redirect() correctly 26 PASS Cache.put called with simple Request and blob Response 26 27 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt
r221024 r228326 23 23 PASS Cache.put with an embedded VARY:* Response 24 24 PASS Cache.put should store Response.redirect() correctly 25 PASS Cache.put called with simple Request and blob Response 26 FAIL Cache.put called with simple Request and form data Response promise_test: Unhandled rejection with value: object "NotSupportedError: Not implemented" 25 27 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-put.https.html
r220223 r228326 7 7 <script src="../resources/test-helpers.js"></script> 8 8 <script src="../script-tests/cache-put.js"></script> 9 <script> 10 cache_test(async (cache) => { 11 var formData = new FormData(); 12 formData.append("name", "value"); 13 14 var request = new Request(test_url); 15 var response = new Response(formData); 16 await cache.put(request, response); 17 var cachedResponse = await cache.match(request); 18 var cachedResponseText = await cachedResponse.text(); 19 assert_true(cachedResponseText.indexOf("name=\"name\"\r\n\r\nvalue") !== -1); 20 }, 'Cache.put called with simple Request and form data Response'); 21 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt
r221704 r228326 23 23 PASS Cache.put with an embedded VARY:* Response 24 24 PASS Cache.put should store Response.redirect() correctly 25 PASS Cache.put called with simple Request and blob Response 25 26 -
trunk/Source/WebCore/ChangeLog
r228325 r228326 1 2018-02-09 Youenn Fablet <youenn@apple.com> 2 3 Add support for cache storage of blob response 4 https://bugs.webkit.org/show_bug.cgi?id=182637 5 6 Reviewed by Brady Eidson. 7 8 Covered by updated WPT test. 9 When putting a blob response in cache, create a readable stream to easily get the body. 10 Make clear that caching form data is not supported. 11 12 * Modules/cache/DOMCache.cpp: 13 (WebCore::DOMCache::put): 14 * Modules/fetch/FetchBody.h: 15 (WebCore::FetchBody::isBlob const): 16 (WebCore::FetchBody::isFormData const): 17 * Modules/fetch/FetchResponse.h: 18 1 19 2018-02-09 Youenn Fablet <youenn@apple.com> 2 20 -
trunk/Source/WebCore/Modules/cache/DOMCache.cpp
r228199 r228326 341 341 } 342 342 343 if (response->isBlobFormData()) { 344 promise.reject(Exception { NotSupportedError, ASCIILiteral("Not implemented") }); 345 return; 346 } 347 348 // FIXME: for efficiency, we should load blobs directly instead of going through the readableStream path. 349 if (response->isBlobBody()) 350 response->readableStream(*scriptExecutionContext()->execState()); 351 343 352 if (response->isBodyReceivedByChunk()) { 344 353 response->consumeBodyReceivedByChunk([promise = WTFMove(promise), request = WTFMove(request), response = WTFMove(response), data = SharedBuffer::create(), pendingActivity = makePendingActivity(*this), this](auto&& result) mutable { -
trunk/Source/WebCore/Modules/fetch/FetchBody.h
r226906 r228326 86 86 } 87 87 88 bool isBlob() const { return WTF::holds_alternative<Ref<const Blob>>(m_data); } 89 bool isFormData() const { return WTF::holds_alternative<Ref<FormData>>(m_data); } 90 88 91 private: 89 92 explicit FetchBody(Ref<const Blob>&& data) : m_data(WTFMove(data)) { } … … 103 106 void consumeBlob(FetchBodyOwner&, Ref<DeferredPromise>&&); 104 107 105 bool isBlob() const { return WTF::holds_alternative<Ref<const Blob>>(m_data); }106 bool isFormData() const { return WTF::holds_alternative<Ref<FormData>>(m_data); }107 108 bool isArrayBuffer() const { return WTF::holds_alternative<Ref<const ArrayBuffer>>(m_data); } 108 109 bool isArrayBufferView() const { return WTF::holds_alternative<Ref<const ArrayBufferView>>(m_data); } -
trunk/Source/WebCore/Modules/fetch/FetchResponse.h
r228218 r228326 94 94 bool isLoading() const { return !!m_bodyLoader; } 95 95 bool isBodyReceivedByChunk() const { return isLoading() || hasReadableStreamBody(); } 96 bool isBlobBody() const { return !isBodyNull() && body().isBlob(); } 97 bool isBlobFormData() const { return !isBodyNull() && body().isFormData(); } 96 98 97 99 using ConsumeDataByChunkCallback = WTF::Function<void(ExceptionOr<ReadableStreamChunk*>&&)>;
Note: See TracChangeset
for help on using the changeset viewer.