Opaque being-loaded responses should clone their body
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 23:23:18 +0000 (23:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 23:23:18 +0000 (23:23 +0000)
commit0a29cf46b9fc0829283b705e3ccc3b358328e28a
tree2ce7fe66f61e08ecd75d4d89c6cb801476b71077
parent9b48ac5f8473872088fb8171a0fc5444fea6695a
Opaque being-loaded responses should clone their body
https://bugs.webkit.org/show_bug.cgi?id=182056

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-24
Reviewed by Brady Eidson.

Source/WebCore:

Test: http/wpt/service-workers/clone-opaque-being-loaded-response.https.html

When cloning a being-loaded response, make sure we create a ReadableStream.
Before the patch, the readableStream was not created in that case for opaque responses.

* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::readableStream):
(WebCore::FetchBodyOwner::createReadableStream):
* Modules/fetch/FetchBodyOwner.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::clone):

LayoutTests:

* http/wpt/service-workers/clone-opaque-being-loaded-response-worker.js: Added.
* http/wpt/service-workers/clone-opaque-being-loaded-response.html: Added.
* http/wpt/service-workers/clone-opaque-being-loaded-response.https-expected.txt: Added.
* http/wpt/service-workers/resources/clone-opaque-being-loaded-response-iframe.html: Added.
* http/wpt/service-workers/resources/lengthy-pass.py: Added.
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/wpt/service-workers/clone-opaque-being-loaded-response-worker.js [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/clone-opaque-being-loaded-response.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/clone-opaque-being-loaded-response.https.html [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/resources/clone-opaque-being-loaded-response-iframe.html [new file with mode: 0644]
LayoutTests/http/wpt/service-workers/resources/lengthy-pass.py [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
Source/WebCore/Modules/fetch/FetchBodyOwner.h
Source/WebCore/Modules/fetch/FetchResponse.cpp