FormDataElement::lengthInBytes should use ThreadableBlobRegistry
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 20:41:55 +0000 (20:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 20:41:55 +0000 (20:41 +0000)
commit4b2c8d975f352d249ff896466a285dc3212db328
tree29230d97893d9b610a077c0ca1a3337c76cbb405
parent641f0c238303ad72a0995b3a206a23b8561cd433
FormDataElement::lengthInBytes should use ThreadableBlobRegistry
https://bugs.webkit.org/show_bug.cgi?id=181554

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-12
Reviewed by Chris Dumez.

Source/WebCore:

Covered by updated test.

Fix blobRegistry() use and add support for creating a response that may trigger the issue.

* platform/network/FormData.cpp:
(WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
in case this is called from workers.
* Modules/fetch/FetchBody.h:
* Modules/fetch/FetchResponse.h:
* fileapi/Blob.h:
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:

LayoutTests:

* http/tests/workers/service/resources/service-worker-cache-api-worker.js:
(async):
(event.event.request.url.indexOf): Deleted.
(event.event.request.url.endsWith): Deleted.
(event.event.respondWith.promise.then): Deleted.
* http/tests/workers/service/service-worker-cache-api.https-expected.txt:
* http/tests/workers/service/service-worker-cache-api.https.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/resources/service-worker-cache-api-worker.js
LayoutTests/http/tests/workers/service/service-worker-cache-api.https-expected.txt
LayoutTests/http/tests/workers/service/service-worker-cache-api.https.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBody.h
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/fileapi/Blob.h
Source/WebCore/platform/network/FormData.cpp
Source/WebCore/testing/ServiceWorkerInternals.cpp
Source/WebCore/testing/ServiceWorkerInternals.h
Source/WebCore/testing/ServiceWorkerInternals.idl