haikuwebkit/Source/WebCore/Modules/fetch/FetchResponse.h

167 lines
6.6 KiB
C
Raw Permalink Normal View History

[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
/*
* Copyright (C) 2016 Canon Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions
* are required to be met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Canon Inc. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Next batch of conversions to use C++ enum class instead of strings for enumerations https://bugs.webkit.org/show_bug.cgi?id=157232 Reviewed by Chris Dumez. Source/WebCore: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::error): Use ResponseType. (WebCore::FetchResponse::redirect): Ditto. (WebCore::FetchResponse::FetchResponse): Ditto. (WebCore::FetchResponse::clone): Ditto. (WebCore::FetchResponse::type): Return ResponseType. (WebCore::FetchResponse::startFetching): Use auto. * Modules/fetch/FetchResponse.h: Added ResponseType and used it for the return value of the type function, and also to replace FetchResponse::Type. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::externalDeviceType): Return DeviceType. * Modules/mediacontrols/MediaControlsHost.h: Added DeviceType and use it for the return value for the externalDeviceType function. * Modules/mediasession/MediaSession.cpp: (WebCore::MediaSession::parseKind): Deleted. (WebCore::MediaSession::MediaSession): Use MediaSessionKind. (WebCore::MediaSession::kind): Deleted. * Modules/mediasession/MediaSession.h: Added MediaSessionKind and use it as the argument to MediaSession::create and the return type for the kind function. Probably didn't get this 100% right because this code does not seem to be compiled. * Modules/mediasession/MediaSession.idl: Added default value for kind, as specified in the current version of the specification for this class. * Modules/mediasession/MediaSessionManager.cpp: (WebCore::MediaSessionManager::didReceiveStartOfInterruptionNotification): Tried to update for changes above. (WebCore::MediaSessionManager::didReceiveEndOfInterruptionNotification): Ditto. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::endOfStream): Changed to take Optional<EndOfStreamError> instead of overloading and taking const AtomicString&. (WebCore::MediaSource::streamEndedWithError): Ditto. Also removed exception code. (WebCore::MediaSource::addSourceBuffer): Updated to use EndOfStreamError. Also used an if statement. (WebCore::MediaSource::sourceBufferDidChangeActiveState): Updated to take a reference instead of a pointer. * Modules/mediasource/MediaSource.h: Added EndOfStreamError and changed as above. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::segmentsKeyword): Deleted. (WebCore::SourceBuffer::sequenceKeyword): Deleted. (WebCore::SourceBuffer::TrackBuffer::TrackBuffer): Initialize booleans where they are defined rather than in this constructor. (WebCore::SourceBuffer::create): Use Ref instead of RefPtr. (WebCore::SourceBuffer::SourceBuffer): Initialize many data members where they are defined rather than in this constructor. (WebCore::SourceBuffer::setTimestampOffset): Use AppendMode. (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Ditto. (WebCore::SourceBuffer::decodeError): Deleted. (WebCore::SourceBuffer::networkError): Deleted. (WebCore::SourceBuffer::setActive): Pass reference instead of pointer. (WebCore::SourceBuffer::sourceBufferPrivateDidEndStream): Deleted. No callers. (WebCore::SourceBuffer::appendError): Use AppendMode. (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto. (WebCore::SourceBuffer::setMode): Take AppendMode. * Modules/mediasource/SourceBuffer.h: Added AppendMode, removed various string constant functions, initialize more data emebers in this header. Removed unused sourceBufferPrivateDidEndStream function. * Modules/mediastream/MediaDeviceInfo.cpp: (WebCore::MediaDeviceInfo::MediaDeviceInfo): Take MediaDeviceKind instead of string. (WebCore::MediaDeviceInfo::create): Ditto. (WebCore::MediaDeviceInfo::audioInputType): Deleted. (WebCore::MediaDeviceInfo::audioOutputType): Deleted. (WebCore::MediaDeviceInfo::videoInputType): Deleted. * Modules/mediastream/MediaDeviceInfo.h: Aedded MediaDeviceKind and used it. * Modules/mediastream/MediaDeviceInfo.idl: Changed type of the kind attribute to be MediaDeviceKind as in the specification. * Modules/mediastream/MediaDevicesRequest.cpp: (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Fix loop to not churn the reference countds. Also updated to use String instead of AtomicString for label, and MediaDeviceKind instead of string for kind. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::readyState): Return MediaStreamTrackState. * Modules/mediastream/MediaStreamTrack.h: Added MediaStreamTrackState and used it for the return value from the readyState function. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::state): Return AudioContextState. * Modules/webaudio/AudioContext.h: Added AudioContextState and used it. * Modules/webaudio/WaveShaperNode.cpp: (WebCore::processorType): Added. (WebCore::WaveShaperNode::setOversample): Take OverSampletype instead of a string. (WebCore::WaveShaperNode::oversample): Return OverSampleType. * Modules/webaudio/WaveShaperNode.h: Added OverSampleType and used it. * Modules/webaudio/WaveShaperNode.idl: Removed unneeded [SetterRaisesException]. * bindings/scripts/CodeGenerator.pm: Removed special cases for 18 enumerations that either don't exist or were converted to no longer pass strings in to the C++ DOM. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeaderContentHeader): Use #pragma once instead of header guards. (GetEnumerationValueName): Added logic to handle names with "-" and starting with a numeric digit. (GetEnumerationImplementationContent): Changed functions so they do more of the binding work. Added JSValueTraits specialization so we can generate bindings for a vector of any enumeration. Added special cases for null string. Removed special case to keep the style checker happy. (GenerateHeader): Removed the #endif that matched the header guards in GenerateHeaderContentHeader. (GenerateImplementation): Use the $type local variable rather than writing out $attribute->signature->type or $attributeType. Fixed code path that checks for valid enumeration values to work for non-string-based enumerations. (CanUseWTFOptionalForParameter): Turn this function off for the new enumerations. For now, leave it on for the old string-based enumerations. (GenerateParametersCheck): Added appropriate parameter checking for the new enumerations. (GenerateCallbackHeader): Removed the #endif that matched the header guards in GenerateHeaderContentHeader. (GetNativeType): Use "auto" instead of the enumeration name in generated code. (JSValueToNative): Updated since the name of enumerationValueMyEnum was changed to parseMyEnum. (NativeToJSValue): Took out call to stringValue, since we now overload the jsStringWithCache function instead. * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestCallback.h: * bindings/scripts/test/JS/JSTestCallbackFunction.h: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h: * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: * bindings/scripts/test/JS/JSTestEventConstructor.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGenerateIsReachable.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestNamedConstructor.h: * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestNondeterministic.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverloadedConstructors.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bindings/scripts/test/JS/JSattribute.h: * bindings/scripts/test/JS/JSreadonly.h: Regenerated. * crypto/CryptoKey.cpp: (WebCore::CryptoKey::type): Use CryptoKeyType. (WebCore::CryptoKey::usages): Use KeyUsage. * crypto/CryptoKey.h: Added KeyUsage and use CryptoKeyType. * css/FontFaceSet.cpp: (WebCore::FontFaceSet::status): Use FontFaceSetLoadStatus. * css/FontFaceSet.h: Added FontFaceSetLoadStatus and used it. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::playInternal): Use kind instead of kindEnum. * html/HTMLVideoElement.cpp: (WebCore::presentationModeFullscreen): Deleted. (WebCore::presentationModePictureInPicture): Deleted. (WebCore::presentationModeInline): Deleted. (WebCore::HTMLVideoElement::webkitSupportsPresentationMode): Use VideoPresentationMode. (WebCore::toFullscreenMode): Ditto. (WebCore::HTMLVideoElement::webkitSetPresentationMode): Ditto. (WebCore::toPresentationMode): Ditto. (WebCore::HTMLVideoElement::webkitPresentationMode): Ditto. * html/HTMLVideoElement.h: Added VideoPresentationMode and used it. * html/canvas/CanvasRenderingContext2D.cpp: Tweaked formatting. Changed DefaultSmoothingQuality macro to a constant. (WebCore::toWindRule): Replaces parseWinding. (WebCore::CanvasRenderingContext2D::fill): Use CanvasWindingRule instead of string. (WebCore::CanvasRenderingContext2D::clip): Ditto. (WebCore::CanvasRenderingContext2D::fillInternal): Ditto. (WebCore::CanvasRenderingContext2D::clipInternal): Ditto. (WebCore::CanvasRenderingContext2D::isPointInPath): Ditto. (WebCore::CanvasRenderingContext2D::isPointInStroke): Ditto. (WebCore::CanvasRenderingContext2D::isPointInPathInternal): Ditto. (WebCore::smoothingToInterpolationQuality): Ditto. (WebCore::CanvasRenderingContext2D::imageSmoothingQuality): Ditto. (WebCore::CanvasRenderingContext2D::setImageSmoothingQuality): Ditto. * html/canvas/CanvasRenderingContext2D.h: Added CanvasWindingRule and ImageSmoothingQuality, and use them throughout the class. * platform/graphics/SourceBufferPrivateClient.h: Removed unused sourceBufferPrivateDidEndStream function. Tools: * Scripts/webkitpy/style/checker.py: Skip the bindings script tests when doing style checking. We don't want to waste time trying to make our generated code match our style. Canonical link: https://commits.webkit.org/175331@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-30 19:16:00 +00:00
#pragma once
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
#include "FetchBodyOwner.h"
[WebIDL] Split-up and cleanup Fetch IDL files in preparation for removing unnecessary js builtins https://bugs.webkit.org/show_bug.cgi?id=174915 Patch by Sam Weinig <sam@webkit.org> on 2017-07-28 Reviewed by Alex Christensen. - Split FetchRequest enums and Init dictionary out of FetchRequest so they can be used from other files like WorkerGlobalScopeFetch and DOMWindowFetch. - Add missing FetchResponseInit. Currently unused but will be in a subsequent patch. - Add and update comments about missing properties and functions. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * Modules/fetch/DOMWindowFetch.idl: * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchHeaders.h: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchReferrerPolicy.h: Added. * Modules/fetch/FetchReferrerPolicy.idl: Added. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestCache.h: Added. * Modules/fetch/FetchRequestCache.idl: Added. * Modules/fetch/FetchRequestCredentials.h: Added. * Modules/fetch/FetchRequestCredentials.idl: Added. * Modules/fetch/FetchRequestInit.h: Added. * Modules/fetch/FetchRequestInit.idl: Added. * Modules/fetch/FetchRequestMode.h: Added. * Modules/fetch/FetchRequestMode.idl: Added. * Modules/fetch/FetchRequestRedirect.h: Added. * Modules/fetch/FetchRequestRedirect.idl: Added. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/WorkerGlobalScopeFetch.idl: Canonical link: https://commits.webkit.org/191735@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-28 17:29:12 +00:00
#include "FetchHeaders.h"
FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies https://bugs.webkit.org/show_bug.cgi?id=182008 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-chunk-iframe.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-chunk-worker.js: Added. (const.process): (this.step): (this.run): (const.asyncSteps): Source/WebCore: Modify FetchResponse to support ConsumeData callback with handling of ReadableStream by chunks * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consumeBodyFromReadableStream): * Modules/fetch/FetchResponse.h: * Modules/streams/ReadableStreamChunk.h: Added. * Modules/streams/ReadableStreamSink.cpp: (WebCore::ReadableStreamToSharedBufferSink::enqueue): (WebCore::ReadableStreamToSharedBufferSink::close): * Modules/streams/ReadableStreamSink.h: * WebCore.xcodeproj/project.pbxproj: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198067@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-29 23:39:21 +00:00
#include "ReadableStreamSink.h"
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
#include "ResourceResponse.h"
Remove WebCore/ForwardingHeaders directory https://bugs.webkit.org/show_bug.cgi?id=182347 Reviewed by Keith Miller. Source/ThirdParty: * gtest/CMakeLists.txt: * gtest/include/gtest/internal/gtest-port.h: Source/WebCore: No new tests. No change in behavior. * CMakeLists.txt: * ForwardingHeaders/bindings/ScriptFunctionCall.h: Removed. * ForwardingHeaders/bindings/ScriptObject.h: Removed. * ForwardingHeaders/bindings/ScriptValue.h: Removed. * ForwardingHeaders/builtins/BuiltinNames.h: Removed. * ForwardingHeaders/builtins/BuiltinUtils.h: Removed. * ForwardingHeaders/builtins/JSCBuiltins.h: Removed. * ForwardingHeaders/bytecode/CodeBlock.h: Removed. * ForwardingHeaders/bytecode/SpeculatedType.h: Removed. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Removed. * ForwardingHeaders/debugger/Debugger.h: Removed. * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Removed. * ForwardingHeaders/domjit/DOMJITEffect.h: Removed. * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Removed. * ForwardingHeaders/domjit/DOMJITHeapRange.h: Removed. * ForwardingHeaders/domjit/DOMJITSignature.h: Removed. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Removed. * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Removed. * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Removed. * ForwardingHeaders/heap/GCActivityCallback.h: Removed. * ForwardingHeaders/heap/GCFinalizationCallback.h: Removed. * ForwardingHeaders/heap/HandleTypes.h: Removed. * ForwardingHeaders/heap/Heap.h: Removed. * ForwardingHeaders/heap/HeapInlines.h: Removed. * ForwardingHeaders/heap/HeapObserver.h: Removed. * ForwardingHeaders/heap/IncrementalSweeper.h: Removed. * ForwardingHeaders/heap/LockDuringMarking.h: Removed. * ForwardingHeaders/heap/MachineStackMarker.h: Removed. * ForwardingHeaders/heap/MarkedBlockInlines.h: Removed. * ForwardingHeaders/heap/MarkingConstraint.h: Removed. * ForwardingHeaders/heap/RunningScope.h: Removed. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Removed. * ForwardingHeaders/heap/SlotVisitor.h: Removed. * ForwardingHeaders/heap/SlotVisitorInlines.h: Removed. * ForwardingHeaders/heap/Strong.h: Removed. * ForwardingHeaders/heap/StrongInlines.h: Removed. * ForwardingHeaders/heap/SubspaceInlines.h: Removed. * ForwardingHeaders/heap/ThreadLocalCache.h: Removed. * ForwardingHeaders/heap/Weak.h: Removed. * ForwardingHeaders/heap/WeakInlines.h: Removed. * ForwardingHeaders/inspector/ConsoleMessage.h: Removed. * ForwardingHeaders/inspector/ContentSearchUtilities.h: Removed. * ForwardingHeaders/inspector/IdentifiersFactory.h: Removed. * ForwardingHeaders/inspector/InjectedScript.h: Removed. * ForwardingHeaders/inspector/InjectedScriptBase.h: Removed. * ForwardingHeaders/inspector/InjectedScriptHost.h: Removed. * ForwardingHeaders/inspector/InjectedScriptManager.h: Removed. * ForwardingHeaders/inspector/InjectedScriptModule.h: Removed. * ForwardingHeaders/inspector/InspectorAgentBase.h: Removed. * ForwardingHeaders/inspector/InspectorAgentRegistry.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatcher.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorEnvironment.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendChannel.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendRouter.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolObjects.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolTypes.h: Removed. * ForwardingHeaders/inspector/PerGlobalObjectWrapperWorld.h: Removed. * ForwardingHeaders/inspector/ScriptArguments.h: Removed. * ForwardingHeaders/inspector/ScriptBreakpoint.h: Removed. * ForwardingHeaders/inspector/ScriptCallFrame.h: Removed. * ForwardingHeaders/inspector/ScriptCallStack.h: Removed. * ForwardingHeaders/inspector/ScriptCallStackFactory.h: Removed. * ForwardingHeaders/inspector/ScriptDebugListener.h: Removed. * ForwardingHeaders/inspector/ScriptDebugServer.h: Removed. * ForwardingHeaders/inspector/agents/InspectorAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorConsoleAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorHeapAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorRuntimeAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorScriptProfilerAgent.h: Removed. * ForwardingHeaders/interpreter/CallFrame.h: Removed. * ForwardingHeaders/interpreter/FrameTracers.h: Removed. * ForwardingHeaders/interpreter/ShadowChicken.h: Removed. * ForwardingHeaders/interpreter/StackVisitor.h: Removed. * ForwardingHeaders/jit/JITCode.h: Removed. * ForwardingHeaders/jit/JITMathICForwards.h: Removed. * ForwardingHeaders/jit/Snippet.h: Removed. * ForwardingHeaders/jit/SnippetParams.h: Removed. * ForwardingHeaders/jit/SpillRegistersMode.h: Removed. * ForwardingHeaders/masm/X86Assembler.h: Removed. * ForwardingHeaders/parser/ParserError.h: Removed. * ForwardingHeaders/parser/SourceCode.h: Removed. * ForwardingHeaders/parser/SourceProvider.h: Removed. * ForwardingHeaders/parser/SourceProviderCache.h: Removed. * ForwardingHeaders/profiler/ProfilerDatabase.h: Removed. * ForwardingHeaders/runtime/ArgList.h: Removed. * ForwardingHeaders/runtime/ArrayBuffer.h: Removed. * ForwardingHeaders/runtime/ArrayBufferView.h: Removed. * ForwardingHeaders/runtime/ArrayPrototype.h: Removed. * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Removed. * ForwardingHeaders/runtime/BooleanObject.h: Removed. * ForwardingHeaders/runtime/CallData.h: Removed. * ForwardingHeaders/runtime/CatchScope.h: Removed. * ForwardingHeaders/runtime/CommonIdentifiers.h: Removed. * ForwardingHeaders/runtime/Completion.h: Removed. * ForwardingHeaders/runtime/ConfigFile.h: Removed. * ForwardingHeaders/runtime/ConsoleClient.h: Removed. * ForwardingHeaders/runtime/ConsoleTypes.h: Removed. * ForwardingHeaders/runtime/ConstructAbility.h: Removed. * ForwardingHeaders/runtime/ConstructData.h: Removed. * ForwardingHeaders/runtime/DataView.h: Removed. * ForwardingHeaders/runtime/DateInstance.h: Removed. * ForwardingHeaders/runtime/Error.h: Removed. * ForwardingHeaders/runtime/ErrorHandlingScope.h: Removed. * ForwardingHeaders/runtime/ErrorInstance.h: Removed. * ForwardingHeaders/runtime/ErrorPrototype.h: Removed. * ForwardingHeaders/runtime/Exception.h: Removed. * ForwardingHeaders/runtime/ExceptionHelpers.h: Removed. * ForwardingHeaders/runtime/Float32Array.h: Removed. * ForwardingHeaders/runtime/Float64Array.h: Removed. * ForwardingHeaders/runtime/FunctionConstructor.h: Removed. * ForwardingHeaders/runtime/FunctionExecutable.h: Removed. * ForwardingHeaders/runtime/FunctionPrototype.h: Removed. * ForwardingHeaders/runtime/HashMapImpl.h: Removed. * ForwardingHeaders/runtime/Identifier.h: Removed. * ForwardingHeaders/runtime/IdentifierInlines.h: Removed. * ForwardingHeaders/runtime/InitializeThreading.h: Removed. * ForwardingHeaders/runtime/Int16Array.h: Removed. * ForwardingHeaders/runtime/Int32Array.h: Removed. * ForwardingHeaders/runtime/Int8Array.h: Removed. * ForwardingHeaders/runtime/InternalFunction.h: Removed. * ForwardingHeaders/runtime/Intrinsic.h: Removed. * ForwardingHeaders/runtime/IterationKind.h: Removed. * ForwardingHeaders/runtime/IteratorOperations.h: Removed. * ForwardingHeaders/runtime/IteratorPrototype.h: Removed. * ForwardingHeaders/runtime/JSAPIValueWrapper.h: Removed. * ForwardingHeaders/runtime/JSArray.h: Removed. * ForwardingHeaders/runtime/JSArrayBuffer.h: Removed. * ForwardingHeaders/runtime/JSArrayBufferView.h: Removed. * ForwardingHeaders/runtime/JSCInlines.h: Removed. * ForwardingHeaders/runtime/JSCJSValue.h: Removed. * ForwardingHeaders/runtime/JSCJSValueInlines.h: Removed. * ForwardingHeaders/runtime/JSCallee.h: Removed. * ForwardingHeaders/runtime/JSCell.h: Removed. * ForwardingHeaders/runtime/JSCellInlines.h: Removed. * ForwardingHeaders/runtime/JSDataView.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSExportMacros.h: Removed. * ForwardingHeaders/runtime/JSFunction.h: Removed. * ForwardingHeaders/runtime/JSGlobalObject.h: Removed. * ForwardingHeaders/runtime/JSGlobalObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSInternalPromise.h: Removed. * ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSLock.h: Removed. * ForwardingHeaders/runtime/JSMap.h: Removed. * ForwardingHeaders/runtime/JSMapIterator.h: Removed. * ForwardingHeaders/runtime/JSModuleLoader.h: Removed. * ForwardingHeaders/runtime/JSModuleRecord.h: Removed. * ForwardingHeaders/runtime/JSNativeStdFunction.h: Removed. * ForwardingHeaders/runtime/JSONObject.h: Removed. * ForwardingHeaders/runtime/JSObject.h: Removed. * ForwardingHeaders/runtime/JSObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSPromise.h: Removed. * ForwardingHeaders/runtime/JSPromiseConstructor.h: Removed. * ForwardingHeaders/runtime/JSPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSProxy.h: Removed. * ForwardingHeaders/runtime/JSRunLoopTimer.h: Removed. * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/JSScriptFetcher.h: Removed. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSSet.h: Removed. * ForwardingHeaders/runtime/JSSetIterator.h: Removed. * ForwardingHeaders/runtime/JSSourceCode.h: Removed. * ForwardingHeaders/runtime/JSString.h: Removed. * ForwardingHeaders/runtime/JSTypedArrays.h: Removed. * ForwardingHeaders/runtime/JSWithScope.h: Removed. * ForwardingHeaders/runtime/Lookup.h: Removed. * ForwardingHeaders/runtime/MapBase.h: Removed. * ForwardingHeaders/runtime/MapData.h: Removed. * ForwardingHeaders/runtime/MapDataInlines.h: Removed. * ForwardingHeaders/runtime/MatchResult.h: Removed. * ForwardingHeaders/runtime/Microtask.h: Removed. * ForwardingHeaders/runtime/ObjectConstructor.h: Removed. * ForwardingHeaders/runtime/ObjectPrototype.h: Removed. * ForwardingHeaders/runtime/Operations.h: Removed. * ForwardingHeaders/runtime/PrivateName.h: Removed. * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Removed. * ForwardingHeaders/runtime/PropertyNameArray.h: Removed. * ForwardingHeaders/runtime/Protect.h: Removed. * ForwardingHeaders/runtime/RegExp.h: Removed. * ForwardingHeaders/runtime/RegExpObject.h: Removed. * ForwardingHeaders/runtime/RuntimeFlags.h: Removed. * ForwardingHeaders/runtime/SamplingProfiler.h: Removed. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/ScriptFetcher.h: Removed. * ForwardingHeaders/runtime/StringObject.h: Removed. * ForwardingHeaders/runtime/StringPrototype.h: Removed. * ForwardingHeaders/runtime/Structure.h: Removed. * ForwardingHeaders/runtime/StructureChain.h: Removed. * ForwardingHeaders/runtime/StructureInlines.h: Removed. * ForwardingHeaders/runtime/Symbol.h: Removed. * ForwardingHeaders/runtime/SymbolTable.h: Removed. * ForwardingHeaders/runtime/ThrowScope.h: Removed. * ForwardingHeaders/runtime/TypedArrayController.h: Removed. * ForwardingHeaders/runtime/TypedArrayInlines.h: Removed. * ForwardingHeaders/runtime/TypedArrays.h: Removed. * ForwardingHeaders/runtime/Uint16Array.h: Removed. * ForwardingHeaders/runtime/Uint32Array.h: Removed. * ForwardingHeaders/runtime/Uint8Array.h: Removed. * ForwardingHeaders/runtime/Uint8ClampedArray.h: Removed. * ForwardingHeaders/runtime/VM.h: Removed. * ForwardingHeaders/runtime/VMEntryScope.h: Removed. * ForwardingHeaders/runtime/Watchdog.h: Removed. * ForwardingHeaders/runtime/WeakGCMap.h: Removed. * ForwardingHeaders/runtime/WeakGCMapInlines.h: Removed. * ForwardingHeaders/runtime/WriteBarrier.h: Removed. * ForwardingHeaders/wasm/WasmModule.h: Removed. * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Removed. * ForwardingHeaders/yarr/RegularExpression.h: Removed. * ForwardingHeaders/yarr/Yarr.h: Removed. * ForwardingHeaders/yarr/YarrInterpreter.h: Removed. * ForwardingHeaders/yarr/YarrJIT.h: Removed. * ForwardingHeaders/yarr/YarrPattern.h: Removed. * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: * Modules/encryptedmedia/MediaKeyMessageEvent.h: * Modules/encryptedmedia/MediaKeyMessageEventInit.h: * Modules/encryptedmedia/MediaKeyStatusMap.h: * Modules/encryptedmedia/legacy/LegacyCDM.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchRequestInit.h: * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBCursorWithValue.cpp: * Modules/indexeddb/IDBDatabase.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKey.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/client/TransactionOperation.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediacontrols/MediaControlsHost.cpp: * Modules/mediasource/SourceBuffer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Modules/webaudio/AsyncAudioDecoder.cpp: * Modules/webaudio/AudioBuffer.cpp: * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioContext.cpp: * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/PeriodicWave.h: * Modules/webaudio/RealtimeAnalyser.cpp: * Modules/webaudio/RealtimeAnalyser.h: * Modules/webaudio/ScriptProcessorNode.cpp: * Modules/webaudio/WaveShaperProcessor.h: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.h: * Modules/websockets/WebSocket.cpp: * Modules/websockets/WebSocketChannel.cpp: * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: * Modules/webvr/VREyeParameters.h: * Modules/webvr/VRFrameData.h: * Modules/webvr/VRPose.h: * Modules/webvr/VRStageParameters.h: * PlatformWin.cmake: * bindings/IDLTypes.h: * bindings/js/BufferSource.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/CachedScriptSourceProvider.h: * bindings/js/CallTracerTypes.h: * bindings/js/CommonVM.cpp: * bindings/js/DOMGCOutputConstraint.cpp: * bindings/js/DOMGCOutputConstraint.h: * bindings/js/GCController.cpp: * bindings/js/GCController.h: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCallbackData.h: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementInterface.h: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSCustomXPathNSResolver.cpp: * bindings/js/JSCustomXPathNSResolver.h: * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConvertBase.h: * bindings/js/JSDOMConvertBufferSource.h: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertInterface.h: * bindings/js/JSDOMConvertJSON.h: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertNumbers.h: * bindings/js/JSDOMConvertObject.h: * bindings/js/JSDOMConvertRecord.h: * bindings/js/JSDOMConvertSequences.h: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertUnion.h: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.h: * bindings/js/JSDOMIterator.cpp: * bindings/js/JSDOMIterator.h: * bindings/js/JSDOMMapLike.cpp: * bindings/js/JSDOMMapLike.h: * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMPromiseDeferred.h: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWindowProxy.h: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapper.h: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDOMWrapperCache.h: * bindings/js/JSDynamicDowncast.h: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventListener.h: * bindings/js/JSHTMLElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMainThreadExecState.h: * bindings/js/JSMainThreadExecStateInstrumentation.h: * bindings/js/JSMessageChannelCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSNodeIteratorCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSTreeWalkerCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * bindings/js/ScheduledAction.cpp: * bindings/js/ScheduledAction.h: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptCachedFrameData.h: * bindings/js/ScriptController.cpp: * bindings/js/ScriptController.h: * bindings/js/ScriptControllerMac.mm: * bindings/js/ScriptModuleLoader.cpp: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/js/ScriptState.cpp: * bindings/js/ScriptWrappable.h: * bindings/js/ScriptWrappableInlines.h: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreBuiltinNames.h: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WebCoreTypedArrayController.cpp: * bindings/js/WebCoreTypedArrayController.h: * bindings/js/WorkerScriptController.cpp: * bindings/js/WorkerScriptController.h: * bridge/NP_jsobject.cpp: * bridge/c/CRuntimeObject.cpp: * bridge/c/c_class.cpp: * bridge/c/c_instance.cpp: * bridge/c/c_runtime.cpp: * bridge/c/c_utility.cpp: * bridge/c/c_utility.h: * bridge/jsc/BridgeJSC.cpp: * bridge/jsc/BridgeJSC.h: * bridge/npruntime.cpp: * bridge/objc/ObjCRuntimeObject.mm: * bridge/objc/WebScriptObject.mm: * bridge/objc/WebScriptObjectPrivate.h: * bridge/objc/objc_instance.mm: * bridge/objc/objc_runtime.h: * bridge/objc/objc_runtime.mm: * bridge/objc/objc_utility.h: * bridge/objc/objc_utility.mm: * bridge/runtime_array.cpp: * bridge/runtime_array.h: * bridge/runtime_method.cpp: * bridge/runtime_method.h: * bridge/runtime_object.cpp: * bridge/runtime_object.h: * bridge/runtime_root.cpp: * bridge/runtime_root.h: * crypto/SubtleCrypto.cpp: * crypto/SubtleCrypto.h: * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: * crypto/keys/CryptoRsaKeyAlgorithm.h: * crypto/mac/CryptoKeyRSAMac.cpp: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: * css/CSSFontFaceSource.h: * css/DOMMatrixReadOnly.cpp: * css/DOMMatrixReadOnly.h: * css/FontFace.cpp: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementRegistry.cpp: * dom/CustomEvent.cpp: * dom/CustomEvent.h: * dom/Document.cpp: * dom/Document.h: * dom/ErrorEvent.cpp: * dom/ErrorEvent.h: * dom/LoadableScript.h: * dom/MessageEvent.cpp: * dom/MessageEvent.h: * dom/ModuleFetchParameters.h: * dom/PopStateEvent.cpp: * dom/PopStateEvent.h: * dom/PromiseRejectionEvent.cpp: * dom/PromiseRejectionEvent.h: * dom/RejectedPromiseTracker.cpp: * dom/RejectedPromiseTracker.h: * dom/ScriptExecutionContext.cpp: * dom/ScriptExecutionContext.h: * dom/TextEncoder.cpp: * dom/TextEncoder.h: * domjit/DOMJITHelpers.h: * domjit/DOMJITIDLTypeFilter.h: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * fileapi/BlobBuilder.cpp: * fileapi/FileReader.cpp: * fileapi/FileReaderLoader.cpp: * fileapi/FileReaderSync.cpp: * html/BaseTextInputType.cpp: * html/EmailInputType.cpp: * html/HTMLAllCollection.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLImageLoader.cpp: * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageData.cpp: * html/ImageData.h: * html/MediaEncryptedEventInit.h: * html/WebKitMediaKeyError.h: * html/canvas/WebGLAny.h: * html/canvas/WebGLRenderingContext.cpp: * html/canvas/WebGLRenderingContextBase.cpp: * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUBuffer.cpp: * html/canvas/WebGPURenderingContext.cpp: * html/canvas/WebGPURenderingContext.h: * html/track/DataCue.cpp: * html/track/DataCue.h: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIHost.h: * inspector/CommandLineAPIModule.cpp: * inspector/CommandLineAPIModule.h: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvas.h: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorController.h: * inspector/InspectorDatabaseResource.h: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorInstrumentation.h: * inspector/InspectorOverlay.cpp: * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorStyleSheet.h: * inspector/InspectorWebAgentBase.h: * inspector/InstrumentingAgents.h: * inspector/PageScriptDebugServer.cpp: * inspector/PageScriptDebugServer.h: * inspector/TimelineRecordFactory.cpp: * inspector/WebInjectedScriptHost.h: * inspector/WebInjectedScriptManager.h: * inspector/WorkerInspectorController.cpp: * inspector/WorkerInspectorController.h: * inspector/WorkerScriptDebugServer.cpp: * inspector/WorkerScriptDebugServer.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorDatabaseAgent.h: * inspector/agents/InspectorIndexedDBAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorLayerTreeAgent.cpp: * inspector/agents/InspectorLayerTreeAgent.h: * inspector/agents/InspectorMemoryAgent.cpp: * inspector/agents/InspectorMemoryAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorWorkerAgent.h: * inspector/agents/WebConsoleAgent.cpp: * inspector/agents/WebConsoleAgent.h: * inspector/agents/WebDebuggerAgent.h: * inspector/agents/WebHeapAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * inspector/agents/page/PageRuntimeAgent.h: * inspector/agents/worker/ServiceWorkerAgent.h: * inspector/agents/worker/WorkerDebuggerAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.h: * loader/EmptyClients.cpp: * page/CaptionUserPreferences.cpp: * page/Chrome.cpp: * page/ChromeClient.h: * page/Crypto.cpp: * page/DOMWindow.cpp: * page/DOMWindow.h: * page/Frame.cpp: * page/OriginThreadLocalCache.h: * page/PageConsoleClient.cpp: * page/PageConsoleClient.h: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/SettingsBase.h: * page/UserContentController.cpp: * page/cocoa/ResourceUsageThreadCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/ios/FrameIOS.mm: * page/linux/ResourceUsageOverlayLinux.cpp: * page/linux/ResourceUsageThreadLinux.cpp: * platform/MediaSample.h: * platform/SerializedPlatformRepresentation.h: * platform/SharedBuffer.h: * platform/audio/mac/CARingBuffer.h: * platform/cocoa/SharedBufferCocoa.mm: * platform/graphics/ImageBuffer.h: * platform/graphics/LegacyCDMSession.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferDataCG.cpp: * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/GPUDeviceMetal.mm: * platform/graphics/filters/FEBlend.cpp: * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FEComponentTransfer.cpp: * platform/graphics/filters/FEComposite.cpp: * platform/graphics/filters/FEConvolveMatrix.cpp: * platform/graphics/filters/FEDisplacementMap.cpp: * platform/graphics/filters/FEDropShadow.cpp: * platform/graphics/filters/FEGaussianBlur.cpp: * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMorphology.cpp: * platform/graphics/filters/FETurbulence.cpp: * platform/graphics/filters/FilterEffect.cpp: * platform/graphics/filters/FilterEffect.h: * platform/graphics/gpu/GPUBuffer.h: * platform/graphics/gpu/GPUDevice.h: * platform/graphics/iso/ISOBox.cpp: * platform/graphics/iso/ISOOriginalFormatBox.cpp: * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: * platform/graphics/iso/ISOSchemeInformationBox.cpp: * platform/graphics/iso/ISOSchemeTypeBox.cpp: * platform/graphics/iso/ISOTrackEncryptionBox.cpp: * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/win/ImageBufferDataDirect2D.cpp: * platform/graphics/win/ImageBufferDataDirect2D.h: * platform/ios/wak/WebCoreThread.mm: * platform/mac/SerializedPlatformRepresentationMac.mm: * platform/mac/StringUtilities.mm: * platform/mock/mediasource/MockBox.cpp: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * svg/graphics/SVGImage.cpp: * testing/GCObservation.cpp: * testing/GCObservation.h: * testing/Internals.cpp: * testing/Internals.h: * testing/LegacyMockCDM.cpp: * testing/MockCDMFactory.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/Worker.cpp: * workers/Worker.h: * workers/WorkerConsoleClient.cpp: * workers/WorkerConsoleClient.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.cpp: * workers/WorkerMessagingProxy.cpp: * workers/WorkerThread.h: * workers/service/ExtendableEvent.cpp: * workers/service/ServiceWorker.cpp: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClient.h: * workers/service/context/ServiceWorkerInspectorProxy.cpp: * workers/service/context/ServiceWorkerThread.cpp: * xml/XMLHttpRequest.cpp: Source/WebKit: * Platform/mac/StringUtilities.mm: * Shared/Cocoa/WebKit2InitializeCocoa.mm: * Shared/WebKit2Initialize.cpp: * Shared/linux/WebMemorySamplerLinux.cpp: * Shared/mac/WebMemorySampler.mac.mm: * UIProcess/WebProcessPool.cpp: * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h: * WebProcess/InjectedBundle/API/glib/WebKitConsoleMessagePrivate.h: * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/PluginProcessConnection.cpp: * WebProcess/Plugins/PluginView.cpp: * WebProcess/WebPage/WebInspector.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: Source/WebKitLegacy/ios: * Misc/WebUIKitSupport.mm: Source/WebKitLegacy/mac: * Carbon/CarbonWindowAdapter.mm: * DOM/WebDOMOperations.mm: * History/WebBackForwardList.mm: * History/WebHistoryItem.mm: * Misc/WebCache.mm: * Misc/WebElementDictionary.mm: * Misc/WebIconDatabase.mm: * Misc/WebStringTruncator.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/Hosted/ProxyInstance.mm: * Plugins/Hosted/ProxyRuntimeObject.mm: * Plugins/Hosted/WebHostedNetscapePluginView.mm: * Plugins/WebBaseNetscapePluginView.mm: * Plugins/WebBasePluginPackage.mm: * Plugins/WebNetscapePluginStream.mm: * Plugins/WebNetscapePluginView.mm: * Plugins/WebPluginController.mm: * WebCoreSupport/WebEditorClient.mm: * WebCoreSupport/WebFrameLoaderClient.mm: * WebCoreSupport/WebInspectorClient.h: * WebCoreSupport/WebInspectorClient.mm: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: * WebView/WebHTMLRepresentation.mm: * WebView/WebHTMLView.mm: * WebView/WebPreferences.mm: * WebView/WebScriptDebugDelegate.mm: * WebView/WebScriptDebugger.h: * WebView/WebTextIterator.mm: * WebView/WebView.mm: * WebView/WebViewData.mm: Source/WebKitLegacy/win: * Plugins/PluginView.cpp: * Plugins/PluginViewWin.cpp: * WebCoreSupport/WebInspectorClient.cpp: * WebCoreSupport/WebInspectorClient.h: * WebFrame.cpp: * WebJavaScriptCollector.cpp: * WebView.cpp: Tools: * WebKitTestRunner/TestController.cpp: Canonical link: https://commits.webkit.org/198358@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-07 05:20:34 +00:00
#include <JavaScriptCore/TypedArrays.h>
#include <wtf/Span.h>
[Fetch API] Implement abortable fetch https://bugs.webkit.org/show_bug.cgi?id=174980 <rdar://problem/46861402> Reviewed by Chris Dumez. LayoutTests/imported/w3c: Fixed tests to run in WebKit CI. Also fixed a bug in a test where the fetch response body is not actually empty. * web-platform-tests/fetch/api/abort/cache.https-expected.txt: * web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.js: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Source/WebCore: Add an AbortSignal to FetchRequest. Add support for AbortSignal algorithm. The fetch request signal is added an algorithm to abort the fetch. Update clone algorithm to let signal of the cloned request be following the origin request. Update ReadableStream error handling to return an exception instead of a string. This allows passing an AbortError instead of a TypeError as previously done. Update FetchBodyOwner to store a loading error either as an exception or as a resource error. The latter is used for passing the error from service worker back to the page. The former is used to pass it to ReadableStream or body accessors. Covered by enabled tests. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): (WebCore::FetchBodyOwner::setLoadingError): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadingError const): (WebCore::FetchBodyOwner::loadingException const): * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::error): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error): * dom/AbortSignal.cpp: (WebCore::AbortSignal::abort): (WebCore::AbortSignal::follow): * dom/AbortSignal.h: LayoutTests: * TestExpectations: Enable abort tests. Canonical link: https://commits.webkit.org/207672@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-05 00:01:43 +00:00
#include <wtf/WeakPtr.h>
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
namespace JSC {
[JSC] Change signature of HostFunction to (JSGlobalObject*, CallFrame*) https://bugs.webkit.org/show_bug.cgi?id=202569 Reviewed by Saam Barati. Source/JavaScriptCore: This patch changes JSC host-functions's signature from `CallFrame*` to `JSGlobalObject*, CallFrame*`. We would like to replace the current `ExecState*` use with `JSGlobalObject*` to fix many issues, remove globalExec() hack, and remove `ExecState::vm()` hack. This is important since this hack prevents us from implementing scalable IsoSubspace optimization, which leads to putting all JS cells in each IsoSubspace. To get lexical JSGlobalObject in a super fast way, we put it in JSFunction/InternalFunction's field. And trampoline gets JSGlobalObject from callee, and passes it as its argument. Since this trampoline already accesses to the field of callee to get executable address, getting another field is fairly cheap. The memory increase does not matter in this case. The sizeof(JSFunction) is 40. Since our allocation size of JSCells are rounded by 16, increasing one field does not change the actual allocation size. And # of InternalFunction is very limited since it is only used for constructors in JSC. This patch changes the signature. And for the ExecState* -> JSGlobalObject* preparation, we use `CallFrame*` name instead of `ExecState*` in the host-functions. And use `callFrame` variable name instead of `state` or `exec`. And we also get VM& from `JSGlobalObject*` instead of `CallFrame*` since it is faster. * API/APICallbackFunction.h: (JSC::APICallbackFunction::call): (JSC::APICallbackFunction::construct): * API/APICast.h: * API/JSAPIGlobalObject.mm: (JSC::JSAPIGlobalObject::moduleLoaderFetch): * API/JSBaseInternal.h: * API/JSCallbackObject.h: * API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject<Parent>::construct): (JSC::JSCallbackObject<Parent>::call): * bytecode/InlineCallFrame.h: * debugger/Debugger.h: * dfg/DFGArithMode.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): * dfg/DFGGraph.h: * dfg/DFGOSREntry.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): * ftl/FTLOSREntry.h: * inspector/ConsoleMessage.h: * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeAsyncCall): * inspector/InjectedScriptManager.h: * inspector/JSGlobalObjectInspectorController.h: * inspector/JSInjectedScriptHostPrototype.cpp: (Inspector::jsInjectedScriptHostPrototypeAttributeEvaluate): (Inspector::jsInjectedScriptHostPrototypeAttributeSavedResultAlias): (Inspector::jsInjectedScriptHostPrototypeFunctionInternalConstructorName): (Inspector::jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection): (Inspector::jsInjectedScriptHostPrototypeFunctionIsPromiseRejectedWithNativeGetterTypeError): (Inspector::jsInjectedScriptHostPrototypeFunctionProxyTargetValue): (Inspector::jsInjectedScriptHostPrototypeFunctionWeakMapSize): (Inspector::jsInjectedScriptHostPrototypeFunctionWeakMapEntries): (Inspector::jsInjectedScriptHostPrototypeFunctionWeakSetSize): (Inspector::jsInjectedScriptHostPrototypeFunctionWeakSetEntries): (Inspector::jsInjectedScriptHostPrototypeFunctionIteratorEntries): (Inspector::jsInjectedScriptHostPrototypeFunctionQueryInstances): (Inspector::jsInjectedScriptHostPrototypeFunctionQueryHolders): (Inspector::jsInjectedScriptHostPrototypeFunctionEvaluateWithScopeExtension): (Inspector::jsInjectedScriptHostPrototypeFunctionSubtype): (Inspector::jsInjectedScriptHostPrototypeFunctionFunctionDetails): (Inspector::jsInjectedScriptHostPrototypeFunctionGetInternalProperties): * inspector/JSJavaScriptCallFramePrototype.cpp: (Inspector::jsJavaScriptCallFramePrototypeFunctionEvaluateWithScopeExtension): (Inspector::jsJavaScriptCallFramePrototypeFunctionScopeDescriptions): (Inspector::jsJavaScriptCallFrameAttributeCaller): (Inspector::jsJavaScriptCallFrameAttributeSourceID): (Inspector::jsJavaScriptCallFrameAttributeLine): (Inspector::jsJavaScriptCallFrameAttributeColumn): (Inspector::jsJavaScriptCallFrameAttributeFunctionName): (Inspector::jsJavaScriptCallFrameAttributeScopeChain): (Inspector::jsJavaScriptCallFrameAttributeThisObject): (Inspector::jsJavaScriptCallFrameAttributeType): (Inspector::jsJavaScriptCallFrameIsTailDeleted): * inspector/ScriptArguments.h: * inspector/ScriptCallStackFactory.h: * inspector/ScriptDebugServer.h: * inspector/agents/InspectorConsoleAgent.h: * interpreter/AbstractPC.h: * interpreter/CallFrame.h: (JSC::ExecState::guaranteedJSValueCallee const): Deleted. (JSC::ExecState::jsCallee const): Deleted. (JSC::ExecState::callee const): Deleted. (JSC::ExecState::unsafeCallee const): Deleted. (JSC::ExecState::codeBlock const): Deleted. (JSC::ExecState::addressOfCodeBlock const): Deleted. (JSC::ExecState::unsafeCodeBlock const): Deleted. (JSC::ExecState::scope const): Deleted. (JSC::ExecState::create): Deleted. (JSC::ExecState::registers): Deleted. (JSC::ExecState::registers const): Deleted. (JSC::ExecState::operator=): Deleted. (JSC::ExecState::callerFrame const): Deleted. (JSC::ExecState::callerFrameOrEntryFrame const): Deleted. (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): Deleted. (JSC::ExecState::callerFrameOffset): Deleted. (JSC::ExecState::returnPC const): Deleted. (JSC::ExecState::hasReturnPC const): Deleted. (JSC::ExecState::clearReturnPC): Deleted. (JSC::ExecState::returnPCOffset): Deleted. (JSC::ExecState::abstractReturnPC): Deleted. (JSC::ExecState::topOfFrame): Deleted. (JSC::ExecState::setCallerFrame): Deleted. (JSC::ExecState::setScope): Deleted. (JSC::ExecState::argumentCount const): Deleted. (JSC::ExecState::argumentCountIncludingThis const): Deleted. (JSC::ExecState::argumentOffset): Deleted. (JSC::ExecState::argumentOffsetIncludingThis): Deleted. (JSC::ExecState::addressOfArgumentsStart const): Deleted. (JSC::ExecState::argument): Deleted. (JSC::ExecState::uncheckedArgument): Deleted. (JSC::ExecState::setArgument): Deleted. (JSC::ExecState::getArgumentUnsafe): Deleted. (JSC::ExecState::thisArgumentOffset): Deleted. (JSC::ExecState::thisValue): Deleted. (JSC::ExecState::setThisValue): Deleted. (JSC::ExecState::newTarget): Deleted. (JSC::ExecState::offsetFor): Deleted. (JSC::ExecState::noCaller): Deleted. (JSC::ExecState::isGlobalExec const): Deleted. (JSC::ExecState::setArgumentCountIncludingThis): Deleted. (JSC::ExecState::setCallee): Deleted. (JSC::ExecState::setCodeBlock): Deleted. (JSC::ExecState::setReturnPC): Deleted. (JSC::ExecState::iterate): Deleted. (JSC::ExecState::argIndexForRegister): Deleted. (JSC::ExecState::callerFrameAndPC): Deleted. (JSC::ExecState::callerFrameAndPC const): Deleted. (JSC::ExecState::unsafeCallerFrameAndPC const): Deleted. * interpreter/Interpreter.cpp: (JSC::Interpreter::executeProgram): (JSC::Interpreter::executeCall): (JSC::Interpreter::executeConstruct): (JSC::Interpreter::prepareForRepeatCall): (JSC::Interpreter::execute): (JSC::Interpreter::executeModuleProgram): * interpreter/ProtoCallFrame.h: (JSC::ProtoCallFrame::init): * interpreter/Register.h: * interpreter/ShadowChicken.h: * interpreter/StackVisitor.h: * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopCallFrame): (JSC::VMEntryRecord::unsafePrevTopCallFrame): * jit/CCallHelpers.h: * jit/JITExceptions.h: * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * jsc.cpp: (GlobalObject::finishCreation): (functionPrintStdOut): (functionPrintStdErr): (functionDebug): (functionDescribe): (functionDescribeArray): (functionSleepSeconds): (functionJSCStack): (functionGCAndSweep): (functionFullGC): (functionEdenGC): (functionHeapSize): (functionResetMemoryPeak): (functionAddressOf): (functionVersion): (functionRun): (functionRunString): (functionLoad): (functionLoadString): (functionReadFile): (functionCheckSyntax): (functionSetSamplingFlags): (functionClearSamplingFlags): (functionGetRandomSeed): (functionSetRandomSeed): (functionIsRope): (functionCallerSourceOrigin): (functionReadline): (functionPreciseTime): (functionNeverInlineFunction): (functionNoDFG): (functionNoFTL): (functionNoOSRExitFuzzing): (functionOptimizeNextInvocation): (functionNumberOfDFGCompiles): (functionCallerIsOMGCompiled): (functionDollarCreateRealm): (functionDollarEvalScript): (functionDollarAgentStart): (functionDollarAgentReceiveBroadcast): (functionDollarAgentReport): (functionDollarAgentSleep): (functionDollarAgentBroadcast): (functionDollarAgentGetReport): (functionDollarAgentLeaving): (functionDollarAgentMonotonicNow): (functionWaitForReport): (functionHeapCapacity): (functionFlashHeapAccess): (functionDisableRichSourceInfo): (functionMallocInALoop): (functionTotalCompileTime): (functionJSCOptions): (functionReoptimizationRetryCount): (functionTransferArrayBuffer): (functionFailNextNewCodeBlock): (functionQuit): (functionFalse): (functionUndefined1): (functionUndefined2): (functionIsInt32): (functionIsPureNaN): (functionIdentity): (functionEffectful42): (functionMakeMasquerader): (functionHasCustomProperties): (functionDumpTypesForAllVariables): (functionDrainMicrotasks): (functionReleaseWeakRefs): (functionIs32BitPlatform): (functionCreateGlobalObject): (functionCheckModuleSyntax): (functionPlatformSupportsSamplingProfiler): (functionGenerateHeapSnapshot): (functionGenerateHeapSnapshotForGCDebugging): (functionResetSuperSamplerState): (functionEnsureArrayStorage): (functionStartSamplingProfiler): (functionSamplingProfilerStackTraces): (functionMaxArguments): (functionAsyncTestStart): (functionAsyncTestPassed): (functionWebAssemblyMemoryMode): (functionSetUnhandledRejectionCallback): (runWithOptions): (functionDollarDetachArrayBuffer): Deleted. * llint/LLIntExceptions.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::handleHostCall): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::callFrame const): (JSC::CLoopRegister::execState const): Deleted. * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/cloop.rb: * runtime/ArrayBufferView.h: * runtime/ArrayConstructor.cpp: (JSC::constructArrayWithSizeQuirk): (JSC::constructWithArrayConstructor): (JSC::callArrayConstructor): (JSC::arrayConstructorPrivateFuncIsArraySlow): * runtime/ArrayConstructor.h: * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncSpeciesCreate): (JSC::arrayProtoFuncToString): (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush): (JSC::arrayProtoFuncReverse): (JSC::arrayProtoFuncShift): (JSC::arrayProtoFuncSlice): (JSC::arrayProtoFuncSplice): (JSC::arrayProtoFuncUnShift): (JSC::arrayProtoFuncIndexOf): (JSC::arrayProtoFuncLastIndexOf): (JSC::arrayProtoPrivateFuncConcatMemcpy): (JSC::arrayProtoPrivateFuncAppendMemcpy): * runtime/ArrayPrototype.h: * runtime/AsyncFunctionConstructor.cpp: (JSC::callAsyncFunctionConstructor): (JSC::constructAsyncFunctionConstructor): * runtime/AsyncGeneratorFunctionConstructor.cpp: (JSC::callAsyncGeneratorFunctionConstructor): (JSC::constructAsyncGeneratorFunctionConstructor): * runtime/AtomicsObject.cpp: (JSC::atomicsFuncAdd): (JSC::atomicsFuncAnd): (JSC::atomicsFuncCompareExchange): (JSC::atomicsFuncExchange): (JSC::atomicsFuncIsLockFree): (JSC::atomicsFuncLoad): (JSC::atomicsFuncOr): (JSC::atomicsFuncStore): (JSC::atomicsFuncSub): (JSC::atomicsFuncWait): (JSC::atomicsFuncWake): (JSC::atomicsFuncXor): * runtime/BigIntConstructor.cpp: (JSC::callBigIntConstructor): (JSC::bigIntConstructorFuncAsUintN): (JSC::bigIntConstructorFuncAsIntN): * runtime/BigIntPrototype.cpp: (JSC::bigIntProtoFuncToStringImpl): (JSC::bigIntProtoFuncToString): (JSC::bigIntProtoFuncToLocaleString): (JSC::bigIntProtoFuncValueOf): * runtime/BooleanConstructor.cpp: (JSC::callBooleanConstructor): (JSC::constructWithBooleanConstructor): (JSC::constructBooleanFromImmediateBoolean): * runtime/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): (JSC::booleanProtoFuncValueOf): * runtime/CallData.h: * runtime/CommonSlowPaths.h: * runtime/Completion.h: * runtime/ConsoleClient.h: * runtime/ConsoleObject.cpp: (JSC::consoleLogWithLevel): (JSC::consoleProtoFuncDebug): (JSC::consoleProtoFuncError): (JSC::consoleProtoFuncLog): (JSC::consoleProtoFuncInfo): (JSC::consoleProtoFuncWarn): (JSC::consoleProtoFuncClear): (JSC::consoleProtoFuncDir): (JSC::consoleProtoFuncDirXML): (JSC::consoleProtoFuncTable): (JSC::consoleProtoFuncTrace): (JSC::consoleProtoFuncAssert): (JSC::consoleProtoFuncCount): (JSC::consoleProtoFuncCountReset): (JSC::consoleProtoFuncProfile): (JSC::consoleProtoFuncProfileEnd): (JSC::consoleProtoFuncTakeHeapSnapshot): (JSC::consoleProtoFuncTime): (JSC::consoleProtoFuncTimeLog): (JSC::consoleProtoFuncTimeEnd): (JSC::consoleProtoFuncTimeStamp): (JSC::consoleProtoFuncGroup): (JSC::consoleProtoFuncGroupCollapsed): (JSC::consoleProtoFuncGroupEnd): (JSC::consoleProtoFuncRecord): (JSC::consoleProtoFuncRecordEnd): (JSC::consoleProtoFuncScreenshot): * runtime/ConstructData.h: * runtime/DateConstructor.cpp: (JSC::constructWithDateConstructor): (JSC::callDate): (JSC::dateParse): (JSC::dateNowImpl): (JSC::dateNow): (JSC::dateUTC): * runtime/DateConstructor.h: * runtime/DatePrototype.cpp: (JSC::dateProtoFuncToString): (JSC::dateProtoFuncToUTCString): (JSC::dateProtoFuncToISOString): (JSC::dateProtoFuncToDateString): (JSC::dateProtoFuncToTimeString): (JSC::dateProtoFuncToLocaleString): (JSC::dateProtoFuncToLocaleDateString): (JSC::dateProtoFuncToLocaleTimeString): (JSC::dateProtoFuncToPrimitiveSymbol): (JSC::dateProtoFuncGetTime): (JSC::dateProtoFuncGetFullYear): (JSC::dateProtoFuncGetUTCFullYear): (JSC::dateProtoFuncGetMonth): (JSC::dateProtoFuncGetUTCMonth): (JSC::dateProtoFuncGetDate): (JSC::dateProtoFuncGetUTCDate): (JSC::dateProtoFuncGetDay): (JSC::dateProtoFuncGetUTCDay): (JSC::dateProtoFuncGetHours): (JSC::dateProtoFuncGetUTCHours): (JSC::dateProtoFuncGetMinutes): (JSC::dateProtoFuncGetUTCMinutes): (JSC::dateProtoFuncGetSeconds): (JSC::dateProtoFuncGetUTCSeconds): (JSC::dateProtoFuncGetMilliSeconds): (JSC::dateProtoFuncGetUTCMilliseconds): (JSC::dateProtoFuncGetTimezoneOffset): (JSC::dateProtoFuncSetTime): (JSC::dateProtoFuncSetMilliSeconds): (JSC::dateProtoFuncSetUTCMilliseconds): (JSC::dateProtoFuncSetSeconds): (JSC::dateProtoFuncSetUTCSeconds): (JSC::dateProtoFuncSetMinutes): (JSC::dateProtoFuncSetUTCMinutes): (JSC::dateProtoFuncSetHours): (JSC::dateProtoFuncSetUTCHours): (JSC::dateProtoFuncSetDate): (JSC::dateProtoFuncSetUTCDate): (JSC::dateProtoFuncSetMonth): (JSC::dateProtoFuncSetUTCMonth): (JSC::dateProtoFuncSetFullYear): (JSC::dateProtoFuncSetUTCFullYear): (JSC::dateProtoFuncSetYear): (JSC::dateProtoFuncGetYear): (JSC::dateProtoFuncToJSON): * runtime/DatePrototype.h: * runtime/ECMAScriptSpecInternalFunctions.cpp: (JSC::esSpecIsConstructor): * runtime/ECMAScriptSpecInternalFunctions.h: * runtime/Error.h: * runtime/ErrorConstructor.cpp: (JSC::ErrorConstructor::finishCreation): (JSC::constructErrorConstructor): (JSC::callErrorConstructor): (JSC::ErrorConstructor::put): (JSC::ErrorConstructor::deleteProperty): * runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString): * runtime/ExceptionFuzz.h: * runtime/FunctionConstructor.cpp: (JSC::constructWithFunctionConstructor): (JSC::callFunctionConstructor): (JSC::constructFunction): * runtime/FunctionPrototype.cpp: (JSC::callFunctionPrototype): (JSC::functionProtoFuncToString): * runtime/GeneratorFunctionConstructor.cpp: (JSC::callGeneratorFunctionConstructor): (JSC::constructGeneratorFunctionConstructor): * runtime/Identifier.h: * runtime/InspectorInstrumentationObject.cpp: (JSC::inspectorInstrumentationObjectLog): * runtime/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction): * runtime/InternalFunction.h: (JSC::InternalFunction::offsetOfGlobalObject): (JSC::InternalFunction::globalObject const): * runtime/IntlCollatorConstructor.cpp: (JSC::constructIntlCollator): (JSC::callIntlCollator): (JSC::IntlCollatorConstructorFuncSupportedLocalesOf): * runtime/IntlCollatorConstructor.h: * runtime/IntlCollatorPrototype.cpp: (JSC::IntlCollatorFuncCompare): (JSC::IntlCollatorPrototypeGetterCompare): (JSC::IntlCollatorPrototypeFuncResolvedOptions): * runtime/IntlDateTimeFormatConstructor.cpp: (JSC::constructIntlDateTimeFormat): (JSC::callIntlDateTimeFormat): (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf): * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatFuncFormatDateTime): (JSC::IntlDateTimeFormatPrototypeGetterFormat): (JSC::IntlDateTimeFormatPrototypeFuncFormatToParts): (JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions): * runtime/IntlNumberFormatConstructor.cpp: (JSC::constructIntlNumberFormat): (JSC::callIntlNumberFormat): (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf): * runtime/IntlNumberFormatConstructor.h: * runtime/IntlNumberFormatPrototype.cpp: (JSC::IntlNumberFormatFuncFormatNumber): (JSC::IntlNumberFormatPrototypeGetterFormat): (JSC::IntlNumberFormatPrototypeFuncFormatToParts): (JSC::IntlNumberFormatPrototypeFuncResolvedOptions): * runtime/IntlObject.cpp: (JSC::intlObjectFuncGetCanonicalLocales): * runtime/IntlPluralRulesConstructor.cpp: (JSC::constructIntlPluralRules): (JSC::callIntlPluralRules): (JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf): * runtime/IntlPluralRulesConstructor.h: * runtime/IntlPluralRulesPrototype.cpp: (JSC::IntlPluralRulesPrototypeFuncSelect): (JSC::IntlPluralRulesPrototypeFuncResolvedOptions): * runtime/JSArrayBufferConstructor.cpp: (JSC::JSGenericArrayBufferConstructor<sharingMode>::finishCreation): (JSC::JSGenericArrayBufferConstructor<sharingMode>::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::arrayBufferFuncIsView): * runtime/JSArrayBufferConstructor.h: * runtime/JSArrayBufferPrototype.cpp: (JSC::arrayBufferProtoFuncSlice): (JSC::arrayBufferProtoGetterFuncByteLength): (JSC::sharedArrayBufferProtoGetterFuncByteLength): * runtime/JSBoundFunction.cpp: (JSC::boundThisNoArgsFunctionCall): (JSC::boundFunctionCall): (JSC::boundThisNoArgsFunctionConstruct): (JSC::boundFunctionConstruct): (JSC::isBoundFunction): (JSC::hasInstanceBoundFunction): (JSC::JSBoundFunction::boundArgsCopy): * runtime/JSBoundFunction.h: * runtime/JSCJSValue.h: * runtime/JSCell.h: * runtime/JSCustomGetterSetterFunction.cpp: (JSC::JSCustomGetterSetterFunction::customGetterSetterFunctionCall): * runtime/JSCustomGetterSetterFunction.h: * runtime/JSDataViewPrototype.cpp: (JSC::getData): (JSC::setData): (JSC::dataViewProtoGetterBuffer): (JSC::dataViewProtoGetterByteLength): (JSC::dataViewProtoGetterByteOffset): (JSC::dataViewProtoFuncGetInt8): (JSC::dataViewProtoFuncGetInt16): (JSC::dataViewProtoFuncGetInt32): (JSC::dataViewProtoFuncGetUint8): (JSC::dataViewProtoFuncGetUint16): (JSC::dataViewProtoFuncGetUint32): (JSC::dataViewProtoFuncGetFloat32): (JSC::dataViewProtoFuncGetFloat64): (JSC::dataViewProtoFuncSetInt8): (JSC::dataViewProtoFuncSetInt16): (JSC::dataViewProtoFuncSetInt32): (JSC::dataViewProtoFuncSetUint8): (JSC::dataViewProtoFuncSetUint16): (JSC::dataViewProtoFuncSetUint32): (JSC::dataViewProtoFuncSetFloat32): (JSC::dataViewProtoFuncSetFloat64): * runtime/JSDateMath.h: * runtime/JSFunction.cpp: (JSC::callHostFunctionAsConstructor): (JSC::JSFunction::JSFunction): (JSC::JSFunction::prototypeForConstruction): (JSC::JSFunction::allocateAndInitializeRareData): (JSC::JSFunction::initializeRareData): (JSC::JSFunction::getOwnPropertySlot): * runtime/JSFunction.h: (JSC::JSFunction::offsetOfGlobalObject): (JSC::JSFunction::globalObject const): * runtime/JSFunctionInlines.h: (JSC::JSFunction::JSFunction): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::constructGenericTypedArrayView): (JSC::callGenericTypedArrayView): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::genericTypedArrayViewProtoFuncSlice): (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate): * runtime/JSGlobalObject.cpp: (JSC::makeBoundFunction): (JSC::hasOwnLengthProperty): (JSC::assertCall): (JSC::enqueueJob): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval): (JSC::globalFuncParseInt): (JSC::globalFuncParseFloat): (JSC::globalFuncDecodeURI): (JSC::globalFuncDecodeURIComponent): (JSC::globalFuncEncodeURI): (JSC::globalFuncEncodeURIComponent): (JSC::globalFuncEscape): (JSC::globalFuncUnescape): (JSC::globalFuncThrowTypeError): (JSC::globalFuncThrowTypeErrorArgumentsCalleeAndCaller): (JSC::globalFuncMakeTypeError): (JSC::globalFuncProtoGetter): (JSC::globalFuncProtoSetter): (JSC::globalFuncHostPromiseRejectionTracker): (JSC::globalFuncBuiltinLog): (JSC::globalFuncBuiltinDescribe): (JSC::globalFuncImportModule): (JSC::globalFuncPropertyIsEnumerable): (JSC::globalFuncOwnKeys): (JSC::globalFuncDateTimeFormat): * runtime/JSGlobalObjectFunctions.h: * runtime/JSLock.h: * runtime/JSModuleLoader.cpp: (JSC::moduleLoaderParseModule): (JSC::moduleLoaderRequestedModules): (JSC::moduleLoaderModuleDeclarationInstantiation): (JSC::moduleLoaderResolve): (JSC::moduleLoaderResolveSync): (JSC::moduleLoaderFetch): (JSC::moduleLoaderGetModuleNamespaceObject): (JSC::moduleLoaderEvaluate): * runtime/JSNativeStdFunction.cpp: (JSC::runStdFunction): * runtime/JSNativeStdFunction.h: * runtime/JSONObject.cpp: (JSC::JSONProtoFuncParse): (JSC::JSONProtoFuncStringify): * runtime/JSObject.cpp: (JSC::objectPrivateFuncInstanceOf): * runtime/JSObject.h: * runtime/JSTypedArrayViewConstructor.cpp: (JSC::constructTypedArrayView): * runtime/JSTypedArrayViewPrototype.cpp: (JSC::typedArrayViewPrivateFuncIsTypedArrayView): (JSC::typedArrayViewPrivateFuncLength): (JSC::typedArrayViewPrivateFuncGetOriginalConstructor): (JSC::typedArrayViewPrivateFuncSort): (JSC::typedArrayViewProtoFuncSet): (JSC::typedArrayViewProtoFuncCopyWithin): (JSC::typedArrayViewProtoFuncIncludes): (JSC::typedArrayViewProtoFuncLastIndexOf): (JSC::typedArrayViewProtoFuncIndexOf): (JSC::typedArrayViewProtoFuncJoin): (JSC::typedArrayViewProtoGetterFuncBuffer): (JSC::typedArrayViewProtoGetterFuncLength): (JSC::typedArrayViewProtoGetterFuncByteLength): (JSC::typedArrayViewProtoGetterFuncByteOffset): (JSC::typedArrayViewProtoFuncReverse): (JSC::typedArrayViewPrivateFuncSubarrayCreate): (JSC::typedArrayViewProtoFuncSlice): (JSC::typedArrayViewProtoGetterFuncToStringTag): * runtime/JSTypedArrayViewPrototype.h: * runtime/MapConstructor.cpp: (JSC::callMap): (JSC::constructMap): (JSC::mapPrivateFuncMapBucketHead): (JSC::mapPrivateFuncMapBucketNext): (JSC::mapPrivateFuncMapBucketKey): (JSC::mapPrivateFuncMapBucketValue): * runtime/MapConstructor.h: * runtime/MapPrototype.cpp: (JSC::getMap): (JSC::mapProtoFuncClear): (JSC::mapProtoFuncDelete): (JSC::mapProtoFuncGet): (JSC::mapProtoFuncHas): (JSC::mapProtoFuncSet): (JSC::mapProtoFuncSize): * runtime/MathObject.cpp: (JSC::mathProtoFuncAbs): (JSC::mathProtoFuncACos): (JSC::mathProtoFuncASin): (JSC::mathProtoFuncATan): (JSC::mathProtoFuncATan2): (JSC::mathProtoFuncCeil): (JSC::mathProtoFuncClz32): (JSC::mathProtoFuncCos): (JSC::mathProtoFuncExp): (JSC::mathProtoFuncFloor): (JSC::mathProtoFuncHypot): (JSC::mathProtoFuncLog): (JSC::mathProtoFuncMax): (JSC::mathProtoFuncMin): (JSC::mathProtoFuncPow): (JSC::mathProtoFuncRandom): (JSC::mathProtoFuncRound): (JSC::mathProtoFuncSign): (JSC::mathProtoFuncSin): (JSC::mathProtoFuncSqrt): (JSC::mathProtoFuncTan): (JSC::mathProtoFuncIMul): (JSC::mathProtoFuncACosh): (JSC::mathProtoFuncASinh): (JSC::mathProtoFuncATanh): (JSC::mathProtoFuncCbrt): (JSC::mathProtoFuncCosh): (JSC::mathProtoFuncExpm1): (JSC::mathProtoFuncFround): (JSC::mathProtoFuncLog1p): (JSC::mathProtoFuncLog10): (JSC::mathProtoFuncLog2): (JSC::mathProtoFuncSinh): (JSC::mathProtoFuncTanh): (JSC::mathProtoFuncTrunc): * runtime/MathObject.h: * runtime/Microtask.h: * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructNativeErrorConstructor): (JSC::NativeErrorConstructor<errorType>::callNativeErrorConstructor): * runtime/NativeErrorConstructor.h: * runtime/NativeFunction.h: (JSC::NativeFunction::operator()): (JSC::TaggedNativeFunction::operator()): * runtime/NullGetterFunction.cpp: (JSC::NullGetterFunctionInternal::callReturnUndefined): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::callReturnUndefined): * runtime/NumberConstructor.cpp: (JSC::constructNumberConstructor): (JSC::callNumberConstructor): (JSC::numberConstructorFuncIsInteger): (JSC::numberConstructorFuncIsSafeInteger): * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToExponential): (JSC::numberProtoFuncToFixed): (JSC::numberProtoFuncToPrecision): (JSC::numberProtoFuncToString): (JSC::numberProtoFuncToLocaleString): (JSC::numberProtoFuncValueOf): * runtime/NumberPrototype.h: * runtime/ObjectConstructor.cpp: (JSC::constructObjectWithNewTarget): (JSC::constructWithObjectConstructor): (JSC::callObjectConstructor): (JSC::objectConstructorGetPrototypeOf): (JSC::objectConstructorSetPrototypeOf): (JSC::objectConstructorGetOwnPropertyDescriptor): (JSC::objectConstructorGetOwnPropertyDescriptors): (JSC::objectConstructorGetOwnPropertyNames): (JSC::objectConstructorGetOwnPropertySymbols): (JSC::objectConstructorKeys): (JSC::objectConstructorAssign): (JSC::objectConstructorValues): (JSC::objectConstructorDefineProperty): (JSC::objectConstructorDefineProperties): (JSC::objectConstructorCreate): (JSC::objectConstructorSeal): (JSC::objectConstructorFreeze): (JSC::objectConstructorPreventExtensions): (JSC::objectConstructorIsSealed): (JSC::objectConstructorIsFrozen): (JSC::objectConstructorIsExtensible): (JSC::objectConstructorIs): (JSC::constructObject): Deleted. * runtime/ObjectConstructor.h: * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncHasOwnProperty): (JSC::objectProtoFuncIsPrototypeOf): (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): (JSC::objectProtoFuncLookupGetter): (JSC::objectProtoFuncLookupSetter): (JSC::objectProtoFuncPropertyIsEnumerable): (JSC::objectProtoFuncToLocaleString): (JSC::objectProtoFuncToString): * runtime/ObjectPrototype.h: * runtime/ProxyConstructor.cpp: (JSC::makeRevocableProxy): (JSC::proxyRevocableConstructorThrowError): (JSC::constructProxyObject): (JSC::callProxy): * runtime/ProxyObject.cpp: (JSC::performProxyCall): (JSC::performProxyConstruct): * runtime/ProxyRevoke.cpp: (JSC::performProxyRevoke): * runtime/ReflectObject.cpp: (JSC::reflectObjectConstruct): (JSC::reflectObjectDefineProperty): (JSC::reflectObjectGet): (JSC::reflectObjectGetOwnPropertyDescriptor): (JSC::reflectObjectGetPrototypeOf): (JSC::reflectObjectIsExtensible): (JSC::reflectObjectOwnKeys): (JSC::reflectObjectPreventExtensions): (JSC::reflectObjectSet): (JSC::reflectObjectSetPrototypeOf): * runtime/RegExpConstructor.cpp: (JSC::regExpConstructorDollar): (JSC::regExpConstructorInput): (JSC::regExpConstructorMultiline): (JSC::regExpConstructorLastMatch): (JSC::regExpConstructorLastParen): (JSC::regExpConstructorLeftContext): (JSC::regExpConstructorRightContext): (JSC::setRegExpConstructorInput): (JSC::setRegExpConstructorMultiline): (JSC::esSpecRegExpCreate): (JSC::constructWithRegExpConstructor): (JSC::callRegExpConstructor): * runtime/RegExpConstructor.h: * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncTestFast): (JSC::regExpProtoFuncExec): (JSC::regExpProtoFuncMatchFast): (JSC::regExpProtoFuncCompile): (JSC::regExpProtoFuncToString): (JSC::regExpProtoGetterGlobal): (JSC::regExpProtoGetterIgnoreCase): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterDotAll): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): (JSC::regExpProtoGetterFlags): (JSC::regExpProtoGetterSource): (JSC::regExpProtoFuncSearchFast): (JSC::regExpProtoFuncSplitFast): * runtime/RegExpPrototype.h: * runtime/SetConstructor.cpp: (JSC::callSet): (JSC::constructSet): (JSC::setPrivateFuncSetBucketHead): (JSC::setPrivateFuncSetBucketNext): (JSC::setPrivateFuncSetBucketKey): * runtime/SetConstructor.h: * runtime/SetPrototype.cpp: (JSC::getSet): (JSC::setProtoFuncAdd): (JSC::setProtoFuncClear): (JSC::setProtoFuncDelete): (JSC::setProtoFuncHas): (JSC::setProtoFuncSize): * runtime/StringConstructor.cpp: (JSC::stringFromCharCode): (JSC::stringFromCodePoint): (JSC::constructWithStringConstructor): (JSC::callStringConstructor): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncRepeatCharacter): (JSC::stringProtoFuncReplaceUsingRegExp): (JSC::stringProtoFuncReplaceUsingStringSearch): (JSC::stringProtoFuncToString): (JSC::stringProtoFuncCharAt): (JSC::stringProtoFuncCharCodeAt): (JSC::stringProtoFuncCodePointAt): (JSC::stringProtoFuncIndexOf): (JSC::stringProtoFuncLastIndexOf): (JSC::stringProtoFuncSlice): (JSC::stringProtoFuncSplitFast): (JSC::stringProtoFuncSubstrImpl): (JSC::stringProtoFuncSubstr): (JSC::builtinStringSubstrInternal): (JSC::stringProtoFuncSubstring): (JSC::stringProtoFuncToLowerCase): (JSC::stringProtoFuncToUpperCase): (JSC::stringProtoFuncLocaleCompare): (JSC::toLocaleCase): (JSC::stringProtoFuncToLocaleLowerCase): (JSC::stringProtoFuncToLocaleUpperCase): (JSC::stringProtoFuncTrim): (JSC::stringProtoFuncTrimStart): (JSC::stringProtoFuncTrimEnd): (JSC::stringProtoFuncStartsWith): (JSC::stringProtoFuncEndsWith): (JSC::stringIncludesImpl): (JSC::stringProtoFuncIncludes): (JSC::builtinStringIncludesInternal): (JSC::stringProtoFuncIterator): (JSC::stringProtoFuncNormalize): * runtime/StringPrototype.h: * runtime/SymbolConstructor.cpp: (JSC::callSymbol): (JSC::symbolConstructorFor): (JSC::symbolConstructorKeyFor): * runtime/SymbolPrototype.cpp: (JSC::symbolProtoGetterDescription): (JSC::symbolProtoFuncToString): (JSC::symbolProtoFuncValueOf): * runtime/ThrowScope.h: * runtime/TypedArrayController.h: * runtime/VM.h: * runtime/VMTraps.h: * runtime/Watchdog.h: * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): (JSC::constructWeakMap): * runtime/WeakMapPrototype.cpp: (JSC::getWeakMap): (JSC::protoFuncWeakMapDelete): (JSC::protoFuncWeakMapGet): (JSC::protoFuncWeakMapHas): (JSC::protoFuncWeakMapSet): * runtime/WeakObjectRefConstructor.cpp: (JSC::callWeakRef): (JSC::constructWeakRef): * runtime/WeakObjectRefPrototype.cpp: (JSC::getWeakRef): (JSC::protoFuncWeakRefDeref): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): (JSC::constructWeakSet): * runtime/WeakSetPrototype.cpp: (JSC::getWeakSet): (JSC::protoFuncWeakSetDelete): (JSC::protoFuncWeakSetHas): (JSC::protoFuncWeakSetAdd): * tools/JSDollarVM.cpp: (JSC::DOMJITGetterComplex::functionEnableException): (JSC::DOMJITFunctionObject::functionWithTypeCheck): (JSC::DOMJITCheckSubClassObject::functionWithTypeCheck): (JSC::functionWasmStreamingParserAddBytes): (JSC::functionWasmStreamingParserFinalize): (JSC::functionCrash): (JSC::functionBreakpoint): (JSC::functionDFGTrue): (JSC::functionFTLTrue): (JSC::functionCpuMfence): (JSC::functionCpuRdtsc): (JSC::functionCpuCpuid): (JSC::functionCpuPause): (JSC::functionCpuClflush): (JSC::functionLLintTrue): (JSC::functionJITTrue): (JSC::functionNoInline): (JSC::functionGC): (JSC::functionEdenGC): (JSC::functionDumpSubspaceHashes): (JSC::functionCallFrame): (JSC::functionCodeBlockForFrame): (JSC::codeBlockFromArg): (JSC::functionCodeBlockFor): (JSC::functionDumpSourceFor): (JSC::functionDumpBytecodeFor): (JSC::doPrint): (JSC::functionDataLog): (JSC::functionPrint): (JSC::functionDumpCallFrame): (JSC::functionDumpStack): (JSC::functionDumpRegisters): (JSC::functionDumpCell): (JSC::functionIndexingMode): (JSC::functionInlineCapacity): (JSC::functionValue): (JSC::functionGetPID): (JSC::functionHaveABadTime): (JSC::functionIsHavingABadTime): (JSC::functionCreateGlobalObject): (JSC::functionCreateProxy): (JSC::functionCreateRuntimeArray): (JSC::functionCreateNullRopeString): (JSC::functionCreateImpureGetter): (JSC::functionCreateCustomGetterObject): (JSC::functionCreateDOMJITNodeObject): (JSC::functionCreateDOMJITGetterObject): (JSC::functionCreateDOMJITGetterComplexObject): (JSC::functionCreateDOMJITFunctionObject): (JSC::functionCreateDOMJITCheckSubClassObject): (JSC::functionCreateDOMJITGetterBaseJSObject): (JSC::functionCreateWasmStreamingParser): (JSC::functionCreateStaticCustomAccessor): (JSC::functionSetImpureGetterDelegate): (JSC::functionCreateBuiltin): (JSC::functionGetPrivateProperty): (JSC::functionCreateRoot): (JSC::functionCreateElement): (JSC::functionGetElement): (JSC::functionCreateSimpleObject): (JSC::functionGetHiddenValue): (JSC::functionSetHiddenValue): (JSC::functionShadowChickenFunctionsOnStack): (JSC::functionSetGlobalConstRedeclarationShouldNotThrow): (JSC::functionFindTypeForExpression): (JSC::functionReturnTypeFor): (JSC::functionFlattenDictionaryObject): (JSC::functionDumpBasicBlockExecutionRanges): (JSC::functionHasBasicBlockExecuted): (JSC::functionBasicBlockExecutionCount): (JSC::functionEnableExceptionFuzz): (JSC::functionEnableDebuggerModeWhenIdle): (JSC::functionDisableDebuggerModeWhenIdle): (JSC::functionDeleteAllCodeWhenIdle): (JSC::functionGlobalObjectCount): (JSC::functionGlobalObjectForObject): (JSC::functionGetGetterSetter): (JSC::functionLoadGetterFromGetterSetter): (JSC::functionCreateCustomTestGetterSetter): (JSC::functionDeltaBetweenButterflies): (JSC::functionTotalGCTime): (JSC::functionParseCount): (JSC::functionIsWasmSupported): * wasm/WasmEmbedder.h: * wasm/js/JSWebAssembly.cpp: (JSC::webAssemblyCompileFunc): (JSC::webAssemblyInstantiateFunc): (JSC::webAssemblyValidateFunc): (JSC::webAssemblyCompileStreamingInternal): (JSC::webAssemblyInstantiateStreamingInternal): * wasm/js/JSWebAssembly.h: * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::constructJSWebAssemblyCompileError): (JSC::callJSWebAssemblyCompileError): * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): (JSC::callJSWebAssemblyInstance): * wasm/js/WebAssemblyInstancePrototype.cpp: (JSC::webAssemblyInstanceProtoFuncExports): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::constructJSWebAssemblyLinkError): (JSC::callJSWebAssemblyLinkError): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): (JSC::callJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): (JSC::webAssemblyMemoryProtoFuncBuffer): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::webAssemblyModuleCustomSections): (JSC::webAssemblyModuleImports): (JSC::webAssemblyModuleExports): (JSC::constructJSWebAssemblyModule): (JSC::callJSWebAssemblyModule): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::constructJSWebAssemblyRuntimeError): (JSC::callJSWebAssemblyRuntimeError): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): (JSC::callJSWebAssemblyTable): * wasm/js/WebAssemblyTablePrototype.cpp: (JSC::webAssemblyTableProtoFuncLength): (JSC::webAssemblyTableProtoFuncGrow): (JSC::webAssemblyTableProtoFuncGet): (JSC::webAssemblyTableProtoFuncSet): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::callWebAssemblyWrapperFunction): * yarr/YarrErrorCode.h: Source/WebCore: No behavior change. While signature is changed, we still use `state` name for CallFrame* variable since changing this involves massive channge in CodeGeneratorJS.pm. When replacing `ExecState*` to `JSGlobalObject*`, we just remove these `state` variable and use `globalObject` instead. * Modules/applepay/ApplePaySession.h: * Modules/applepay/PaymentMerchantSession.h: * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBFactory.h: * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBKeyRange.h: * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/server/IDBSerializationContext.h: * bindings/js/IDBBindingUtilities.h: * bindings/js/JSDOMBindingSecurity.h: * bindings/js/JSDOMBuiltinConstructor.h: (WebCore::JSDOMBuiltinConstructor<JSClass>::construct): * bindings/js/JSDOMConstructor.h: * bindings/js/JSDOMConstructorBase.cpp: (WebCore::callThrowTypeError): * bindings/js/JSDOMConstructorNotConstructable.h: (WebCore::JSDOMConstructorNotConstructable::callThrowTypeError): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::makeThisTypeErrorForBuiltins): (WebCore::makeGetterTypeErrorForBuiltins): (WebCore::isReadableByteStreamAPIEnabled): * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::next): * bindings/js/JSDOMNamedConstructor.h: * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenPromiseIsSettled): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowInstanceFunctionOpenDatabase): * bindings/js/JSExtendableMessageEventCustom.cpp: (WebCore::constructJSExtendableMessageEvent): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::callPlugin): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::setupModuleScriptHandlers): * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptState.h: * bindings/js/StructuredClone.cpp: (WebCore::cloneArrayBufferImpl): (WebCore::cloneArrayBuffer): (WebCore::structuredCloneArrayBuffer): (WebCore::structuredCloneArrayBufferView): * bindings/js/StructuredClone.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): (GenerateOperationTrampolineDefinition): (GenerateSerializerDefinition): (GenerateLegacyCallerDefinitions): (GenerateLegacyCallerDefinition): (GenerateIterableDefinition): (GenerateConstructorDefinitions): (GenerateConstructorDefinition): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::jsMapLikePrototypeFunctionGet): (WebCore::jsMapLikePrototypeFunctionHas): (WebCore::jsMapLikePrototypeFunctionEntries): (WebCore::jsMapLikePrototypeFunctionKeys): (WebCore::jsMapLikePrototypeFunctionValues): (WebCore::jsMapLikePrototypeFunctionForEach): (WebCore::jsMapLikePrototypeFunctionAdd): (WebCore::jsMapLikePrototypeFunctionClear): (WebCore::jsMapLikePrototypeFunctionDelete): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::jsReadOnlyMapLikePrototypeFunctionGet): (WebCore::jsReadOnlyMapLikePrototypeFunctionHas): (WebCore::jsReadOnlyMapLikePrototypeFunctionEntries): (WebCore::jsReadOnlyMapLikePrototypeFunctionKeys): (WebCore::jsReadOnlyMapLikePrototypeFunctionValues): (WebCore::jsReadOnlyMapLikePrototypeFunctionForEach): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactions): (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::jsTestCEReactionsStringifierPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::jsTestCallTracerPrototypeFunctionTestOperationInterface): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationSpecified): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithArguments): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgument): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgument): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::jsTestDOMJITPrototypeFunctionGetAttribute): (WebCore::jsTestDOMJITPrototypeFunctionItem): (WebCore::jsTestDOMJITPrototypeFunctionHasAttribute): (WebCore::jsTestDOMJITPrototypeFunctionGetElementById): (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByName): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperation): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructorConstructor::construct): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItem): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation): (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled): (WebCore::jsTestGlobalObjectInstanceFunctionTestPrivateFunction): (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResult): (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBoolean): (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::construct): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod1): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2): (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod3): (WebCore::jsTestInterfaceConstructorFunctionImplementsMethod4): (WebCore::jsTestInterfacePrototypeFunctionTakeNodes): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod1): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3): (WebCore::jsTestInterfaceConstructorFunctionSupplementalMethod4): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::jsTestIterablePrototypeFunctionEntries): (WebCore::jsTestIterablePrototypeFunctionKeys): (WebCore::jsTestIterablePrototypeFunctionValues): (WebCore::jsTestIterablePrototypeFunctionForEach): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetter): (WebCore::jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::construct): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleter): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::jsTestNamedGetterWithIdentifierPrototypeFunctionGetterName): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetter): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterPrototypeFunctionNamedSetter): (WebCore::jsTestNamedSetterWithIndexedGetterPrototypeFunctionIndexedSetter): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetter): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperation): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodeConstructor::construct): (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise): (WebCore::jsTestNodePrototypeFunctionCalculateSecretResult): (WebCore::jsTestNodePrototypeFunctionGetSecretBoolean): (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean): (WebCore::jsTestNodePrototypeFunctionEntries): (WebCore::jsTestNodePrototypeFunctionKeys): (WebCore::jsTestNodePrototypeFunctionValues): (WebCore::jsTestNodePrototypeFunctionForEach): (WebCore::jsTestNodePrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::construct): (WebCore::callJSTestObj1): (WebCore::callJSTestObj2): (WebCore::callJSTestObj3): (WebCore::callJSTestObj): (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation): (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic): (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled): (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod): (WebCore::jsTestObjPrototypeFunctionCalculateSecretResult): (WebCore::jsTestObjPrototypeFunctionGetSecretBoolean): (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBoolean): (WebCore::jsTestObjPrototypeFunctionVoidMethod): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionByteMethod): (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionOctetMethod): (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionLongMethod): (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionObjMethod): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): (WebCore::jsTestObjInstanceFunctionUnforgeableMethod): (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString): (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter): (WebCore::jsTestObjPrototypeFunctionNullableStringMethod): (WebCore::jsTestObjConstructorFunctionNullableStringStaticMethod): (WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod): (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg): (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArg): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg): (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNullableByteStringArg): (WebCore::jsTestObjPrototypeFunctionMethodWithByteStringArgTreatingNullAsEmptyString): (WebCore::jsTestObjPrototypeFunctionSerializedValue): (WebCore::jsTestObjPrototypeFunctionMethodWithRecord): (WebCore::jsTestObjPrototypeFunctionMethodWithException): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionReturningLong): (WebCore::jsTestObjPrototypeFunctionMethodWithExceptionReturningObject): (WebCore::jsTestObjPrototypeFunctionCustomMethod): (WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionPrivateMethod): (WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod): (WebCore::jsTestObjPrototypeFunctionAddEventListener): (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoid): (WebCore::jsTestObjPrototypeFunctionWithExecStateObj): (WebCore::jsTestObjPrototypeFunctionWithExecStateVoidException): (WebCore::jsTestObjPrototypeFunctionWithExecStateObjException): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecState): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateObjException): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndExecStateWithSpaces): (WebCore::jsTestObjPrototypeFunctionWithDocumentArgument): (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgument): (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgument): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringAndDefaultValue): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsNull): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomStringIsEmptyString): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLong): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequence): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAny): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalObject): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalRecord): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromise): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArg): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg): (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionConditionalMethod1): (WebCore::jsTestObjPrototypeFunctionConditionalMethod2): (WebCore::jsTestObjPrototypeFunctionConditionalMethod3): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter): (WebCore::jsTestObjConstructorFunctionClassMethod): (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): (WebCore::jsTestObjConstructorFunctionClassMethod2): (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp): (WebCore::jsTestObjPrototypeFunctionClassMethodWithClampOnOptional): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange): (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRangeOnOptional): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence): (WebCore::jsTestObjPrototypeFunctionStringArrayFunction): (WebCore::jsTestObjPrototypeFunctionDomStringListFunction): (WebCore::jsTestObjPrototypeFunctionOperationWithOptionalUnionParameter): (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence): (WebCore::jsTestObjPrototypeFunctionGetElementById): (WebCore::jsTestObjPrototypeFunctionGetSVGDocument): (WebCore::jsTestObjPrototypeFunctionConvert1): (WebCore::jsTestObjPrototypeFunctionConvert2): (WebCore::jsTestObjPrototypeFunctionConvert3): (WebCore::jsTestObjPrototypeFunctionConvert4): (WebCore::jsTestObjPrototypeFunctionMutablePointFunction): (WebCore::jsTestObjPrototypeFunctionOrange): (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod): (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod): (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod): (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod): (WebCore::jsTestObjPrototypeFunctionAny): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException): (WebCore::jsTestObjPrototypeFunctionTestCustomPromiseFunction): (WebCore::jsTestObjConstructorFunctionTestStaticCustomPromiseFunction): (WebCore::jsTestObjPrototypeFunctionTestCustomReturnsOwnPromiseFunction): (WebCore::jsTestObjPrototypeFunctionTestReturnsOwnPromiseAndPromiseProxyFunction): (WebCore::jsTestObjPrototypeFunctionConditionalOverload): (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload): (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot): (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter): (WebCore::jsTestObjPrototypeFunctionBufferSourceParameter): (WebCore::jsTestObjPrototypeFunctionLegacyCallerNamed): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimization): (WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationWithException): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowFunction): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWorkerFunction): (WebCore::jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunction): (WebCore::jsTestObjPrototypeFunctionToString): (WebCore::jsTestObjPrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::constructJSTestOverloadedConstructors1): (WebCore::constructJSTestOverloadedConstructors2): (WebCore::constructJSTestOverloadedConstructors3): (WebCore::constructJSTestOverloadedConstructors4): (WebCore::constructJSTestOverloadedConstructors5): (WebCore::JSTestOverloadedConstructorsConstructor::construct): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::constructJSTestOverloadedConstructorsWithSequence1): (WebCore::constructJSTestOverloadedConstructorsWithSequence2): (WebCore::JSTestOverloadedConstructorsWithSequenceConstructor::construct): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::JSTestPromiseRejectionEventConstructor::construct): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::jsTestSerializationPrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: (WebCore::jsTestSerializationInheritPrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionFunction): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::jsTestStringifierPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::jsTestStringifierAnonymousOperationPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::jsTestStringifierNamedOperationPrototypeFunctionIdentifier): (WebCore::jsTestStringifierNamedOperationPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::jsTestStringifierOperationImplementedAsPrototypeFunctionIdentifier): (WebCore::jsTestStringifierOperationImplementedAsPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::jsTestStringifierOperationNamedToStringPrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::jsTestStringifierReadOnlyAttributePrototypeFunctionToString): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::jsTestStringifierReadWriteAttributePrototypeFunctionToString): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::construct): (WebCore::jsTestTypedefsPrototypeFunctionFunc): (WebCore::jsTestTypedefsPrototypeFunctionSetShadow): (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg): (WebCore::jsTestTypedefsPrototypeFunctionSequenceOfNullablesArg): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfNullablesArg): (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArg): (WebCore::jsTestTypedefsPrototypeFunctionUnionArg): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampInTypedef): (WebCore::jsTestTypedefsPrototypeFunctionPointFunction): (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction): (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2): (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude): (WebCore::jsTestTypedefsPrototypeFunctionMethodWithException): * bridge/c/c_utility.h: * bridge/objc/objc_runtime.mm: (JSC::Bindings::callObjCFallbackObject): * bridge/runtime_method.cpp: (JSC::callRuntimeMethod): * bridge/runtime_object.cpp: (JSC::Bindings::callRuntimeObject): (JSC::Bindings::callRuntimeConstructor): * crypto/SubtleCrypto.h: * css/CSSFontFace.h: * dom/CustomElementReactionQueue.h: * dom/Document.h: * dom/MessagePort.h: * dom/MouseEvent.h: * dom/ScriptExecutionContext.h: * html/HTMLFrameElementBase.h: * html/canvas/WebGLAny.h: * inspector/agents/InspectorDOMAgent.h: * inspector/agents/page/PageRuntimeAgent.h: * page/DOMWindow.h: * page/PageConsoleClient.h: * page/RemoteDOMWindow.h: * page/csp/ContentSecurityPolicy.h: * platform/ThreadGlobalData.h: * plugins/PluginViewBase.h: * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.h: * workers/WorkerConsoleClient.h: * workers/service/ExtendableMessageEvent.h: * worklets/WorkletConsoleClient.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPMethod.cpp: (WebKit::callMethod): * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::callNPJSObject): (WebKit::constructWithConstructor): * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: Source/WebKitLegacy/mac: * WebView/WebScriptDebugger.h: Canonical link: https://commits.webkit.org/216126@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250803 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-07 23:13:45 +00:00
class CallFrame;
[Fetch API] Add a JS builtin to implement https://fetch.spec.whatwg.org/#concept-headers-fill https://bugs.webkit.org/show_bug.cgi?id=159932 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-19 Reviewed by Alex Christensen. Covered by existing tests. Refactoring Headers initializeWith to use the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill. Refactoring Response constructor to put more checks in the JS builtin fucntion called within constructor. Making use of the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill. * CMakeLists.txt: Adding FetchHeadersInternals.js * DerivedSources.make: Ditto. * Modules/fetch/FetchHeaders.js: (initializeFetchHeaders): Using fillFetchHeaders new built-in internal. * Modules/fetch/FetchInternals.js: Added. (fillFetchHeaders): * Modules/fetch/FetchResponse.cpp: Refactoring to do more in the JS built-in. Splitting of initializeWith so that the checks are done in the order defined by the spec. (WebCore::FetchResponse::setStatus): (WebCore::FetchResponse::initializeWith): (WebCore::isNullBodyStatus): Deleted. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponse.js: (initializeFetchResponse): New built-in internal. * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/178124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-20 06:23:13 +00:00
class JSValue;
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
};
namespace WebCore {
[Fetch API] Implement abortable fetch https://bugs.webkit.org/show_bug.cgi?id=174980 <rdar://problem/46861402> Reviewed by Chris Dumez. LayoutTests/imported/w3c: Fixed tests to run in WebKit CI. Also fixed a bug in a test where the fetch response body is not actually empty. * web-platform-tests/fetch/api/abort/cache.https-expected.txt: * web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.js: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Source/WebCore: Add an AbortSignal to FetchRequest. Add support for AbortSignal algorithm. The fetch request signal is added an algorithm to abort the fetch. Update clone algorithm to let signal of the cloned request be following the origin request. Update ReadableStream error handling to return an exception instead of a string. This allows passing an AbortError instead of a TypeError as previously done. Update FetchBodyOwner to store a loading error either as an exception or as a resource error. The latter is used for passing the error from service worker back to the page. The former is used to pass it to ReadableStream or body accessors. Covered by enabled tests. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): (WebCore::FetchBodyOwner::setLoadingError): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadingError const): (WebCore::FetchBodyOwner::loadingException const): * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::error): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error): * dom/AbortSignal.cpp: (WebCore::AbortSignal::abort): (WebCore::AbortSignal::follow): * dom/AbortSignal.h: LayoutTests: * TestExpectations: Enable abort tests. Canonical link: https://commits.webkit.org/207672@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-05 00:01:43 +00:00
class AbortSignal;
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
class FetchRequest;
LayoutTests/imported/w3c: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * web-platform-tests/fetch/api/basic/stream-response-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: * web-platform-tests/fetch/api/request/request-consume.html: * web-platform-tests/fetch/api/resources/data.json: Added. * web-platform-tests/fetch/api/resources/utils.js: (validateStreamFromString): * web-platform-tests/fetch/api/response/response-cancel-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-cancel-stream.html: Added. * web-platform-tests/fetch/api/response/response-clone-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume-stream.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-1.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-1.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-2.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-2.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-3.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-3.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-4.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-4.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-5.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-5.html: Added. Source/WebCore: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. This patch introduces ReadableStreamSource and ReadableStreamController which allow feeding a ReadableStream from DOM classes. ReadableStreamSource is a base class for all DOM ReadableStream sources. ReadableStreamController is a wrapper around JSReadableStreamController that can be invoked by DOM code to enqueue/close/error a ReadableStream. A createReadableStream function is introduced to allow DOM classes creating ReadableStream. Added support for a FetchResponse ReadableStream source. Both synthetic FetchResponse and loading FetchResponse are supported. A new "Stream" FetchLoader::Type is introduced to allow receiving data as chunks and feeding them to a ReadableStream through ReadableStreamSource. Currently, FetchResponse is consumed and marked as disturbed as soon as a ReadableStreamSource is created. This should be changed so that consumption happens on the first read call to the ReadableStreamReader, i.e. when stream gets disturbed. FetchResponseSource never fulfills the start promise, which allows to enqueue, error or close the stream at any time. FetchResponseSource must therefore always ensure to close or error the stream. Added support for locked check in FetchResponse. Tests: imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-1.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-2.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-3.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-4.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-5.html Also covered by rebased tests. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): Fill stream with body data. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::type): Added accessor to body type, used for assertions. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::isDisturbed): Adding stream isLocked check. (WebCore::FetchBodyOwner::blobLoadingSucceeded): Added assertion that body type is blob. Closing stream if created. (WebCore::FetchBodyOwner::blobLoadingFailed): Erroring the stream if created and not cancelled. (WebCore::FetchBodyOwner::blobChunk): Filling stream with chunk. (WebCore::FetchBodyOwner::stop): Rmoved call to finishBlobLoading as it should be called as part of FetchLoaderCLient::didFail callbacki. * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchLoader.cpp: Fixing the case of cancel being called when creating the ThreadableLoader by introducing FetchLoader::m_isStarted. (WebCore::FetchLoader::start): Setting m_isStarted at the end of the start method. (WebCore::FetchLoader::stop): Fixing the case that FetchLoader can be destroyed when cancelling its loader. (WebCore::FetchLoader::startStreaming): Introduced to switch the loading type from ArayBuffer to Stream. Already buffered data is returned. (WebCore::FetchLoader::didReceiveData): Handling of the new Stream type. (WebCore::FetchLoader::didFinishLoading): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchLoaderClient.h: (WebCore::FetchLoaderClient::didReceiveData): Callback to get data as chunks if loader is of type Stream. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): Removed m_isLocked as it is handled within isDisturbed(). (WebCore::FetchResponse::isDisturbed): Checking whether related ReadableStream is locked. (WebCore::FetchResponse::BodyLoader::didSucceed): Introduced to handle ReadableStream case. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveData): Ditto. (WebCore::FetchResponse::BodyLoader::startStreaming): Ditto. (WebCore::FetchResponse::consumeBodyAsStream): Start filling the ReadableStream with data. Changing loader to Stream if there is one. (WebCore::FetchResponse::createReadableStreamSource): Called by custom binding to create the source. (WebCore::FetchResponse::stop): Fixing potential crash in case of cancelling the ibody stream. (WebCore::FetchResponse::startFetching): (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponseSource.cpp: Specialization of ReadableStreamSource for FetchResponse. It is a push source that never resolves the start promise. (WebCore::FetchResponseSource::FetchResponseSource): (WebCore::FetchResponseSource::isReadableStreamLocked): (WebCore::FetchResponseSource::setActive): (WebCore::FetchResponseSource::setInactive): (WebCore::FetchResponseSource::doStart): (WebCore::FetchResponseSource::doCancel): (WebCore::FetchResponseSource::close): (WebCore::FetchResponseSource::error): * Modules/fetch/FetchResponseSource.h: Added. * Modules/streams/ReadableStreamController.js: (error): * Modules/streams/ReadableStreamSource.h: Added (base class for ReadableStream DOM sources). (WebCore::ReadableStreamSource::~ReadableStreamSource): (WebCore::ReadableStreamSource::isStarting): (WebCore::ReadableStreamSource::isPulling): (WebCore::ReadableStreamSource::isCancelling): (WebCore::ReadableStreamSource::controller): (WebCore::ReadableStreamSource::doStart): (WebCore::ReadableStreamSource::doCancel): (WebCore::ReadableStreamSource::start): (WebCore::ReadableStreamSource::cancel): (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::clean): * Modules/streams/ReadableStreamSource.idl: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSFetchResponseCustom.cpp: In case body is not created, call createReadableStreamSource. (WebCore::JSFetchResponse::body): * bindings/js/JSReadableStreamSourceCustom.cpp: Added. (WebCore::JSReadableStreamSource::start): (WebCore::JSReadableStreamSource::pull): (WebCore::JSReadableStreamSource::controller): * bindings/js/ReadableStreamController.cpp: Added. (WebCore::callFunction): (WebCore::ReadableStreamController::invoke): (WebCore::ReadableStreamController::isControlledReadableStreamLocked): (WebCore::createReadableStream): * bindings/js/ReadableStreamController.h: The DOM wrapper for JSReadableStreamController. (WebCore::ReadableStreamController::ReadableStreamController): (WebCore::ReadableStreamController::close): (WebCore::ReadableStreamController::error): (WebCore::ReadableStreamController::enqueue): (WebCore::ReadableStreamController::globalObject): (WebCore::ReadableStreamController::enqueue<RefPtr<JSC::ArrayBuffer>>): (WebCore::ReadableStreamController::error<String>): LayoutTests: [Streams] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream-expected.txt: Added. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api.html: Added. * http/tests/xmlhttprequest/streams/streams-read-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read.html: Added. Canonical link: https://commits.webkit.org/174776@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-17 18:04:20 +00:00
class ReadableStreamSource;
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
class FetchResponse final : public FetchBodyOwner {
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
public:
[Fetch API] Implement Fetch redirect mode https://bugs.webkit.org/show_bug.cgi?id=157837 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: * web-platform-tests/fetch/api/redirect/redirect-location.js: * web-platform-tests/fetch/api/redirect/redirect-method.js: * web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: * web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt: Source/WebCore: Implementing step 5 of https://fetch.spec.whatwg.org/#http-fetch. Making ResourceLoaderOptions include FetchOptions. This allows SubresourceLoader to follow or not redirections based on that option. CachedResource is made responsible to handle the type of the response (opaqueredirect, opaque, cors, basic...). If redirection is not to be followed, either an error is returned or an empty response is returned. Moved Response type and redirected flag from FetchResponse to ResourceResponse. This allows CachedResource to easily communicate that information to FetchResponse. Made some clean-up refactoring in ThreadableLoaderOptions. http/tests/fetch/caching-with-different-options.html ensures that caching at CachedResourceLoader will not have bad effects on fetch. Covered by updated and rebased tests. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::startFetching): * Modules/fetch/FetchResponse.h: * WebCore.xcodeproj/project.pbxproj: * loader/FetchOptions.h: Moved from Source/WebCore/Modules/fetch/FetchOptions.h. * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::fetchOptions): (WebCore::ResourceLoaderOptions::setFetchOptions): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/ThreadableLoader.cpp: * loader/ThreadableLoader.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setResponse): * loader/cache/CachedResource.h: (WebCore::CachedResource::setOpaqueRedirect): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::adopt): (WebCore::ResourceResponseBase::copyData): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::type): (WebCore::ResourceResponseBase::setType): (WebCore::ResourceResponseBase::encode): (WebCore::ResourceResponseBase::decode): LayoutTests: * http/tests/fetch/caching-with-different-options-expected.txt: Added. * http/tests/fetch/caching-with-different-options.html: Added. * http/tests/fetch/resources/redirect-with-cache.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: Canonical link: https://commits.webkit.org/176136@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-24 07:35:09 +00:00
using Type = ResourceResponse::Type;
Change IDL enumerations to be nested in their C++ class instead of at WebCore namespace level https://bugs.webkit.org/show_bug.cgi?id=157257 Reviewed by Chris Dumez. Source/WebCore: Chris and Alex requested this alternate style, where the enum class for each enumeration goes inside the class for the interface the enumeration is used in. Also made a rule that keeps the names short and not redundant with the class name they are nested in. * Modules/fetch/FetchOptions.h: Moved all the enum class types into the struct. * Modules/fetch/FetchRequest.cpp: (WebCore::setReferrerPolicy): Updated. (WebCore::setMode): Ditto. (WebCore::setCredentials): Ditto. (WebCore::setCache): Ditto. (WebCore::setRedirect): Ditto. (WebCore::buildOptions): Ditto. (WebCore::buildHeaders): Ditto. (WebCore::FetchRequest::create): Ditto. * Modules/fetch/FetchRequest.h: Used "using" to repeat the types from FetchOptions here in FetchRequest. That way the generated bindings can find the types, and we don't need to do any trick like [ImplementedAs] in thd IDL to make it work. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::error): Updated. (WebCore::FetchResponse::redirect): Ditto. (WebCore::FetchResponse::FetchResponse): Ditto. (WebCore::FetchResponse::startFetching): Ditto. * Modules/fetch/FetchResponse.h: Moved enum class into the class. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::externalDeviceType): Updated. * Modules/mediacontrols/MediaControlsHost.h: Moved enum classs into the class. * Modules/mediasession/MediaSession.cpp: (WebCore::MediaSession::MediaSession): Updated. * Modules/mediasession/MediaSession.h: Moved enum classs into the class. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::addSourceBuffer): Updated. (WebCore::MediaSource::removeSourceBuffer): Ditto. * Modules/mediasource/MediaSource.h: Moved enum class into the class. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Updated. (WebCore::SourceBuffer::appendError): Ditto. (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto. (WebCore::SourceBuffer::textTrackModeChanged): Ditto. * Modules/mediasource/SourceBuffer.h: Removed incorrect forward declaration of EndOfStreamError that also now seems to be unneeded. Moved enum class into the class. * Modules/mediastream/MediaDeviceInfo.cpp: (WebCore::MediaDeviceInfo::MediaDeviceInfo): Updated. (WebCore::MediaDeviceInfo::create): Ditto. * Modules/mediastream/MediaDeviceInfo.h: Moved enum class into the class. * Modules/mediastream/MediaDevicesRequest.cpp: (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Updated. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::readyState): Updated. * Modules/mediastream/MediaStreamTrack.h: Moved enum class into the class. * Modules/mediastream/RTCConfiguration.h: Moved enum classes into the class. * Modules/webaudio/AudioContext.h: Moved enum class into the class. * Modules/webaudio/WaveShaperNode.cpp: (WebCore::processorType): Updated. (WebCore::WaveShaperNode::oversample): Ditto. * Modules/webaudio/WaveShaperNode.h: Moved enum class into the class. * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::response): Updated. * bindings/scripts/CodeGeneratorJS.pm: (GenerateGetOwnPropertySlotBody): Removed unneeded $interfaceName argument. (GetAttributeGetterName): Ditto. (GetAttributeSetterName): Ditto. (GetFunctionName): Tweaked style. (AttributeShouldBeOnInstanceForCompatibility): Deleted. Was a function that always returned 0. (AttributeShouldBeOnInstance): Removed the call to the function above. (IsClassNameWordBoundary): Added. Helper for function below. (IsPrefixRemovable): Ditto. (GetEnumerationClassName): Added an $interface argument and changed this so it creates a nested name inside the class rather than a top level name for use at the WebCore namespace level. (GetEnumerationClassIdentifier): Added. Calls GetEnumerationClassName and makes a flattened name without "::" that can be used in an identifier. (GenerateEnumerationImplementationContent): Renamed from GetXXX. Added an $interface argument, so it can pass that along to the functions above. (GenerateHeader): Updated to not pass $interfaceName. (GeneratePropertiesHashTable): Ditto. (GenerateOverloadedFunction): Removed unneeded $interfaceName argument. (GenerateImplementation): Updated for changes above. Tweaked formatting. (GenerateFunctionCastedThis): Removed unneeded $interfaceName argument. (GenerateParametersCheck): Ditto. Also streamlined implementation a bit and made the IsEnumType section call the new functions. (GenerateCallbackImplementation): Ditto. (JSValueToNative): Added an $interface argument and pass it along when dealing with enumerations. (GeneratePrototypeDeclaration): Removed unneeded $interfaceName argument. (GenerateConstructorDeclaration): Ditto. (GenerateConstructorDefinitions): Ditto. (GenerateConstructorDefinition): Ditto. (GenerateConstructorHelperMethods): Ditto. * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated. * bindings/scripts/test/TestObj.idl: Added some new enums that test some of the logic above. * crypto/CryptoKey.cpp: (WebCore::CryptoKey::CryptoKey): Updated. (WebCore::CryptoKey::usages): Ditto. * crypto/CryptoKey.h: Moved enum class types inside the CryptoKey class. Added comments about the two similar but distinct types named CryptoKeyUsage and CryptoKey::Usage. * css/FontFace.cpp: (WebCore::FontFace::status): Updated. * css/FontFace.h: Moved enum class into the class. * css/FontFaceSet.cpp: (WebCore::FontFaceSet::status): Updated. * css/FontFaceSet.h: Moved enum class into the class. * dom/Document.cpp: (WebCore::Document::Document): Updated for the name change back from ReferrerHeaderPolicy to ReferrerPolicy. (WebCore::Document::processReferrerPolicy): Ditto. (WebCore::Document::applyContentDispositionAttachmentSandbox): Ditto. * dom/Document.h: More of the same. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::loadInternal): Updated. (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto. (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto. (WebCore::HTMLMediaElement::textTrackAddCues): Ditto. (WebCore::HTMLMediaElement::textTrackAddCue): Ditto. (WebCore::HTMLMediaElement::addTextTrack): Ditto. (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto. (WebCore::HTMLMediaElement::setSelectedTextTrack): Ditto. (WebCore::HTMLMediaElement::configureTextTracks): Ditto. (WebCore::HTMLMediaElement::hasClosedCaptions): Ditto. (WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto. (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto. (WebCore::toPlatform): Ditto. (WebCore::HTMLMediaElement::outOfBandTrackSources): Ditto. * html/HTMLTrackElement.cpp: (WebCore::HTMLTrackElement::scheduleLoad): Ditto. * html/HTMLVideoElement.h: Moved enum class into class. * html/HTMLVideoElement.idl: Added the missing conditional on VideoPresentationMode, and also moved it to the bottom of the file to work around what is apparently a bug in the IDL parser. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::toWindRule): Updated. (WebCore::CanvasRenderingContext2D::fill): Ditto. (WebCore::CanvasRenderingContext2D::clip): Ditto. (WebCore::CanvasRenderingContext2D::fillInternal): Ditto. (WebCore::CanvasRenderingContext2D::clipInternal): Ditto. (WebCore::CanvasRenderingContext2D::isPointInPath): Ditto. (WebCore::CanvasRenderingContext2D::isPointInPathInternal): Ditto. (WebCore::smoothingToInterpolationQuality): Ditto. * html/canvas/CanvasRenderingContext2D.h: Moved enum class types into the class. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Updated. (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto. * html/track/InbandTextTrack.cpp: (WebCore::InbandTextTrack::setMode): Updated. (WebCore::toPrivate): Ditto. (WebCore::InbandTextTrack::setModeInternal): Ditto. (WebCore::InbandTextTrack::updateKindFromPrivate): Ditto. * html/track/InbandTextTrack.h: Ditto. * html/track/TextTrack.cpp: (WebCore::TextTrack::TextTrack): Ditto. (WebCore::TextTrack::enabled): Ditto. (WebCore::TextTrack::kindKeyword): Ditto. (WebCore::TextTrack::setKind): Ditto. (WebCore::TextTrack::setKindKeywordIgnoringASCIICase): Ditto. (WebCore::TextTrack::setMode): Ditto. (WebCore::TextTrack::cues): Ditto. (WebCore::TextTrack::activeCues): Ditto. (WebCore::TextTrack::addCue): Ditto. (WebCore::TextTrack::regions): Ditto. (WebCore::TextTrack::isRendered): Ditto. (WebCore::TextTrack::isMainProgramContent): Ditto. (WebCore::TextTrack::containsOnlyForcedSubtitles): Ditto. * html/track/TextTrack.h: Moved enum class types into the class. * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::dispatchEvent): Updated. (WebCore::TextTrackCue::isActive): Ditto. * loader/FrameNetworkingContext.h: Ditto. * page/CaptionUserPreferences.cpp: (WebCore::CaptionUserPreferences::sortedTrackListForMenu): Ditto. (WebCore::CaptionUserPreferences::textTrackSelectionScore): Ditto. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Ditto. (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Ditto. * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::generateReferrerHeader): Updated since we changed ReferrerHeaderPolicy back to ReferrerPolicy. * page/SecurityPolicy.h: Ditto. * platform/ReferrerPolicy.h: Changed ReferrerHeaderPolicy name back to ReferrerPolicy now that nesting inside a class eliminated the conflict; still should merge them and that FIXME remains. * platform/cocoa/WebPlaybackSessionModelMediaElement.mm: (WebPlaybackSessionModelMediaElement::updateForEventName): Updated. (WebPlaybackSessionModelMediaElement::updateLegibleOptions): Ditto. * testing/Internals.cpp: (WebCore::toResourceRequestCachePolicy): Updated. (WebCore::Internals::setOverrideCachePolicy): Ditto. (WebCore::toResourceLoadPriority): Ditto. (WebCore::Internals::setOverrideResourceLoadPriority): Ditto. (WebCore::toAutoFillButtonType): Ditto. (WebCore::Internals::setShowAutoFillButton): Ditto. * testing/Internals.h: Moved enum class types into class. * testing/Internals.idl: Removed the "Internals" prefixes we added to resolve ambiguity before. Nesting these in the class now takes care of the ambiguity instead. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseText): Updated. (WebCore::XMLHttpRequest::didCacheResponseJSON): Ditto. (WebCore::XMLHttpRequest::responseXML): Ditto. (WebCore::XMLHttpRequest::responseBlob): Ditto. (WebCore::XMLHttpRequest::responseArrayBuffer): Ditto. (WebCore::XMLHttpRequest::setResponseType): Ditto. (WebCore::XMLHttpRequest::open): Ditto. (WebCore::shouldDecodeResponse): Ditto. * xml/XMLHttpRequest.h: Moved the enum class into the class. Source/WebKit2: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResource): Updated since we changed ReferrerHeaderPolicy back to ReferrerPolicy. (WebKit::WebLoaderStrategy::schedulePluginStreamLoad): Ditto. Canonical link: https://commits.webkit.org/175397@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-03 05:47:34 +00:00
[WebIDL] Split-up and cleanup Fetch IDL files in preparation for removing unnecessary js builtins https://bugs.webkit.org/show_bug.cgi?id=174915 Patch by Sam Weinig <sam@webkit.org> on 2017-07-28 Reviewed by Alex Christensen. - Split FetchRequest enums and Init dictionary out of FetchRequest so they can be used from other files like WorkerGlobalScopeFetch and DOMWindowFetch. - Add missing FetchResponseInit. Currently unused but will be in a subsequent patch. - Add and update comments about missing properties and functions. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * Modules/fetch/DOMWindowFetch.idl: * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchHeaders.h: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchReferrerPolicy.h: Added. * Modules/fetch/FetchReferrerPolicy.idl: Added. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestCache.h: Added. * Modules/fetch/FetchRequestCache.idl: Added. * Modules/fetch/FetchRequestCredentials.h: Added. * Modules/fetch/FetchRequestCredentials.idl: Added. * Modules/fetch/FetchRequestInit.h: Added. * Modules/fetch/FetchRequestInit.idl: Added. * Modules/fetch/FetchRequestMode.h: Added. * Modules/fetch/FetchRequestMode.idl: Added. * Modules/fetch/FetchRequestRedirect.h: Added. * Modules/fetch/FetchRequestRedirect.idl: Added. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/WorkerGlobalScopeFetch.idl: Canonical link: https://commits.webkit.org/191735@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-28 17:29:12 +00:00
struct Init {
unsigned short status { 200 };
String statusText;
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<FetchHeaders::Init> headers;
[WebIDL] Split-up and cleanup Fetch IDL files in preparation for removing unnecessary js builtins https://bugs.webkit.org/show_bug.cgi?id=174915 Patch by Sam Weinig <sam@webkit.org> on 2017-07-28 Reviewed by Alex Christensen. - Split FetchRequest enums and Init dictionary out of FetchRequest so they can be used from other files like WorkerGlobalScopeFetch and DOMWindowFetch. - Add missing FetchResponseInit. Currently unused but will be in a subsequent patch. - Add and update comments about missing properties and functions. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * Modules/fetch/DOMWindowFetch.idl: * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchHeaders.h: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchReferrerPolicy.h: Added. * Modules/fetch/FetchReferrerPolicy.idl: Added. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestCache.h: Added. * Modules/fetch/FetchRequestCache.idl: Added. * Modules/fetch/FetchRequestCredentials.h: Added. * Modules/fetch/FetchRequestCredentials.idl: Added. * Modules/fetch/FetchRequestInit.h: Added. * Modules/fetch/FetchRequestInit.idl: Added. * Modules/fetch/FetchRequestMode.h: Added. * Modules/fetch/FetchRequestMode.idl: Added. * Modules/fetch/FetchRequestRedirect.h: Added. * Modules/fetch/FetchRequestRedirect.idl: Added. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/WorkerGlobalScopeFetch.idl: Canonical link: https://commits.webkit.org/191735@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-28 17:29:12 +00:00
};
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
WEBCORE_EXPORT static Ref<FetchResponse> create(ScriptExecutionContext&, std::optional<FetchBody>&&, FetchHeaders::Guard, ResourceResponse&&);
Replace JS builtin implementation of the FetchResponse constructor with a C++ one https://bugs.webkit.org/show_bug.cgi?id=176627 Patch by Sam Weinig <sam@webkit.org> on 2017-09-08 Reviewed by Alex Christensen. Removes the last of the Fetch related JS builtin code. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * Modules/fetch/FetchInternals.js: Removed. * Modules/fetch/FetchResponse.js: Removed. Remove FetchInternals.js and FetchResponse.js. * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchBodyConsumer.h: Remove no longer correct FIXMEs. * Modules/fetch/FetchBodySource.cpp: Add missing newline between functions. * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchResponse.idl: Remove builtin related operations and extended attributes. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::fastHas const): * Modules/fetch/FetchHeaders.cpp: Added fastHas to allow checking for a header using a HTTPHeaderName. Remove now unused filter function. * Modules/fetch/FetchResponse.cpp: (WebCore::isNullBodyStatus): Added helper predicate for 'null body status' concept. (WebCore::FetchResponse::create): Add spec defined constructor implementation. (WebCore::FetchResponse::setBodyData): Reformatted to match more common WTF::switchOn style. (WebCore::FetchResponse::setStatus): Deleted. (WebCore::FetchResponse::initializeWith): Deleted. Removed now unused functions. * Modules/fetch/FetchResponse.h: (WebCore::FetchResponse::create): Move inline create out of the class definition to make things a bit less crowded. Canonical link: https://commits.webkit.org/193159@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-09 03:32:59 +00:00
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
static ExceptionOr<Ref<FetchResponse>> create(ScriptExecutionContext&, std::optional<FetchBody::Init>&&, Init&&);
[CallWith=ScriptExecutionContext] should pass ScriptExecutionContext to the implementation by reference https://bugs.webkit.org/show_bug.cgi?id=155297 Reviewed by Darin Adler. Changing the binding generator to pass ScriptExecutionContext by reference. Updating DOM classes accordingly. Covered by existing tests. * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::create): (WebCore::MediaKeySession::MediaKeySession): * Modules/encryptedmedia/MediaKeySession.h: * Modules/encryptedmedia/MediaKeys.cpp: (WebCore::MediaKeys::createSession): * Modules/encryptedmedia/MediaKeys.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::clone): * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBCursor.h: (WebCore::IDBCursor::continueFunction): * Modules/indexeddb/IDBFactory.h: * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBKeyRange.cpp: (WebCore::IDBKeyRange::lowerValue): (WebCore::IDBKeyRange::upperValue): (WebCore::IDBKeyRange::only): (WebCore::IDBKeyRange::lowerBound): (WebCore::IDBKeyRange::upperBound): (WebCore::IDBKeyRange::bound): * Modules/indexeddb/IDBKeyRange.h: (WebCore::IDBKeyRange::lowerBound): (WebCore::IDBKeyRange::upperBound): (WebCore::IDBKeyRange::bound): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBOpenDBRequest.cpp: (WebCore::IDBOpenDBRequest::IDBOpenDBRequest): * Modules/indexeddb/IDBOpenDBRequest.h: * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::IDBRequest): * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/client/IDBCursorImpl.cpp: (WebCore::IDBClient::IDBCursor::continueFunction): (WebCore::IDBClient::IDBCursor::deleteFunction): * Modules/indexeddb/client/IDBCursorImpl.h: * Modules/indexeddb/client/IDBFactoryImpl.cpp: (WebCore::IDBClient::shouldThrowSecurityException): (WebCore::IDBClient::IDBFactory::getDatabaseNames): (WebCore::IDBClient::IDBFactory::open): (WebCore::IDBClient::IDBFactory::openInternal): (WebCore::IDBClient::IDBFactory::deleteDatabase): (WebCore::IDBClient::IDBFactory::cmp): * Modules/indexeddb/client/IDBFactoryImpl.h: * Modules/indexeddb/client/IDBIndexImpl.cpp: (WebCore::IDBClient::IDBIndex::IDBIndex): (WebCore::IDBClient::IDBIndex::openCursor): (WebCore::IDBClient::IDBIndex::count): (WebCore::IDBClient::IDBIndex::openKeyCursor): (WebCore::IDBClient::IDBIndex::get): (WebCore::IDBClient::IDBIndex::getKey): * Modules/indexeddb/client/IDBIndexImpl.h: * Modules/indexeddb/client/IDBObjectStoreImpl.cpp: (WebCore::IDBClient::IDBObjectStore::create): (WebCore::IDBClient::IDBObjectStore::IDBObjectStore): (WebCore::IDBClient::IDBObjectStore::openCursor): (WebCore::IDBClient::IDBObjectStore::get): (WebCore::IDBClient::IDBObjectStore::deleteFunction): (WebCore::IDBClient::IDBObjectStore::doDelete): (WebCore::IDBClient::IDBObjectStore::modernDelete): (WebCore::IDBClient::IDBObjectStore::clear): (WebCore::IDBClient::IDBObjectStore::createIndex): (WebCore::IDBClient::IDBObjectStore::index): (WebCore::IDBClient::IDBObjectStore::count): * Modules/indexeddb/client/IDBObjectStoreImpl.h: * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: (WebCore::IDBClient::IDBOpenDBRequest::createDeleteRequest): (WebCore::IDBClient::IDBOpenDBRequest::createOpenRequest): (WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest): * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: * Modules/indexeddb/client/IDBRequestImpl.cpp: (WebCore::IDBClient::IDBRequest::IDBRequest): * Modules/indexeddb/client/IDBRequestImpl.h: * Modules/indexeddb/client/IDBTransactionImpl.cpp: (WebCore::IDBClient::IDBTransaction::objectStore): (WebCore::IDBClient::IDBTransaction::createObjectStore): (WebCore::IDBClient::IDBTransaction::createIndex): * Modules/mediasource/DOMURLMediaSource.cpp: (WebCore::DOMURLMediaSource::createObjectURL): * Modules/mediasource/DOMURLMediaSource.h: * Modules/mediastream/DOMURLMediaStream.cpp: (WebCore::DOMURLMediaStream::createObjectURL): * Modules/mediastream/DOMURLMediaStream.h: * Modules/mediastream/HTMLMediaElementMediaStream.cpp: (WebCore::HTMLMediaElementMediaStream::setSrcObject): * Modules/mediastream/HTMLMediaElementMediaStream.h: * Modules/mediastream/HTMLMediaElementMediaStream.idl: * Modules/notifications/Notification.cpp: (WebCore::Notification::Notification): (WebCore::Notification::create): (WebCore::Notification::permission): (WebCore::Notification::requestPermission): * Modules/notifications/Notification.h: * Modules/notifications/NotificationCenter.cpp: (WebCore::NotificationCenter::createNotification): * Modules/notifications/NotificationClient.h: * Modules/quota/StorageInfo.cpp: (WebCore::StorageInfo::queryUsageAndQuota): (WebCore::StorageInfo::requestQuota): * Modules/quota/StorageInfo.h: * Modules/quota/StorageQuota.h: * bindings/js/JSIDBObjectStoreCustom.cpp: (WebCore::JSIDBObjectStore::createIndex): * bindings/scripts/CodeGeneratorJS.pm: (GenerateCallWith): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjWithScriptExecutionContextAttribute): (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises): (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute): (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises): (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute): (WebCore::setJSTestObjWithScriptExecutionContextAttribute): (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises): (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute): (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises): (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException): (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces): * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::readAsArrayBuffer): (WebCore::FileReaderSync::readAsBinaryString): (WebCore::FileReaderSync::readAsText): (WebCore::FileReaderSync::readAsDataURL): (WebCore::FileReaderSync::startLoading): * fileapi/FileReaderSync.h: (WebCore::FileReaderSync::readAsText): * html/DOMURL.cpp: (WebCore::DOMURL::createObjectURL): (WebCore::DOMURL::createPublicURL): (WebCore::DOMURL::revokeObjectURL): * html/DOMURL.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setSrcObject): * html/HTMLMediaElement.h: * inspector/InspectorIndexedDBAgent.cpp: (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): * page/DOMWindow.h: * page/History.h: (WebCore::History::back): (WebCore::History::forward): (WebCore::History::go): Canonical link: https://commits.webkit.org/173469@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-11 09:44:53 +00:00
static Ref<FetchResponse> error(ScriptExecutionContext&);
Move Fetch from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163195 Reviewed by Chris Dumez. * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): Use ExceptionOr. (WebCore::FetchHeaders::append): Ditto. (WebCore::FetchHeaders::remove): Ditto. (WebCore::FetchHeaders::get): Ditto. (WebCore::FetchHeaders::has): Ditto. (WebCore::FetchHeaders::set): Ditto. (WebCore::FetchHeaders::filterAndFill): Ditto. (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to clear out m_keys after the last call to next, since it will be deleted as soon as the iterator is deleted. * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): Use ExceptionOr. (WebCore::FetchRequest::clone): Ditto. * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::redirect): Use ExceptionOr. (WebCore::FetchResponse::setStatus): Ditto. * Modules/fetch/FetchResponse.h: Use ExceptionOr. * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions. * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString. * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValue): Call toJSNullableString and toJSString for functions that return ExceptionOr<String>. Canonical link: https://commits.webkit.org/181085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-11 02:21:58 +00:00
static ExceptionOr<Ref<FetchResponse>> redirect(ScriptExecutionContext&, const String& url, int status);
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
using NotificationCallback = WTF::Function<void(ExceptionOr<FetchResponse&>&&)>;
static void fetch(ScriptExecutionContext&, FetchRequest&, NotificationCallback&&);
[Fetch API] Add a JS builtin to implement https://fetch.spec.whatwg.org/#concept-headers-fill https://bugs.webkit.org/show_bug.cgi?id=159932 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-19 Reviewed by Alex Christensen. Covered by existing tests. Refactoring Headers initializeWith to use the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill. Refactoring Response constructor to put more checks in the JS builtin fucntion called within constructor. Making use of the new built-in internal that implements https://fetch.spec.whatwg.org/#concept-headers-fill. * CMakeLists.txt: Adding FetchHeadersInternals.js * DerivedSources.make: Ditto. * Modules/fetch/FetchHeaders.js: (initializeFetchHeaders): Using fillFetchHeaders new built-in internal. * Modules/fetch/FetchInternals.js: Added. (fillFetchHeaders): * Modules/fetch/FetchResponse.cpp: Refactoring to do more in the JS built-in. Splitting of initializeWith so that the checks are done in the order defined by the spec. (WebCore::FetchResponse::setStatus): (WebCore::FetchResponse::initializeWith): (WebCore::isNullBodyStatus): Deleted. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponse.js: (initializeFetchResponse): New built-in internal. * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/178124@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-20 06:23:13 +00:00
[Fetch API] Response constructor should be able to take a ReadableStream as body https://bugs.webkit.org/show_bug.cgi?id=159804 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-26 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: * web-platform-tests/fetch/api/response/response-consume-expected.txt: * web-platform-tests/fetch/api/response/response-consume.html: Updating test to exercice Response coonstructor with a ReadableStream. Source/WebCore: Covered by existing and updated tests. Introduced FetchBodyConsumer to encapsulate the code responsible to adapt FetchBody internal data to the requests made by user scripts. This refactoring eases the handling of internal data coming from ReadableStream. FetchLoader is now delegating conversion from the data to its m_consumer field. If m_consumer is null, FetchLoader calls FetchLoaderClient::didReceiveData (streaming reception mode). Clients of FetchLoader needs to pass a FetchBodyConsumer to the FetchLoader to do the data adaptation at loader creation time. Added support for body data passed as a ReadableStream to Response. This requires to set @body internal slot of the Response object in the constructor initialization JS built-in. To actually use that data, Body accessors are also implemented as JS built-in for Response. Since there is no need to do so for Request, FetchResponse is no longer marked as implementing FetchBody but all FetchBody IDL description is inlined in FetchResponse.idl. For each body accessor (arrayBuffer, blob, json, text), the corresponding JS built-in checks whether @body internal slot is set. If that is not the case, regular handling is done through a new private method called @consume. If @body internal slot is set, chunks are pumped from the ReadableStream using ReadableStream internal built-ins functions. Data handling is done in C++ through the private methods @startConsumingStream, @consumeChunk and @finishConsumingStream. To support cloning of Response with bodies, clone method is also implemented as a JS built-in. Main clone is done through @cloneFoJS private method implemented in C++. JS built-in clone code does the teeing of the ReadableStream using ReadableStream JS built-in internal functions. Introducing a new ReadableStream type for FetchBody to cope with body being stored in a ReadableStream. Introducing a new Loaded type for FetchBody to cope with body being stored in the FetchBodyConsumer owned by FetchBody. This allows removing the conversion of data to JSC::ArrayBuffer which was done by defaut at the end of Fetch loading if user script did not request data before. At the end of a load, the data remains in FetchBodyConsumer and the body is marked as Loaded. If the user wants to get the data after data finished being loaded, FetchBodyConsumer will do the required conversions. Introducing DeferredWrapper::resolveWithNewValue to handle the case of resolving promises with new objects. This allows directly using toJSNewlyCreated instead of toJS. * CMakeLists.txt: Adding FetchBodyConsumer.cpp. Removing WebCoreJSBuiltins.cpp from CMake list as it is not needed. * Modules/fetch/FetchBody.cpp: Moving data adaptation code to FetchBodyConsumer. (WebCore::FetchBody::extract): (WebCore::FetchBody::arrayBuffer): (WebCore::FetchBody::blob): Setting contentType in FetchBodyConsumer to handle proper creation of blob. (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consume): Refactoring and added case of Loaded bodies. (WebCore::FetchBody::consumeAsStream): Ditto. (WebCore::FetchBody::consumeArrayBuffer): (WebCore::FetchBody::consumeText): (WebCore::FetchBody::consumeBlob): (WebCore::FetchBody::loadingFailed): (WebCore::FetchBody::loadingSucceeded): (WebCore::FetchBody::loadingType): Deleted. (WebCore::blobFromArrayBuffer): Deleted. (WebCore::FetchBody::fulfillTextPromise): Deleted. (WebCore::FetchBody::loadedAsArrayBuffer): Deleted. (WebCore::FetchBody::loadedAsText): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::consumer): * Modules/fetch/FetchBodyConsumer.cpp: Added, responsible of data adaptation. (WebCore::blobFromData): (WebCore::FetchBodyConsumer::resolveWithData): (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::append): (WebCore::FetchBodyConsumer::takeData): (WebCore::FetchBodyConsumer::takeAsArrayBuffer): (WebCore::FetchBodyConsumer::takeAsBlob): (WebCore::FetchBodyConsumer::takeAsText): * Modules/fetch/FetchBodyConsumer.h: Added. (WebCore::FetchBodyConsumer::FetchBodyConsumer): (WebCore::FetchBodyConsumer::setContentType): (WebCore::FetchBodyConsumer::setType): (WebCore::FetchBodyConsumer::type): (WebCore::FetchBodyConsumer::clean): (WebCore::FetchBodyConsumer::hasData): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::loadedBlobAsText): Deleted. * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): Deleted. * Modules/fetch/FetchInternals.js: (consumeStream): Pump ReadableStream data and send it to FetchResponse to be converted according user need. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::FetchLoader): FetchLoader is simplified as it has two nodes: consumer mode in which case data is sent to the consumer and no-consumer mode in which case data is passed to loader client. The second mode is used to conveyy data to ReadableStream source. (WebCore::FetchLoader::stop): (WebCore::FetchLoader::startStreaming): (WebCore::FetchLoader::didReceiveData): (WebCore::FetchLoader::didFinishLoading): Deleted. * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchLoaderClient.h: (WebCore::FetchLoaderClient::didFinishLoadingAsText): Deleted. (WebCore::FetchLoaderClient::didFinishLoadingAsArrayBuffer): Deleted. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::cloneForJS): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::start): (WebCore::FetchResponse::consume): Introduced to consume data stored in body and not in ReadableStream. (WebCore::FetchResponse::startConsumingStream): Introduced to start process of consuming data stored in the ReadableStream. (WebCore::FetchResponse::consumeChunk): Reception of ReadableStream data. (WebCore::FetchResponse::finishConsumingStream): Doing the final conversion. (WebCore::FetchResponse::clone): Deleted. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Deleted. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: Inlining of FetchBody methods/attributes and adding private methods. * Modules/fetch/FetchResponse.js: (initializeFetchResponse): (clone): (arrayBuffer): (blob): (formData): (json): (text): * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMPromise.h: (WebCore::DeferredWrapper::resolveWithNewValue): * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/178396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-27 06:38:15 +00:00
void startConsumingStream(unsigned);
void consumeChunk(Ref<JSC::Uint8Array>&&);
Improve DeferredWrapper code https://bugs.webkit.org/show_bug.cgi?id=161787 Patch by Youenn Fablet <youenn@apple.com> on 2016-09-22 Reviewed by Darin Adler. No change of behavior. Renaming DeferredWrapper to DeferredPromise. Adding create method that creates the underlying JSC::JSPromiseDeferred in non-worker environments. Updated create method to take references. Introducing domWindow helper accessor into JSDOMObject to ease creation of promise in non-worker environments. Doing some minor clean up (renaming of m_wrapper to m_promiseDeferred, accessor change). * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): * Modules/applepay/ApplePaySession.h: * Modules/fetch/DOMWindowFetch.cpp: (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: Updated to take a DeferredPromise to make it consistent with WorkerGlobalScopeFetch. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::arrayBuffer): (WebCore::FetchBody::blob): (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): (WebCore::FetchBody::consumeArrayBufferView): (WebCore::FetchBody::consumeText): (WebCore::FetchBody::consumeBlob): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::formData): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolveWithData): (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consume): (WebCore::FetchResponse::finishConsumingStream): * Modules/fetch/FetchResponse.h: * Modules/fetch/WorkerGlobalScopeFetch.cpp: (WebCore::WorkerGlobalScopeFetch::fetch): * Modules/fetch/WorkerGlobalScopeFetch.h: * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::whenDefinedPromise): (WebCore::JSCustomElementRegistry::whenDefined): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::visitChildren): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMPromise.cpp: (WebCore::DOMDeferredPromise::DOMDeferredPromise): (WebCore::DOMDeferredPromise::~DOMDeferredPromise): (WebCore::DOMDeferredPromise::clear): (WebCore::DOMDeferredPromise::contextDestroyed): (WebCore::DOMDeferredPromise::promise): (WebCore::DOMDeferredPromise::callFunction): (WebCore::DOMDeferredPromise::reject): (WebCore::rejectPromiseWithExceptionIfAny): (WebCore::fulfillPromiseWithJSON): (WebCore::fulfillPromiseWithArrayBuffer): (WebCore::DeferredWrapper::DeferredWrapper): Deleted. (WebCore::DeferredWrapper::~DeferredWrapper): Deleted. (WebCore::DeferredWrapper::clear): Deleted. (WebCore::DeferredWrapper::contextDestroyed): Deleted. (WebCore::DeferredWrapper::promise): Deleted. (WebCore::DeferredWrapper::callFunction): Deleted. (WebCore::DeferredWrapper::reject): Deleted. * bindings/js/JSDOMPromise.h: (WebCore::DOMDeferredPromise::create): (WebCore::callPromiseFunction): (WebCore::DOMPromise::DOMPromise): (WebCore::DOMPromise::deferredPromise): (WebCore::DOMDeferredPromise::resolveWithValue): (WebCore::DOMDeferredPromise::resolveWithNewlyCreated): (WebCore::DOMDeferredPromise::rejectWithValue): (WebCore::DOMDeferredPromise::resolve): (WebCore::DOMDeferredPromise::reject): (WebCore::DeferredWrapper::create): Deleted. (WebCore::DOMPromise::deferredWrapper): Deleted. (WebCore::DeferredWrapper::resolveWithValue): Deleted. (WebCore::DeferredWrapper::resolveWithNewlyCreated): Deleted. (WebCore::DeferredWrapper::rejectWithValue): Deleted. (WebCore::DeferredWrapper::resolve): Deleted. (WebCore::DeferredWrapper::reject): Deleted. * bindings/js/JSDOMWrapper.cpp: Introducing domWindow() accessor. * bindings/js/JSDOMWrapper.h: * bindings/js/JSFontFaceCustom.cpp: (WebCore::JSFontFace::loaded): * bindings/js/JSFontFaceSetCustom.cpp: (WebCore::JSFontFaceSet::ready): * bindings/js/JSMediaDevicesCustom.cpp: (WebCore::JSMediaDevices::getUserMedia): * bindings/js/JSMediaStreamTrackCustom.cpp: (WebCore::JSMediaStreamTrack::applyConstraints): * bindings/js/JSReadableStreamSourceCustom.cpp: (WebCore::JSReadableStreamSource::start): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::encrypt): (WebCore::JSWebKitSubtleCrypto::decrypt): (WebCore::JSWebKitSubtleCrypto::sign): (WebCore::JSWebKitSubtleCrypto::verify): (WebCore::JSWebKitSubtleCrypto::digest): (WebCore::JSWebKitSubtleCrypto::generateKey): (WebCore::JSWebKitSubtleCrypto::importKey): (WebCore::JSWebKitSubtleCrypto::exportKey): (WebCore::JSWebKitSubtleCrypto::wrapKey): (WebCore::JSWebKitSubtleCrypto::unwrapKey): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateReturnParameters): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise): (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise): * dom/CustomElementRegistry.h: (WebCore::CustomElementRegistry::promiseMap): Canonical link: https://commits.webkit.org/180396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-22 07:35:46 +00:00
void finishConsumingStream(Ref<DeferredPromise>&&);
[Fetch API] Response constructor should be able to take a ReadableStream as body https://bugs.webkit.org/show_bug.cgi?id=159804 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-26 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: * web-platform-tests/fetch/api/response/response-consume-expected.txt: * web-platform-tests/fetch/api/response/response-consume.html: Updating test to exercice Response coonstructor with a ReadableStream. Source/WebCore: Covered by existing and updated tests. Introduced FetchBodyConsumer to encapsulate the code responsible to adapt FetchBody internal data to the requests made by user scripts. This refactoring eases the handling of internal data coming from ReadableStream. FetchLoader is now delegating conversion from the data to its m_consumer field. If m_consumer is null, FetchLoader calls FetchLoaderClient::didReceiveData (streaming reception mode). Clients of FetchLoader needs to pass a FetchBodyConsumer to the FetchLoader to do the data adaptation at loader creation time. Added support for body data passed as a ReadableStream to Response. This requires to set @body internal slot of the Response object in the constructor initialization JS built-in. To actually use that data, Body accessors are also implemented as JS built-in for Response. Since there is no need to do so for Request, FetchResponse is no longer marked as implementing FetchBody but all FetchBody IDL description is inlined in FetchResponse.idl. For each body accessor (arrayBuffer, blob, json, text), the corresponding JS built-in checks whether @body internal slot is set. If that is not the case, regular handling is done through a new private method called @consume. If @body internal slot is set, chunks are pumped from the ReadableStream using ReadableStream internal built-ins functions. Data handling is done in C++ through the private methods @startConsumingStream, @consumeChunk and @finishConsumingStream. To support cloning of Response with bodies, clone method is also implemented as a JS built-in. Main clone is done through @cloneFoJS private method implemented in C++. JS built-in clone code does the teeing of the ReadableStream using ReadableStream JS built-in internal functions. Introducing a new ReadableStream type for FetchBody to cope with body being stored in a ReadableStream. Introducing a new Loaded type for FetchBody to cope with body being stored in the FetchBodyConsumer owned by FetchBody. This allows removing the conversion of data to JSC::ArrayBuffer which was done by defaut at the end of Fetch loading if user script did not request data before. At the end of a load, the data remains in FetchBodyConsumer and the body is marked as Loaded. If the user wants to get the data after data finished being loaded, FetchBodyConsumer will do the required conversions. Introducing DeferredWrapper::resolveWithNewValue to handle the case of resolving promises with new objects. This allows directly using toJSNewlyCreated instead of toJS. * CMakeLists.txt: Adding FetchBodyConsumer.cpp. Removing WebCoreJSBuiltins.cpp from CMake list as it is not needed. * Modules/fetch/FetchBody.cpp: Moving data adaptation code to FetchBodyConsumer. (WebCore::FetchBody::extract): (WebCore::FetchBody::arrayBuffer): (WebCore::FetchBody::blob): Setting contentType in FetchBodyConsumer to handle proper creation of blob. (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consume): Refactoring and added case of Loaded bodies. (WebCore::FetchBody::consumeAsStream): Ditto. (WebCore::FetchBody::consumeArrayBuffer): (WebCore::FetchBody::consumeText): (WebCore::FetchBody::consumeBlob): (WebCore::FetchBody::loadingFailed): (WebCore::FetchBody::loadingSucceeded): (WebCore::FetchBody::loadingType): Deleted. (WebCore::blobFromArrayBuffer): Deleted. (WebCore::FetchBody::fulfillTextPromise): Deleted. (WebCore::FetchBody::loadedAsArrayBuffer): Deleted. (WebCore::FetchBody::loadedAsText): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::consumer): * Modules/fetch/FetchBodyConsumer.cpp: Added, responsible of data adaptation. (WebCore::blobFromData): (WebCore::FetchBodyConsumer::resolveWithData): (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::append): (WebCore::FetchBodyConsumer::takeData): (WebCore::FetchBodyConsumer::takeAsArrayBuffer): (WebCore::FetchBodyConsumer::takeAsBlob): (WebCore::FetchBodyConsumer::takeAsText): * Modules/fetch/FetchBodyConsumer.h: Added. (WebCore::FetchBodyConsumer::FetchBodyConsumer): (WebCore::FetchBodyConsumer::setContentType): (WebCore::FetchBodyConsumer::setType): (WebCore::FetchBodyConsumer::type): (WebCore::FetchBodyConsumer::clean): (WebCore::FetchBodyConsumer::hasData): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::loadedBlobAsText): Deleted. * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): Deleted. * Modules/fetch/FetchInternals.js: (consumeStream): Pump ReadableStream data and send it to FetchResponse to be converted according user need. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::FetchLoader): FetchLoader is simplified as it has two nodes: consumer mode in which case data is sent to the consumer and no-consumer mode in which case data is passed to loader client. The second mode is used to conveyy data to ReadableStream source. (WebCore::FetchLoader::stop): (WebCore::FetchLoader::startStreaming): (WebCore::FetchLoader::didReceiveData): (WebCore::FetchLoader::didFinishLoading): Deleted. * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchLoaderClient.h: (WebCore::FetchLoaderClient::didFinishLoadingAsText): Deleted. (WebCore::FetchLoaderClient::didFinishLoadingAsArrayBuffer): Deleted. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::cloneForJS): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::start): (WebCore::FetchResponse::consume): Introduced to consume data stored in body and not in ReadableStream. (WebCore::FetchResponse::startConsumingStream): Introduced to start process of consuming data stored in the ReadableStream. (WebCore::FetchResponse::consumeChunk): Reception of ReadableStream data. (WebCore::FetchResponse::finishConsumingStream): Doing the final conversion. (WebCore::FetchResponse::clone): Deleted. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Deleted. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: Inlining of FetchBody methods/attributes and adding private methods. * Modules/fetch/FetchResponse.js: (initializeFetchResponse): (clone): (arrayBuffer): (blob): (formData): (json): (text): * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMPromise.h: (WebCore::DeferredWrapper::resolveWithNewValue): * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/178396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-27 06:38:15 +00:00
FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker https://bugs.webkit.org/show_bug.cgi?id=179641 <rdar://problem/35923570> Patch by Youenn Fablet <youenn@apple.com> on 2017-12-08 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt: Source/WebCore: Covered by existing rebased tests. FetchResponse will now store an unfiltered response. If it needs to expose it to JavaScript, it will create a filtered response lazily. This allows service worker to send back to web pages, opaque responses containing every information. Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin. This ensures cross-origin checks to work if service worker returns such a response on a same origin URL. Updated SubresourceLoader to check cross origin service worker responses based on their tainting. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::url const): (WebCore::FetchResponse::filteredResponse const): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::resourceResponse const): * Modules/fetch/FetchResponse.h: (WebCore::FetchResponse::create): Deleted. * dom/Document.cpp: (WebCore::Document::initSecurityContext): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Source/WebKit: * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response. LayoutTests: * TestExpectations: Canonical link: https://commits.webkit.org/196518@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-08 22:41:48 +00:00
Type type() const { return filteredResponse().type(); }
[Fetch API] Request and Response url getter should use URL serialization https://bugs.webkit.org/show_bug.cgi?id=159705 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-14 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/basic/response-url-expected.txt: Added. * web-platform-tests/fetch/api/basic/response-url-worker-expected.txt: Added. * web-platform-tests/fetch/api/basic/response-url-worker.html: Added. * web-platform-tests/fetch/api/basic/response-url.html: Added. * web-platform-tests/fetch/api/basic/response-url.js: Added. (checkResponseURL): * web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt: * web-platform-tests/fetch/api/request/request-init-003.sub.html: Source/WebCore: Tests: fetch/fetch-url-serialization.html imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html imported/w3c/web-platform-tests/fetch/api/basic/response-url.html Implementing https://url.spec.whatwg.org/#concept-url-serializer and applying it to Request and Response getter. Adding a temporary routine to compute url cannot-be-a-base-url flag. The parsing routine should store that information in the URL itself. Added tests to cover serialization routine. Failing tests are mostly due to limitations of the URL parser. Tests do not check for URLs with username and password as Request constructor throws with such URLs. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::url): Adding request url serialization, fragment included. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::url): Adding response url serialization, fragment excluded. * Modules/fetch/FetchResponse.h: * platform/URL.cpp: (WebCore::cannotBeABaseURL): Temporary helper function to have a coarse evaluation of url cannot-be-a-base-url flag. (WebCore::URL::serialize): Implementation of https://url.spec.whatwg.org/#concept-url-serializer. * platform/URL.h: (WebCore::URL::hasUser): Helper getter. (WebCore::URL::hasPassword): Ditto. (WebCore::URL::hasQuery): Ditto. (WebCore::URL::hasFragment): Ditto. LayoutTests: * fetch/fetch-url-serialization-expected.txt: Added. * fetch/fetch-url-serialization.html: Added. * fetch/fetch-urls.json: Added. Canonical link: https://commits.webkit.org/177911@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-14 10:14:53 +00:00
const String& url() const;
FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker https://bugs.webkit.org/show_bug.cgi?id=179641 <rdar://problem/35923570> Patch by Youenn Fablet <youenn@apple.com> on 2017-12-08 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt: Source/WebCore: Covered by existing rebased tests. FetchResponse will now store an unfiltered response. If it needs to expose it to JavaScript, it will create a filtered response lazily. This allows service worker to send back to web pages, opaque responses containing every information. Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin. This ensures cross-origin checks to work if service worker returns such a response on a same origin URL. Updated SubresourceLoader to check cross origin service worker responses based on their tainting. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::url const): (WebCore::FetchResponse::filteredResponse const): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::resourceResponse const): * Modules/fetch/FetchResponse.h: (WebCore::FetchResponse::create): Deleted. * dom/Document.cpp: (WebCore::Document::initSecurityContext): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Source/WebKit: * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response. LayoutTests: * TestExpectations: Canonical link: https://commits.webkit.org/196518@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-08 22:41:48 +00:00
bool redirected() const { return filteredResponse().isRedirected(); }
int status() const { return filteredResponse().httpStatusCode(); }
bool ok() const { return filteredResponse().isSuccessful(); }
const String& statusText() const { return filteredResponse().httpStatusText(); }
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
[Cache API] Adding generic support for CacheStorage and Cache methods https://bugs.webkit.org/show_bug.cgi?id=175455 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-15 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt: Source/WebCore: Covered by existing tests. Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection. The CacheStorageProvider is accessed from the page for Document calls. The CacheStorageConnection is responsible to implement the read/write operations on the cache database. At the moment, it does nothing but return not implemented errors. Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on. CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache. The CacheStorageConnection is a generic connection and not tied to any document/context. CacheStorage objects are manipulated by providing to the connection the origin of the context. CacheStorage are global to all contexts with the same origin. Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object. Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation. * Modules/cache/Cache.cpp: (WebCore::Cache::Cache): (WebCore::Cache::~Cache): The CacheStorageConnection is a generic connection and not tied to any document/context. (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match. Redirect to matchAll as per spec. (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll. Checks for request as per spec. Then either refresh the request to response map and return all responses. Or call the query cache algorithm and return copies of the responses (using clone). (WebCore::Cache::put): Check the request and response as per spec. Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now. Call the batch put operation. (WebCore::Cache::remove): Check the request and response as per spec. Call the batch delete operation. (WebCore::Cache::keys): Refresh the request to response map and return corresponding requests. Making sure to reuse the same request objects as per spec. As per spec, the request to response map is ordered. We implement it as a Vector. (WebCore::Cache::refreshRequestToResponseMap): Use the cache storage connection to get an up-to-date list of cached records. (WebCore::Cache::queryCacheMatch): Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm. This is split for queryCache as cache storage engine will need to use it when implementing the delete operation. (WebCore::Cache::queryCache): Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument. (WebCore::Cache::queryCacheWithTargetStorage): Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument. (WebCore::Cache::batchDeleteOperation): Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation. Delete operation are always done one at a time. (WebCore::Cache::batchPutOperation): Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation. Put operation takes one record for put but can take several records in the case of addAll, hence the current design. (WebCore::Cache::updateRequestToResponseMap): Update the cache request to response map based on the records retrieved from the cache storage connection. * Modules/cache/Cache.h: (WebCore::Cache::create): (WebCore::Cache::name const): * Modules/cache/Cache.idl: * Modules/cache/CacheStorage.cpp: (WebCore::CacheStorage::origin const): Computing the cache origin that is passed to the CacheStorageConnection. (WebCore::CacheStorage::has): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has. Call the cache storage connection to refresh its cache map. Then use it to check whether a cache exists. (WebCore::CacheStorage::refreshCacheMap): Use the cache storage connection to get the list of existing caches. (WebCore::CacheStorage::open): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open. Refreshing the cache map so as to return a pre-existing cache if any. (WebCore::CacheStorage::remove): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method. Refreshing the cache map so as to do nothing if there is no cache to remove. (WebCore::CacheStorage::keys): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method. Refreshing the cache map and returnin its keys. As per spec, the cache map is ordered. We implement it as a Vector. (WebCore::CacheStorage::cacheMap): Get the list of cache objects, used as a private accessor for JS built-ins. * Modules/cache/CacheStorage.h: (WebCore::CacheStorage::create): (WebCore::CacheStorage::CacheStorage): * Modules/cache/CacheStorageConnection.cpp: Added. (WebCore::CacheStorageConnection::exceptionFromError): * Modules/cache/CacheStorageConnection.h: Added. Makes the link between Web facing Cache API and the cache storage engine. Envisioned implementation are: - One main thread connection used by all documents in the given process. - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards. (WebCore::CacheStorageConnection::create): (WebCore::CacheStorageConnection::open): (WebCore::CacheStorageConnection::remove): (WebCore::CacheStorageConnection::refreshCacheMap): (WebCore::CacheStorageConnection::refreshRequestToResponseMap): (WebCore::CacheStorageConnection::batchDeleteOperation): (WebCore::CacheStorageConnection::batchPutOperation): * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective. * Modules/cache/DOMWindowCaches.cpp: (WebCore::DOMWindowCaches::caches const): * Modules/cache/WorkerGlobalScopeCaches.cpp: (WebCore::WorkerGlobalScopeCaches::from): (WebCore::WorkerGlobalScopeCaches::caches const): * Modules/cache/WorkerGlobalScopeCaches.h: (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::create): Add another create as used by the cache API. (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchRequest.cpp: (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value. Add a check so that no value at all is the same as a null/undefined value. (WebCore::FetchRequest::resourceRequest const): * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.h: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::overlayPage): * page/CacheStorageProvider.h: Added. Interface to create main thread cache storage connection for the given page. There will be one provider for each process. Passing a sessionID so that we will create a connection per session. * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::cacheStorageProvider): * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged): Source/WebKit: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Cache/WebCacheStorageProvider.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::WebProcess): * WebProcess/WebProcess.h: (WebKit::WebProcess::cacheStorageProvider): Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::initWithFrame): LayoutTests: * TestExpectations: Skipping a test that would timeout otherwise due to the current implementation limitations. Canonical link: https://commits.webkit.org/192266@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-15 21:04:38 +00:00
const FetchHeaders& headers() const { return m_headers; }
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
FetchHeaders& headers() { return m_headers; }
Align FetchResponse and FetchRequest body handling https://bugs.webkit.org/show_bug.cgi?id=176539 Patch by Youenn Fablet <youenn@apple.com> on 2017-09-07 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/request/request-consume-empty-expected.txt: * web-platform-tests/fetch/api/request/request-consume-expected.txt: * web-platform-tests/fetch/api/request/request-idl-expected.txt: * web-platform-tests/fetch/api/request/request-structure-expected.txt: * web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: * web-platform-tests/fetch/api/response/response-consume-expected.txt: * web-platform-tests/url/urlencoded-parser-expected.txt: Source/WebCore: Covered by rebased tests. Removing most of FetchResponse JS Builtins now that ReadableStream has full support. Implementing FetchResponse body cloning through ReadableStream. Cloning a loading FetchResponse still requires to create a ReadableStream for the purpose of teeing. Moving exposure of the body from FetchResponse to FetchBodyOwner. This is controlled by a boolean flag set according response tainting. Moving handling of body ReadableStream consuming from FetchResponse to FetchBodyConsumer. For that purpose, a loading boolean flag is added to FetchBodyConsumer so that it will resolve consume promises when loading is finished. Added support for getting a body in case the request/response body is already consumed. In that case, a locked ReadableStream is returned. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::doMatch): (WebCore::DOMCache::matchAll): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::loadingFailed): (WebCore::FetchBodyConsumer::loadingSucceeded): * Modules/fetch/FetchBodyConsumer.h: (WebCore::FetchBodyConsumer::setAsLoading): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::readableStream): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::isBodyNullOrOpaque const): (WebCore::FetchBodyOwner::setBodyAsOpaque): (WebCore::FetchBodyOwner::isBodyOpaque const): * Modules/fetch/FetchInternals.js: (fillFetchHeaders): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::setBodyData): (WebCore::FetchResponse::consumeChunk): (WebCore::FetchResponse::consumeBodyAsStream): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponse.js: (initializeFetchResponse): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::create): (WebCore::ReadableStream::lock): * bindings/js/ReadableStream.h: * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/193125@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221772 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-07 23:23:57 +00:00
ExceptionOr<Ref<FetchResponse>> clone(ScriptExecutionContext&);
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
Add support for Request body stream cloning https://bugs.webkit.org/show_bug.cgi?id=176148 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-31 Reviewed by Alex Christensen. Source/WebCore: Tests: http/wpt/fetch/request-clone.html http/wpt/fetch/request-consume-stream.html http/wpt/fetch/request-stream-disturbed-1.html http/wpt/fetch/request-stream-disturbed-2.html http/wpt/fetch/request-stream-disturbed-3.html Adding support for ReadableStream teeing for cloning fetch bodies. Adding support for pushing request body data to its ReadableStream. Renamed FetchResponseSource to FetchBodySource for that purpose. Tests extracting body from a ReadableStream through JS API pass. Tests extracting data stored in a ReadableStream to resolve fetch body promises are failing. There is no support yet, this will be added as a follow-up. * CMakeLists.txt: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::clone): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::readableStream): (WebCore::FetchBodyOwner::consumeBodyAsStream): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::feedStream): (WebCore::FetchBodyOwner::cancel): * Modules/fetch/FetchBodySource.cpp: Renamed from Source/WebCore/Modules/fetch/FetchResponseSource.cpp. * Modules/fetch/FetchBodySource.h: Renamed from Source/WebCore/Modules/fetch/FetchResponseSource.h. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consumeBodyAsStream): (WebCore::FetchResponse::createReadableStream): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponse.js: (getter.body): (clone): * WebCore.xcodeproj/project.pbxproj: * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::tee): * bindings/js/ReadableStream.h: * bindings/js/WebCoreBuiltinNames.h: LayoutTests: * http/wpt/fetch/request-clone-expected.txt: Added. * http/wpt/fetch/request-clone.html: Added. * http/wpt/fetch/request-consume-stream-expected.txt: Added. * http/wpt/fetch/request-consume-stream.html: Added. * http/wpt/fetch/request-stream-disturbed-1-expected.txt: Added. * http/wpt/fetch/request-stream-disturbed-1.html: Added. * http/wpt/fetch/request-stream-disturbed-2-expected.txt: Added. * http/wpt/fetch/request-stream-disturbed-2.html: Added. * http/wpt/fetch/request-stream-disturbed-3-expected.txt: Added. * http/wpt/fetch/request-stream-disturbed-3.html: Added. Canonical link: https://commits.webkit.org/192839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-31 20:03:42 +00:00
void consumeBodyAsStream() final;
void feedStream() final;
void cancel() final;
Move Fetch from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163195 Reviewed by Chris Dumez. * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): Use ExceptionOr. (WebCore::FetchHeaders::append): Ditto. (WebCore::FetchHeaders::remove): Ditto. (WebCore::FetchHeaders::get): Ditto. (WebCore::FetchHeaders::has): Ditto. (WebCore::FetchHeaders::set): Ditto. (WebCore::FetchHeaders::filterAndFill): Ditto. (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to clear out m_keys after the last call to next, since it will be deleted as soon as the iterator is deleted. * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): Use ExceptionOr. (WebCore::FetchRequest::clone): Ditto. * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::redirect): Use ExceptionOr. (WebCore::FetchResponse::setStatus): Ditto. * Modules/fetch/FetchResponse.h: Use ExceptionOr. * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions. * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString. * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValue): Call toJSNullableString and toJSString for functions that return ExceptionOr<String>. Canonical link: https://commits.webkit.org/181085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-11 02:21:58 +00:00
[Cache API] Add response body storage https://bugs.webkit.org/show_bug.cgi?id=175658 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-18 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-put.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-put.https-expected.txt: Source/WebCore: Covered by rebased tests. Tests are still flaky until waiting for end of fetch load is implemented. Adding a response body within CacheStorageConnection::Record. Adding ability to pass this body from/to the main thread. Adding response body consumption into a CacheStorageConnection::Record. Adding response body setting from a CacheStorageConnection::Record. * Modules/beacon/NavigatorBeacon.cpp: (WebCore::NavigatorBeacon::sendBeacon): * Modules/cache/Cache.cpp: (WebCore::Cache::put): (WebCore::toConnectionRecord): (WebCore::Cache::updateRecords): * Modules/cache/CacheStorageConnection.cpp: (WebCore::CacheStorageConnection::copyResponseBody): (WebCore::CacheStorageConnection::isolatedResponseBody): (WebCore::CacheStorageConnection::Record::copy const): * Modules/cache/CacheStorageConnection.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::toCrossThreadRecordData): (WebCore::fromCrossThreadRecordData): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::bodyAsFormData const): (WebCore::FetchBody::take): (WebCore::FetchBody::bodyForInternalRequest const): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::setAsFormData): * Modules/fetch/FetchBodyConsumer.h: (WebCore::FetchBodyConsumer::setData): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::resourceRequest const): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::setBodyData): * Modules/fetch/FetchResponse.h: Source/WebKit: Added IPC serialization of Record response body. Updated CacheStorageEngine implementation as Record has no longer a copy constructor. * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorageEngine::retrieveRecords): (WebKit::CacheStorageEngine::deleteMatchingRecords): * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeSharedBuffer): (IPC::decodeSharedBuffer): (IPC::ArgumentCoder<CacheStorageConnection::Record>::encode): (IPC::ArgumentCoder<CacheStorageConnection::Record>::decode): Canonical link: https://commits.webkit.org/192389@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-18 19:32:48 +00:00
using ResponseData = Variant<std::nullptr_t, Ref<FormData>, Ref<SharedBuffer>>;
ResponseData consumeBody();
Add quota to cache API https://bugs.webkit.org/show_bug.cgi?id=177552 Patch by Youenn Fablet <youenn@apple.com> on 2017-10-09 Reviewed by Alex Christensen. Source/WebCore: Tests: http/wpt/cache-storage/cache-quota.any.html Storing padded opaque response body sizes within FetchResponse and CacheStorageConnection. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. Storing in CacheStorageConnection is needed for handling cloned network fetched created responses. Storing in FetchResponse is needed for handling cloned cache-storage created opaque responses. Adding internals to query and set the fuzzed size of a response. * Modules/cache/CacheStorageConnection.cpp: (WebCore::computeRealBodySize): (WebCore::CacheStorageConnection::computeRecordBodySize): (WebCore::CacheStorageConnection::setResponseBodySizeWithPadding): (WebCore::CacheStorageConnection::responseBodySizeWithPadding const): * Modules/cache/CacheStorageConnection.h: * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::toConnectionRecord): (WebCore::DOMCache::updateRecords): * Modules/cache/DOMCache.h: * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): (WebCore::DOMCacheEngine::Record::copy const): * Modules/cache/DOMCacheEngine.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::toCrossThreadRecordData): (WebCore::fromCrossThreadRecordData): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * testing/Internals.cpp: (WebCore::Internals::setResponseSizeWithPadding): (WebCore::Internals::responseSizeWithPadding const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Adding support for quota checking in CacheStorage::Caches. It is passed to NetworkProcess at creation time. Default quota size is configured to 400Ko by origin per default. This value is suitable for testing. Future patch should raise this default value and allows configuring it. Quota is computed based on the response body size. This size is padded at WebCore for opaque responses. Size is stored persistently as opaque response padded size should remain stable. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. In case of putting several records at the same time, the size of all records is computed so that all records will be written or rejected together. Sending QuotaExceeded error when quota is exceeded. Future effort should allow asking UIProcess for quota extension. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::cacheStoragePerOriginQuota const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::readCachesFromDisk): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::toRecordInformation): (WebKit::CacheStorage::isolatedCopy): (WebKit::CacheStorage::Cache::open): (WebKit::CacheStorage::Cache::storeRecords): (WebKit::CacheStorage::Cache::put): (WebKit::CacheStorage::Cache::writeRecordToDisk): (WebKit::CacheStorage::Cache::updateRecordToDisk): (WebKit::CacheStorage::Cache::removeRecordFromDisk): (WebKit::CacheStorage::Cache::encode): (WebKit::CacheStorage::Cache::decodeRecordHeader): (WebKit::CacheStorage::Cache::decode): * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::initializeSize): (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): (WebKit::CacheStorage::Caches::removeRecord): (WebKit::CacheStorage::Caches::removeCacheEntry): * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::hasEnoughSpace const): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::traverse): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode): (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): LayoutTests: * http/wpt/cache-storage/cache-quota.https.any-expected.txt: Added. * http/wpt/cache-storage/cache-quota.https.any.html: Added. * http/wpt/cache-storage/cache-quota.https.any.js: Added. Canonical link: https://commits.webkit.org/194344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-09 22:17:05 +00:00
void setBodyData(ResponseData&&, uint64_t bodySizeWithPadding);
[Cache API] Add support for being loaded responses https://bugs.webkit.org/show_bug.cgi?id=175732 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-18 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/common.https-expected.txt: Source/WebCore: Covered by existing and rebased tests. Introducing a callback-based method to consume the body when the load is finished. Using that new method in Cache::put and calling batchPutOperation when the load is finished. Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream. * Modules/cache/Cache.cpp: (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream. (WebCore::toConnectionRecord): (WebCore::Cache::batchPutOperation): * Modules/cache/Cache.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::readableStreamBody): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::setAsReadableStream): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyWhenLoaded): * Modules/fetch/FetchResponse.h: LayoutTests: * TestExpectations: Removing some flaky test expectations. Canonical link: https://commits.webkit.org/192409@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-19 01:29:50 +00:00
removing FetchBoyd::m_type Remove FetchBody::m_type https://bugs.webkit.org/show_bug.cgi?id=162841 Patch by Youenn Fablet <youenn@apple.com> on 2016-10-01 Reviewed by Sam Weinig. No change of behavior. Removing FetchBody::m_type and using m_data in lieu. Introducing temporarily FetchBody::m_isEmpty to handle the case of null bodies. Null body handling should be moved to FetchBodyOwner in a follow-up patch. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::extract): (WebCore::FetchBody::arrayBuffer): (WebCore::FetchBody::blob): (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consumeOnceLoadingFinished): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingSucceeded): (WebCore::FetchBody::bodyForInternalRequest): (WebCore::FetchBody::clone): (WebCore::FetchBody::consumeText): Deleted. (WebCore::FetchBody::consumeBlob): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::isEmpty): (WebCore::FetchBody::isBlob): (WebCore::FetchBody::isFormData): (WebCore::FetchBody::isArrayBuffer): (WebCore::FetchBody::isArrayBufferView): (WebCore::FetchBody::isURLSearchParams): (WebCore::FetchBody::isText): (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::setContentType): Deleted. (WebCore::FetchBody::urlSearchParamsBody): Deleted. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::finishBlobLoading): Deleted. * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): Deleted. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::consume): (WebCore::FetchResponse::consumeBodyAsStream): (WebCore::FetchResponse::createReadableStreamSource): (WebCore::FetchResponse::finishConsumingStream): Deleted. * Modules/fetch/FetchResponse.h: Canonical link: https://commits.webkit.org/180770@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-01 16:31:44 +00:00
bool isLoading() const { return !!m_bodyLoader; }
FetchResponse should support ConsumeData callback on chunk data is received https://bugs.webkit.org/show_bug.cgi?id=181600 <rdar://problem/36932547> Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-body-loaded-in-chunk-worker.js: Added. Source/WebCore: Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream. Refactor to have one consumeBodyReceivedByChunk method for both cases. This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): (WebCore::FetchResponse::BodyLoader::consumeDataByChunk): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyReceivedByChunk): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198120@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-31 04:23:50 +00:00
bool isBodyReceivedByChunk() const { return isLoading() || hasReadableStreamBody(); }
bool isBlobBody() const { return !isBodyNull() && body().isBlob(); }
bool isBlobFormData() const { return !isBodyNull() && body().isFormData(); }
FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies https://bugs.webkit.org/show_bug.cgi?id=182008 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-readable-stream-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-chunk-iframe.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-chunk-worker.js: Added. (const.process): (this.step): (this.run): (const.asyncSteps): Source/WebCore: Modify FetchResponse to support ConsumeData callback with handling of ReadableStream by chunks * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consumeBodyFromReadableStream): * Modules/fetch/FetchResponse.h: * Modules/streams/ReadableStreamChunk.h: Added. * Modules/streams/ReadableStreamSink.cpp: (WebCore::ReadableStreamToSharedBufferSink::enqueue): (WebCore::ReadableStreamToSharedBufferSink::close): * Modules/streams/ReadableStreamSink.h: * WebCore.xcodeproj/project.pbxproj: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198067@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-29 23:39:21 +00:00
using ConsumeDataByChunkCallback = Function<void(ExceptionOr<Span<const uint8_t>*>&&)>;
FetchResponse should support ConsumeData callback on chunk data is received https://bugs.webkit.org/show_bug.cgi?id=181600 <rdar://problem/36932547> Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-body-loaded-in-chunk-worker.js: Added. Source/WebCore: Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream. Refactor to have one consumeBodyReceivedByChunk method for both cases. This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): (WebCore::FetchResponse::BodyLoader::consumeDataByChunk): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyReceivedByChunk): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198120@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-31 04:23:50 +00:00
void consumeBodyReceivedByChunk(ConsumeDataByChunkCallback&&);
[Cache API] Add support for being loaded responses https://bugs.webkit.org/show_bug.cgi?id=175732 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-18 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/common.https-expected.txt: Source/WebCore: Covered by existing and rebased tests. Introducing a callback-based method to consume the body when the load is finished. Using that new method in Cache::put and calling batchPutOperation when the load is finished. Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream. * Modules/cache/Cache.cpp: (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream. (WebCore::toConnectionRecord): (WebCore::Cache::batchPutOperation): * Modules/cache/Cache.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::readableStreamBody): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::setAsReadableStream): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyWhenLoaded): * Modules/fetch/FetchResponse.h: LayoutTests: * TestExpectations: Removing some flaky test expectations. Canonical link: https://commits.webkit.org/192409@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-19 01:29:50 +00:00
WEBCORE_EXPORT ResourceResponse resourceResponse() const;
ResourceResponse::Tainting tainting() const { return m_internalResponse.tainting(); }
[Cache API] Adding generic support for CacheStorage and Cache methods https://bugs.webkit.org/show_bug.cgi?id=175455 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-15 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt: Source/WebCore: Covered by existing tests. Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection. The CacheStorageProvider is accessed from the page for Document calls. The CacheStorageConnection is responsible to implement the read/write operations on the cache database. At the moment, it does nothing but return not implemented errors. Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on. CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache. The CacheStorageConnection is a generic connection and not tied to any document/context. CacheStorage objects are manipulated by providing to the connection the origin of the context. CacheStorage are global to all contexts with the same origin. Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object. Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation. * Modules/cache/Cache.cpp: (WebCore::Cache::Cache): (WebCore::Cache::~Cache): The CacheStorageConnection is a generic connection and not tied to any document/context. (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match. Redirect to matchAll as per spec. (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll. Checks for request as per spec. Then either refresh the request to response map and return all responses. Or call the query cache algorithm and return copies of the responses (using clone). (WebCore::Cache::put): Check the request and response as per spec. Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now. Call the batch put operation. (WebCore::Cache::remove): Check the request and response as per spec. Call the batch delete operation. (WebCore::Cache::keys): Refresh the request to response map and return corresponding requests. Making sure to reuse the same request objects as per spec. As per spec, the request to response map is ordered. We implement it as a Vector. (WebCore::Cache::refreshRequestToResponseMap): Use the cache storage connection to get an up-to-date list of cached records. (WebCore::Cache::queryCacheMatch): Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm. This is split for queryCache as cache storage engine will need to use it when implementing the delete operation. (WebCore::Cache::queryCache): Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument. (WebCore::Cache::queryCacheWithTargetStorage): Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument. (WebCore::Cache::batchDeleteOperation): Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation. Delete operation are always done one at a time. (WebCore::Cache::batchPutOperation): Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation. Put operation takes one record for put but can take several records in the case of addAll, hence the current design. (WebCore::Cache::updateRequestToResponseMap): Update the cache request to response map based on the records retrieved from the cache storage connection. * Modules/cache/Cache.h: (WebCore::Cache::create): (WebCore::Cache::name const): * Modules/cache/Cache.idl: * Modules/cache/CacheStorage.cpp: (WebCore::CacheStorage::origin const): Computing the cache origin that is passed to the CacheStorageConnection. (WebCore::CacheStorage::has): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has. Call the cache storage connection to refresh its cache map. Then use it to check whether a cache exists. (WebCore::CacheStorage::refreshCacheMap): Use the cache storage connection to get the list of existing caches. (WebCore::CacheStorage::open): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open. Refreshing the cache map so as to return a pre-existing cache if any. (WebCore::CacheStorage::remove): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method. Refreshing the cache map so as to do nothing if there is no cache to remove. (WebCore::CacheStorage::keys): Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method. Refreshing the cache map and returnin its keys. As per spec, the cache map is ordered. We implement it as a Vector. (WebCore::CacheStorage::cacheMap): Get the list of cache objects, used as a private accessor for JS built-ins. * Modules/cache/CacheStorage.h: (WebCore::CacheStorage::create): (WebCore::CacheStorage::CacheStorage): * Modules/cache/CacheStorageConnection.cpp: Added. (WebCore::CacheStorageConnection::exceptionFromError): * Modules/cache/CacheStorageConnection.h: Added. Makes the link between Web facing Cache API and the cache storage engine. Envisioned implementation are: - One main thread connection used by all documents in the given process. - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards. (WebCore::CacheStorageConnection::create): (WebCore::CacheStorageConnection::open): (WebCore::CacheStorageConnection::remove): (WebCore::CacheStorageConnection::refreshCacheMap): (WebCore::CacheStorageConnection::refreshRequestToResponseMap): (WebCore::CacheStorageConnection::batchDeleteOperation): (WebCore::CacheStorageConnection::batchPutOperation): * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective. * Modules/cache/DOMWindowCaches.cpp: (WebCore::DOMWindowCaches::caches const): * Modules/cache/WorkerGlobalScopeCaches.cpp: (WebCore::WorkerGlobalScopeCaches::from): (WebCore::WorkerGlobalScopeCaches::caches const): * Modules/cache/WorkerGlobalScopeCaches.h: (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::create): Add another create as used by the cache API. (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchRequest.cpp: (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value. Add a check so that no value at all is the same as a null/undefined value. (WebCore::FetchRequest::resourceRequest const): * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.h: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::overlayPage): * page/CacheStorageProvider.h: Added. Interface to create main thread cache storage connection for the given page. There will be one provider for each process. Passing a sessionID so that we will create a connection per session. * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::cacheStorageProvider): * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged): Source/WebKit: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Cache/WebCacheStorageProvider.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_cpuLimit): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::WebProcess): * WebProcess/WebProcess.h: (WebKit::WebProcess::cacheStorageProvider): Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::initWithFrame): LayoutTests: * TestExpectations: Skipping a test that would timeout otherwise due to the current implementation limitations. Canonical link: https://commits.webkit.org/192266@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-15 21:04:38 +00:00
Add quota to cache API https://bugs.webkit.org/show_bug.cgi?id=177552 Patch by Youenn Fablet <youenn@apple.com> on 2017-10-09 Reviewed by Alex Christensen. Source/WebCore: Tests: http/wpt/cache-storage/cache-quota.any.html Storing padded opaque response body sizes within FetchResponse and CacheStorageConnection. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. Storing in CacheStorageConnection is needed for handling cloned network fetched created responses. Storing in FetchResponse is needed for handling cloned cache-storage created opaque responses. Adding internals to query and set the fuzzed size of a response. * Modules/cache/CacheStorageConnection.cpp: (WebCore::computeRealBodySize): (WebCore::CacheStorageConnection::computeRecordBodySize): (WebCore::CacheStorageConnection::setResponseBodySizeWithPadding): (WebCore::CacheStorageConnection::responseBodySizeWithPadding const): * Modules/cache/CacheStorageConnection.h: * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::toConnectionRecord): (WebCore::DOMCache::updateRecords): * Modules/cache/DOMCache.h: * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): (WebCore::DOMCacheEngine::Record::copy const): * Modules/cache/DOMCacheEngine.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::toCrossThreadRecordData): (WebCore::fromCrossThreadRecordData): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * testing/Internals.cpp: (WebCore::Internals::setResponseSizeWithPadding): (WebCore::Internals::responseSizeWithPadding const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Adding support for quota checking in CacheStorage::Caches. It is passed to NetworkProcess at creation time. Default quota size is configured to 400Ko by origin per default. This value is suitable for testing. Future patch should raise this default value and allows configuring it. Quota is computed based on the response body size. This size is padded at WebCore for opaque responses. Size is stored persistently as opaque response padded size should remain stable. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. In case of putting several records at the same time, the size of all records is computed so that all records will be written or rejected together. Sending QuotaExceeded error when quota is exceeded. Future effort should allow asking UIProcess for quota extension. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::cacheStoragePerOriginQuota const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::readCachesFromDisk): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::toRecordInformation): (WebKit::CacheStorage::isolatedCopy): (WebKit::CacheStorage::Cache::open): (WebKit::CacheStorage::Cache::storeRecords): (WebKit::CacheStorage::Cache::put): (WebKit::CacheStorage::Cache::writeRecordToDisk): (WebKit::CacheStorage::Cache::updateRecordToDisk): (WebKit::CacheStorage::Cache::removeRecordFromDisk): (WebKit::CacheStorage::Cache::encode): (WebKit::CacheStorage::Cache::decodeRecordHeader): (WebKit::CacheStorage::Cache::decode): * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::initializeSize): (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): (WebKit::CacheStorage::Caches::removeRecord): (WebKit::CacheStorage::Caches::removeCacheEntry): * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::hasEnoughSpace const): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::traverse): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode): (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): LayoutTests: * http/wpt/cache-storage/cache-quota.https.any-expected.txt: Added. * http/wpt/cache-storage/cache-quota.https.any.html: Added. * http/wpt/cache-storage/cache-quota.https.any.js: Added. Canonical link: https://commits.webkit.org/194344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-09 22:17:05 +00:00
uint64_t bodySizeWithPadding() const { return m_bodySizeWithPadding; }
void setBodySizeWithPadding(uint64_t size) { m_bodySizeWithPadding = size; }
uint64_t opaqueLoadIdentifier() const { return m_opaqueLoadIdentifier; }
void initializeOpaqueLoadIdentifierForTesting() { m_opaqueLoadIdentifier = 1; }
Response headers should be filtered when sent from NetworkProcess to WebProcess https://bugs.webkit.org/show_bug.cgi?id=184310 Reviewed by Ryosuke Niwa. Source/WebCore: Did some refactoring to allow ResourceResponse to use header value parsing routines. We add sanitization levels for regular responses in case responses might be exposed to scripts or not. If not exposed to scripts, additional filtering is done. Add internal API to get unfiltered response headers from a fetch response. Test: http/wpt/service-workers/header-filtering.https.html * Modules/fetch/FetchResponse.h: * loader/CrossOriginPreflightResultCache.cpp: (WebCore::CrossOriginPreflightResultCacheItem::parse): * platform/network/HTTPParsers.h: (WebCore::addToAccessControlAllowList): (WebCore::parseAccessControlAllowList): * platform/network/ResourceResponseBase.cpp: (WebCore::isSafeToKeepRedirectionResponseHeader): (WebCore::isCrossOriginSafeToKeepResponseHeader): (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields): * platform/network/ResourceResponseBase.h: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::fetchResponseHeaderList): * testing/ServiceWorkerInternals.h: * testing/ServiceWorkerInternals.idl: Source/WebKit: Pass destination parameter to NetworkResourceLoader. Use new sanitization routine to filter response headers as needed: - Cross-origin routines are filtered by removing any non CORS allowed headers. - Same-origin responses are filtered by removing non used headers, except when filtering would be visible by JS (XHR, fetch). In all cases, Set-Cookie/Set-Cookie2 headers are filtered out. * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry): * NetworkProcess/NetworkResourceLoader.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): LayoutTests: Rebased tests for WK2 as Server response header is now filtered out for cross-origin and not fetch/XHR loads. * http/wpt/service-workers/header-filtering-worker.js: Added. * http/wpt/service-workers/header-filtering.https-expected.txt: Added. Some tests are failing as navigation loads are not yet filtered and we have no good way yet to detect cross origin loads. * http/wpt/service-workers/header-filtering.https.html: Added. * http/wpt/service-workers/resources/header-filtering-iframe.html: Added. * http/wpt/service-workers/resources/response-full-of-headers.py: Added. * http/tests/webarchive/cross-origin-stylesheet-crash-expected.txt: Added. * http/tests/webarchive/test-preload-resources-expected.txt: Added. * platform/mac-wk1/http/tests/webarchive/cross-origin-stylesheet-crash-expected.txt: Added. * platform/mac-wk1/http/tests/webarchive/test-preload-resources-expected.txt: Added. * platform/win/http/tests/webarchive/cross-origin-stylesheet-crash-expected.txt: Added. * platform/win/http/tests/webarchive/test-preload-resources-expected.txt: Added. Canonical link: https://commits.webkit.org/199939@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-07 03:48:55 +00:00
const HTTPHeaderMap& internalResponseHeaders() const { return m_internalResponse.httpHeaderFields(); }
WebAssembly: add support for stream APIs https://bugs.webkit.org/show_bug.cgi?id=173105 Reviewed by Keith Miller. .: * Source/cmake/OptionsFTW.cmake: * Source/cmake/WebKitFeatures.cmake: JSTests: * wasm/stress/resources/tsf.wasm: Added. * wasm/stress/wasm-streaming-compiler-compile.js: Added. (shouldBe): (slice): (async main): (main.catch): * wasm/stress/wasm-streaming-compiler-instantiate.js: Added. (shouldBe): (slice): (async main.): (async main): (main.catch): LayoutTests/imported/w3c: * web-platform-tests/wasm/wasm_stream_compile_test-expected.txt: * web-platform-tests/wasm/wasm_stream_compile_test.html: * web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt: * web-platform-tests/wasm/wasm_stream_instantiate_test.html: * web-platform-tests/wasm/webapi/abort.any-expected.txt: * web-platform-tests/wasm/webapi/abort.any.worker-expected.txt: * web-platform-tests/wasm/webapi/body.any-expected.txt: * web-platform-tests/wasm/webapi/body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/historical.any-expected.txt: * web-platform-tests/wasm/webapi/historical.any.worker-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any.worker-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any.worker-expected.txt: * web-platform-tests/wasm/webapi/status.any-expected.txt: * web-platform-tests/wasm/webapi/status.any.worker-expected.txt: Source/JavaScriptCore: This patch implements WebAssembly.{compileStreaming,instantiateStreaming}. JavaScriptCore offers Wasm::StreamingCompiler interface to WebCore, so that WebCore can feed FetchResponse and compile wasm code in a streaming fashion. Wasm::StreamingCompiler drives Wasm::LLIntPlan while it does not use Wasm::Worklist since currently Wasm::Worklist is not suitable abstraction for streaming compilation which generates compilation tasks incrementally. Instead, Wasm::StreamingCompiler generates Wasm::StreamingPlan and enqueues them to Wasm::Worklist, and each StreamingPlan compiles one function at a time. And we gather these compiled functions into the one LLIntPlan and finally Wasm::StreamingCompiler completes Wasm::LLIntPlan. We already have Wasm::StreamingParser, which is designed for streaming compilation. We can pass bytes to this parser, and this parser invokes a callback when a new wasm function is found. Then, Wasm::StreamingCompiler generates Wasm::StreamingPlan for that. We add WasmStreamingCompiler JS objects to JSC shell to test streaming compilation easily. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/WebAssembly.js: (compileStreaming): (instantiateStreaming): * runtime/DeferredWorkTimer.cpp: (JSC::DeferredWorkTimer::cancelPendingWork): * runtime/DeferredWorkTimer.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/OptionsList.h: * tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSDollarVM::finishCreation): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): * wasm/WasmBBQPlan.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmEntryPlan.cpp: (JSC::Wasm::EntryPlan::EntryPlan): * wasm/WasmEntryPlan.h: * wasm/WasmLLIntPlan.cpp: (JSC::Wasm::LLIntPlan::LLIntPlan): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::completeInStreaming): (JSC::Wasm::LLIntPlan::didCompileFunctionInStreaming): (JSC::Wasm::LLIntPlan::didFailInStreaming): * wasm/WasmLLIntPlan.h: * wasm/WasmModule.cpp: (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmStreamingCompiler.cpp: Added. (JSC::Wasm::StreamingCompiler::StreamingCompiler): (JSC::Wasm::StreamingCompiler::~StreamingCompiler): (JSC::Wasm::StreamingCompiler::create): (JSC::Wasm::StreamingCompiler::didReceiveFunctionData): (JSC::Wasm::StreamingCompiler::didCompileFunction): (JSC::Wasm::StreamingCompiler::didFinishParsing): (JSC::Wasm::StreamingCompiler::completeIfNecessary): (JSC::Wasm::StreamingCompiler::didComplete): (JSC::Wasm::StreamingCompiler::finalize): (JSC::Wasm::StreamingCompiler::fail): (JSC::Wasm::StreamingCompiler::cancel): * wasm/WasmStreamingCompiler.h: Added. * wasm/WasmStreamingParser.cpp: * wasm/WasmStreamingParser.h: * wasm/WasmStreamingPlan.cpp: Copied from Source/JavaScriptCore/builtins/WebAssembly.js. (JSC::Wasm::StreamingPlan::StreamingPlan): (JSC::Wasm::StreamingPlan::work): * wasm/WasmStreamingPlan.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssembly.h. * wasm/js/JSWebAssembly.cpp: (JSC::JSWebAssembly::finishCreation): (JSC::JSWebAssembly::instantiateForStreaming): (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssembly.h: Source/WebCore: Since WebAssembly.{compileStreaming,instantiateStreaming} needs to handle FetchResponse which is WebCore type, they need to be implemented in WebCore side. To achieve that, JSC offers callback to JSGlobalObject, and WebCore JSDOMGlobalObject can implement them to offer WebAssembly.{compileStreaming,instantiateStreaming} features. We use JSC's Wasm::StreamingCompiler to implement them. WebCore feeds bytes from FetchResponse and drives Wasm::StreamingCompiler. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMGlobalObject::compileStreaming): (WebCore::JSDOMGlobalObject::instantiateStreaming): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::tryAllocate): Deleted. (WebCore::isResponseCorrect): Deleted. (WebCore::handleResponseOnStreamingAction): Deleted. (WebCore::JSDOMWindowBase::compileStreaming): Deleted. (WebCore::JSDOMWindowBase::instantiateStreaming): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: Source/WTF: * wtf/PlatformEnable.h: Canonical link: https://commits.webkit.org/233426@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-28 01:31:34 +00:00
bool isCORSSameOrigin() const;
bool hasWasmMIMEType() const;
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
private:
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
FetchResponse(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceResponse&&);
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
void stop() final;
const char* activeDOMObjectName() const final;
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker https://bugs.webkit.org/show_bug.cgi?id=179641 <rdar://problem/35923570> Patch by Youenn Fablet <youenn@apple.com> on 2017-12-08 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt: Source/WebCore: Covered by existing rebased tests. FetchResponse will now store an unfiltered response. If it needs to expose it to JavaScript, it will create a filtered response lazily. This allows service worker to send back to web pages, opaque responses containing every information. Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin. This ensures cross-origin checks to work if service worker returns such a response on a same origin URL. Updated SubresourceLoader to check cross origin service worker responses based on their tainting. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::url const): (WebCore::FetchResponse::filteredResponse const): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::resourceResponse const): * Modules/fetch/FetchResponse.h: (WebCore::FetchResponse::create): Deleted. * dom/Document.cpp: (WebCore::Document::initSecurityContext): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Source/WebKit: * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response. LayoutTests: * TestExpectations: Canonical link: https://commits.webkit.org/196518@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-08 22:41:48 +00:00
const ResourceResponse& filteredResponse() const;
[Fetch API] Use ReadableStream pull to transfer binary data to stream when application needs it https://bugs.webkit.org/show_bug.cgi?id=162892 Patch by Youenn Fablet <youenn@apple.com> on 2016-10-06 Reviewed by Alex Christensen. Covered by existing tests. Before this patch, FetchResponse was never resolving the start promise. This way, it could enqueue data, error or close the stream whenever desired. With this patch, FetchResponse will feed the stream when being asked to. This allows keeping the data in WebCore until the application needs it. This is only implemented for network data. For other data owned by response (blob, text...), data will be enqueued like previously as fast as possible. Note that FetchResponse can enqueue/error/close the stream at any time since JSFetchResponse has a reference to the stream. And the stream has a reference to the controller. In addition to transfer binary chunks to ReadableStream only when needed, WebCore is now aware of the data stored in the response, which may allow applying backpressure to the network source in the future. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): Enqueuing only if stream is pulling. Otherwise, storing in FetchBodyConsumer. If stream is pulling, we enqueue both buffered data and received chunk. (WebCore::FetchResponse::consumeBodyAsStream): Resolving pull promise if we enqueued some buffered data. (WebCore::FetchResponse::closeStream): (WebCore::FetchResponse::feedStream): If we have some buffered data, we enqueue it. If there is no loader, the stream can be closed. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponseSource.cpp: (WebCore::FetchResponseSource::doPull): (WebCore::FetchResponseSource::close): (WebCore::FetchResponseSource::error): * Modules/fetch/FetchResponseSource.h: * Modules/streams/ReadableStreamSource.h: (WebCore::ReadableStreamSource::isPulling): Renamed from isStarting. (WebCore::ReadableStreamSource::isStarting): Deleted. Canonical link: https://commits.webkit.org/180910@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206857 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-06 09:43:52 +00:00
void closeStream();
[Fetch API] Implement abortable fetch https://bugs.webkit.org/show_bug.cgi?id=174980 <rdar://problem/46861402> Reviewed by Chris Dumez. LayoutTests/imported/w3c: Fixed tests to run in WebKit CI. Also fixed a bug in a test where the fetch response body is not actually empty. * web-platform-tests/fetch/api/abort/cache.https-expected.txt: * web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.js: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Source/WebCore: Add an AbortSignal to FetchRequest. Add support for AbortSignal algorithm. The fetch request signal is added an algorithm to abort the fetch. Update clone algorithm to let signal of the cloned request be following the origin request. Update ReadableStream error handling to return an exception instead of a string. This allows passing an AbortError instead of a TypeError as previously done. Update FetchBodyOwner to store a loading error either as an exception or as a resource error. The latter is used for passing the error from service worker back to the page. The former is used to pass it to ReadableStream or body accessors. Covered by enabled tests. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): (WebCore::FetchBodyOwner::setLoadingError): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadingError const): (WebCore::FetchBodyOwner::loadingException const): * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::error): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error): * dom/AbortSignal.cpp: (WebCore::AbortSignal::abort): (WebCore::AbortSignal::follow): * dom/AbortSignal.h: LayoutTests: * TestExpectations: Enable abort tests. Canonical link: https://commits.webkit.org/207672@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-05 00:01:43 +00:00
void addAbortSteps(Ref<AbortSignal>&&);
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
class BodyLoader final : public FetchLoaderClient {
WTF_MAKE_FAST_ALLOCATED;
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
public:
BodyLoader(FetchResponse&, NotificationCallback&&);
~BodyLoader();
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
bool start(ScriptExecutionContext&, const FetchRequest&);
void stop();
FetchResponse should support ConsumeData callback on chunk data is received https://bugs.webkit.org/show_bug.cgi?id=181600 <rdar://problem/36932547> Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-body-loaded-in-chunk-worker.js: Added. Source/WebCore: Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream. Refactor to have one consumeBodyReceivedByChunk method for both cases. This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): (WebCore::FetchResponse::BodyLoader::consumeDataByChunk): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyReceivedByChunk): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198120@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-31 04:23:50 +00:00
void consumeDataByChunk(ConsumeDataByChunkCallback&&);
[Cache API] Add support for being loaded responses https://bugs.webkit.org/show_bug.cgi?id=175732 Patch by Youenn Fablet <youenn@apple.com> on 2017-08-18 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/service-workers/cache-storage/common.https-expected.txt: Source/WebCore: Covered by existing and rebased tests. Introducing a callback-based method to consume the body when the load is finished. Using that new method in Cache::put and calling batchPutOperation when the load is finished. Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream. * Modules/cache/Cache.cpp: (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream. (WebCore::toConnectionRecord): (WebCore::Cache::batchPutOperation): * Modules/cache/Cache.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::readableStreamBody): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::setAsReadableStream): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyWhenLoaded): * Modules/fetch/FetchResponse.h: LayoutTests: * TestExpectations: Removing some flaky test expectations. Canonical link: https://commits.webkit.org/192409@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-19 01:29:50 +00:00
LayoutTests/imported/w3c: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * web-platform-tests/fetch/api/basic/stream-response-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: * web-platform-tests/fetch/api/request/request-consume.html: * web-platform-tests/fetch/api/resources/data.json: Added. * web-platform-tests/fetch/api/resources/utils.js: (validateStreamFromString): * web-platform-tests/fetch/api/response/response-cancel-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-cancel-stream.html: Added. * web-platform-tests/fetch/api/response/response-clone-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume-stream.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-1.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-1.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-2.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-2.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-3.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-3.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-4.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-4.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-5.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-5.html: Added. Source/WebCore: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. This patch introduces ReadableStreamSource and ReadableStreamController which allow feeding a ReadableStream from DOM classes. ReadableStreamSource is a base class for all DOM ReadableStream sources. ReadableStreamController is a wrapper around JSReadableStreamController that can be invoked by DOM code to enqueue/close/error a ReadableStream. A createReadableStream function is introduced to allow DOM classes creating ReadableStream. Added support for a FetchResponse ReadableStream source. Both synthetic FetchResponse and loading FetchResponse are supported. A new "Stream" FetchLoader::Type is introduced to allow receiving data as chunks and feeding them to a ReadableStream through ReadableStreamSource. Currently, FetchResponse is consumed and marked as disturbed as soon as a ReadableStreamSource is created. This should be changed so that consumption happens on the first read call to the ReadableStreamReader, i.e. when stream gets disturbed. FetchResponseSource never fulfills the start promise, which allows to enqueue, error or close the stream at any time. FetchResponseSource must therefore always ensure to close or error the stream. Added support for locked check in FetchResponse. Tests: imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-1.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-2.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-3.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-4.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-5.html Also covered by rebased tests. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): Fill stream with body data. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::type): Added accessor to body type, used for assertions. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::isDisturbed): Adding stream isLocked check. (WebCore::FetchBodyOwner::blobLoadingSucceeded): Added assertion that body type is blob. Closing stream if created. (WebCore::FetchBodyOwner::blobLoadingFailed): Erroring the stream if created and not cancelled. (WebCore::FetchBodyOwner::blobChunk): Filling stream with chunk. (WebCore::FetchBodyOwner::stop): Rmoved call to finishBlobLoading as it should be called as part of FetchLoaderCLient::didFail callbacki. * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchLoader.cpp: Fixing the case of cancel being called when creating the ThreadableLoader by introducing FetchLoader::m_isStarted. (WebCore::FetchLoader::start): Setting m_isStarted at the end of the start method. (WebCore::FetchLoader::stop): Fixing the case that FetchLoader can be destroyed when cancelling its loader. (WebCore::FetchLoader::startStreaming): Introduced to switch the loading type from ArayBuffer to Stream. Already buffered data is returned. (WebCore::FetchLoader::didReceiveData): Handling of the new Stream type. (WebCore::FetchLoader::didFinishLoading): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchLoaderClient.h: (WebCore::FetchLoaderClient::didReceiveData): Callback to get data as chunks if loader is of type Stream. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): Removed m_isLocked as it is handled within isDisturbed(). (WebCore::FetchResponse::isDisturbed): Checking whether related ReadableStream is locked. (WebCore::FetchResponse::BodyLoader::didSucceed): Introduced to handle ReadableStream case. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveData): Ditto. (WebCore::FetchResponse::BodyLoader::startStreaming): Ditto. (WebCore::FetchResponse::consumeBodyAsStream): Start filling the ReadableStream with data. Changing loader to Stream if there is one. (WebCore::FetchResponse::createReadableStreamSource): Called by custom binding to create the source. (WebCore::FetchResponse::stop): Fixing potential crash in case of cancelling the ibody stream. (WebCore::FetchResponse::startFetching): (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponseSource.cpp: Specialization of ReadableStreamSource for FetchResponse. It is a push source that never resolves the start promise. (WebCore::FetchResponseSource::FetchResponseSource): (WebCore::FetchResponseSource::isReadableStreamLocked): (WebCore::FetchResponseSource::setActive): (WebCore::FetchResponseSource::setInactive): (WebCore::FetchResponseSource::doStart): (WebCore::FetchResponseSource::doCancel): (WebCore::FetchResponseSource::close): (WebCore::FetchResponseSource::error): * Modules/fetch/FetchResponseSource.h: Added. * Modules/streams/ReadableStreamController.js: (error): * Modules/streams/ReadableStreamSource.h: Added (base class for ReadableStream DOM sources). (WebCore::ReadableStreamSource::~ReadableStreamSource): (WebCore::ReadableStreamSource::isStarting): (WebCore::ReadableStreamSource::isPulling): (WebCore::ReadableStreamSource::isCancelling): (WebCore::ReadableStreamSource::controller): (WebCore::ReadableStreamSource::doStart): (WebCore::ReadableStreamSource::doCancel): (WebCore::ReadableStreamSource::start): (WebCore::ReadableStreamSource::cancel): (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::clean): * Modules/streams/ReadableStreamSource.idl: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSFetchResponseCustom.cpp: In case body is not created, call createReadableStreamSource. (WebCore::JSFetchResponse::body): * bindings/js/JSReadableStreamSourceCustom.cpp: Added. (WebCore::JSReadableStreamSource::start): (WebCore::JSReadableStreamSource::pull): (WebCore::JSReadableStreamSource::controller): * bindings/js/ReadableStreamController.cpp: Added. (WebCore::callFunction): (WebCore::ReadableStreamController::invoke): (WebCore::ReadableStreamController::isControlledReadableStreamLocked): (WebCore::createReadableStream): * bindings/js/ReadableStreamController.h: The DOM wrapper for JSReadableStreamController. (WebCore::ReadableStreamController::ReadableStreamController): (WebCore::ReadableStreamController::close): (WebCore::ReadableStreamController::error): (WebCore::ReadableStreamController::enqueue): (WebCore::ReadableStreamController::globalObject): (WebCore::ReadableStreamController::enqueue<RefPtr<JSC::ArrayBuffer>>): (WebCore::ReadableStreamController::error<String>): LayoutTests: [Streams] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream-expected.txt: Added. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api.html: Added. * http/tests/xmlhttprequest/streams/streams-read-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read.html: Added. Canonical link: https://commits.webkit.org/174776@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-17 18:04:20 +00:00
RefPtr<SharedBuffer> startStreaming();
[Fetch API] Implement abortable fetch https://bugs.webkit.org/show_bug.cgi?id=174980 <rdar://problem/46861402> Reviewed by Chris Dumez. LayoutTests/imported/w3c: Fixed tests to run in WebKit CI. Also fixed a bug in a test where the fetch response body is not actually empty. * web-platform-tests/fetch/api/abort/cache.https-expected.txt: * web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.js: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Source/WebCore: Add an AbortSignal to FetchRequest. Add support for AbortSignal algorithm. The fetch request signal is added an algorithm to abort the fetch. Update clone algorithm to let signal of the cloned request be following the origin request. Update ReadableStream error handling to return an exception instead of a string. This allows passing an AbortError instead of a TypeError as previously done. Update FetchBodyOwner to store a loading error either as an exception or as a resource error. The latter is used for passing the error from service worker back to the page. The former is used to pass it to ReadableStream or body accessors. Covered by enabled tests. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): (WebCore::FetchBodyOwner::setLoadingError): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadingError const): (WebCore::FetchBodyOwner::loadingException const): * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::error): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error): * dom/AbortSignal.cpp: (WebCore::AbortSignal::abort): (WebCore::AbortSignal::follow): * dom/AbortSignal.h: LayoutTests: * TestExpectations: Enable abort tests. Canonical link: https://commits.webkit.org/207672@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-05 00:01:43 +00:00
NotificationCallback takeNotificationCallback() { return WTFMove(m_responseCallback); }
ConsumeDataByChunkCallback takeConsumeDataCallback() { return WTFMove(m_consumeDataCallback); }
LayoutTests/imported/w3c: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * web-platform-tests/fetch/api/basic/stream-response-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-worker-expected.txt: * web-platform-tests/fetch/api/request/request-consume.html: * web-platform-tests/fetch/api/resources/data.json: Added. * web-platform-tests/fetch/api/resources/utils.js: (validateStreamFromString): * web-platform-tests/fetch/api/response/response-cancel-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-cancel-stream.html: Added. * web-platform-tests/fetch/api/response/response-clone-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume-stream.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-1.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-1.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-2.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-2.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-3.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-3.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-4.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-4.html: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-expected-5.txt: Added. * web-platform-tests/fetch/api/response/response-stream-disturbed-5.html: Added. Source/WebCore: [Fetch API] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. This patch introduces ReadableStreamSource and ReadableStreamController which allow feeding a ReadableStream from DOM classes. ReadableStreamSource is a base class for all DOM ReadableStream sources. ReadableStreamController is a wrapper around JSReadableStreamController that can be invoked by DOM code to enqueue/close/error a ReadableStream. A createReadableStream function is introduced to allow DOM classes creating ReadableStream. Added support for a FetchResponse ReadableStream source. Both synthetic FetchResponse and loading FetchResponse are supported. A new "Stream" FetchLoader::Type is introduced to allow receiving data as chunks and feeding them to a ReadableStream through ReadableStreamSource. Currently, FetchResponse is consumed and marked as disturbed as soon as a ReadableStreamSource is created. This should be changed so that consumption happens on the first read call to the ReadableStreamReader, i.e. when stream gets disturbed. FetchResponseSource never fulfills the start promise, which allows to enqueue, error or close the stream at any time. FetchResponseSource must therefore always ensure to close or error the stream. Added support for locked check in FetchResponse. Tests: imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-1.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-2.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-3.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-4.html imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-5.html Also covered by rebased tests. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): Fill stream with body data. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::type): Added accessor to body type, used for assertions. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::isDisturbed): Adding stream isLocked check. (WebCore::FetchBodyOwner::blobLoadingSucceeded): Added assertion that body type is blob. Closing stream if created. (WebCore::FetchBodyOwner::blobLoadingFailed): Erroring the stream if created and not cancelled. (WebCore::FetchBodyOwner::blobChunk): Filling stream with chunk. (WebCore::FetchBodyOwner::stop): Rmoved call to finishBlobLoading as it should be called as part of FetchLoaderCLient::didFail callbacki. * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchLoader.cpp: Fixing the case of cancel being called when creating the ThreadableLoader by introducing FetchLoader::m_isStarted. (WebCore::FetchLoader::start): Setting m_isStarted at the end of the start method. (WebCore::FetchLoader::stop): Fixing the case that FetchLoader can be destroyed when cancelling its loader. (WebCore::FetchLoader::startStreaming): Introduced to switch the loading type from ArayBuffer to Stream. Already buffered data is returned. (WebCore::FetchLoader::didReceiveData): Handling of the new Stream type. (WebCore::FetchLoader::didFinishLoading): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchLoaderClient.h: (WebCore::FetchLoaderClient::didReceiveData): Callback to get data as chunks if loader is of type Stream. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): Removed m_isLocked as it is handled within isDisturbed(). (WebCore::FetchResponse::isDisturbed): Checking whether related ReadableStream is locked. (WebCore::FetchResponse::BodyLoader::didSucceed): Introduced to handle ReadableStream case. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveData): Ditto. (WebCore::FetchResponse::BodyLoader::startStreaming): Ditto. (WebCore::FetchResponse::consumeBodyAsStream): Start filling the ReadableStream with data. Changing loader to Stream if there is one. (WebCore::FetchResponse::createReadableStreamSource): Called by custom binding to create the source. (WebCore::FetchResponse::stop): Fixing potential crash in case of cancelling the ibody stream. (WebCore::FetchResponse::startFetching): (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponseSource.cpp: Specialization of ReadableStreamSource for FetchResponse. It is a push source that never resolves the start promise. (WebCore::FetchResponseSource::FetchResponseSource): (WebCore::FetchResponseSource::isReadableStreamLocked): (WebCore::FetchResponseSource::setActive): (WebCore::FetchResponseSource::setInactive): (WebCore::FetchResponseSource::doStart): (WebCore::FetchResponseSource::doCancel): (WebCore::FetchResponseSource::close): (WebCore::FetchResponseSource::error): * Modules/fetch/FetchResponseSource.h: Added. * Modules/streams/ReadableStreamController.js: (error): * Modules/streams/ReadableStreamSource.h: Added (base class for ReadableStream DOM sources). (WebCore::ReadableStreamSource::~ReadableStreamSource): (WebCore::ReadableStreamSource::isStarting): (WebCore::ReadableStreamSource::isPulling): (WebCore::ReadableStreamSource::isCancelling): (WebCore::ReadableStreamSource::controller): (WebCore::ReadableStreamSource::doStart): (WebCore::ReadableStreamSource::doCancel): (WebCore::ReadableStreamSource::start): (WebCore::ReadableStreamSource::cancel): (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::clean): * Modules/streams/ReadableStreamSource.idl: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSFetchResponseCustom.cpp: In case body is not created, call createReadableStreamSource. (WebCore::JSFetchResponse::body): * bindings/js/JSReadableStreamSourceCustom.cpp: Added. (WebCore::JSReadableStreamSource::start): (WebCore::JSReadableStreamSource::pull): (WebCore::JSReadableStreamSource::controller): * bindings/js/ReadableStreamController.cpp: Added. (WebCore::callFunction): (WebCore::ReadableStreamController::invoke): (WebCore::ReadableStreamController::isControlledReadableStreamLocked): (WebCore::createReadableStream): * bindings/js/ReadableStreamController.h: The DOM wrapper for JSReadableStreamController. (WebCore::ReadableStreamController::ReadableStreamController): (WebCore::ReadableStreamController::close): (WebCore::ReadableStreamController::error): (WebCore::ReadableStreamController::enqueue): (WebCore::ReadableStreamController::globalObject): (WebCore::ReadableStreamController::enqueue<RefPtr<JSC::ArrayBuffer>>): (WebCore::ReadableStreamController::error<String>): LayoutTests: [Streams] Consume HTTP data as a ReadableStream https://bugs.webkit.org/show_bug.cgi?id=138968 Reviewed by Alex Christensen. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream-expected.txt: Added. * fast/xmlhttprequest/xmlhttprequest-responsetype-stream.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-cancelled.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api-closed.html: Added. * http/tests/xmlhttprequest/streams/streams-read-api-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read-api.html: Added. * http/tests/xmlhttprequest/streams/streams-read-expected.txt: Added. * http/tests/xmlhttprequest/streams/streams-read.html: Added. Canonical link: https://commits.webkit.org/174776@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-17 18:04:20 +00:00
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
private:
// FetchLoaderClient API
void didSucceed() final;
Implement quota limitation for keepalive Fetch requests https://bugs.webkit.org/show_bug.cgi?id=175482 Reviewed by Sam Weinig and Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt: * web-platform-tests/fetch/api/cors/cors-multiple-origins-expected.txt: * web-platform-tests/fetch/api/cors/cors-multiple-origins-worker-expected.txt: * web-platform-tests/fetch/api/cors/cors-preflight-star.any-expected.txt: * web-platform-tests/fetch/api/cors/cors-preflight-star.any.worker-expected.txt: * web-platform-tests/fetch/http-cache/cc-request-expected.txt: Rebaseline tests now that we provide a more helpful error message when rejecting the fetch() promise. * web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt: Rebaseline test for keepalive Fetch requests quota which is now passing. Source/WebCore: Implement quota limitation for keepalive Fetch requests as per: - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9) This partly works for Beacon as well, meaning that no Beacon with a body over 64Kb can be sent. However, we don't keep track about wether or not beacon loads are inflight or not. Also update CachedResourceLoader::requestResource() so that the caller can get a ResourceError when it returns null. This is useful for both Fetch and Beacon to return better error messages. Test: http/wpt/beacon/beacon-quota.html * CMakeLists.txt: * Modules/beacon/NavigatorBeacon.cpp: (WebCore::NavigatorBeacon::sendBeacon): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse): (WebCore::FetchBodyOwner::BlobLoader::didFail): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFail): * Modules/fetch/FetchLoaderClient.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * WebCore.xcodeproj/project.pbxproj: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): * loader/cache/CachedResource.h: (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const): * loader/cache/CachedResourceLoader.cpp: (WebCore::createResource): (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::requestFont): (WebCore::CachedResourceLoader::requestTextTrack): (WebCore::CachedResourceLoader::requestCSSStyleSheet): (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): (WebCore::CachedResourceLoader::requestScript): (WebCore::CachedResourceLoader::requestXSLStyleSheet): (WebCore::CachedResourceLoader::requestSVGDocument): (WebCore::CachedResourceLoader::requestLinkResource): (WebCore::CachedResourceLoader::requestMedia): (WebCore::CachedResourceLoader::requestIcon): (WebCore::CachedResourceLoader::requestRawResource): (WebCore::CachedResourceLoader::requestBeaconResource): (WebCore::CachedResourceLoader::requestMainResource): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::preload): * loader/cache/CachedResourceLoader.h: * loader/cache/KeepaliveRequestTracker.cpp: Added. (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker): (WebCore::KeepaliveRequestTracker::canLoadRequest): (WebCore::KeepaliveRequestTracker::registerRequest): (WebCore::KeepaliveRequestTracker::responseReceived): (WebCore::KeepaliveRequestTracker::notifyFinished): (WebCore::KeepaliveRequestTracker::unregisterRequest): * loader/cache/KeepaliveRequestTracker.h: Added. * platform/network/FormData.cpp: (WebCore::FormDataElement::lengthInBytes const): (WebCore::FormData::lengthInBytes const): * platform/network/FormData.h: LayoutTests: * fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt: * http/tests/contentextensions/async-xhr-onerror-expected.txt: * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe-expected.txt: * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame-expected.txt: * http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt: Rebaseline a few tests now that we provide a more helpful error message when an XHR is failing synchronously. * http/wpt/beacon/beacon-quota-expected.txt: Added. * http/wpt/beacon/beacon-quota.html: Added. Add layout test coverage for keepalive Fetch requests quota in the context of sendBeacon(). The second part of the test is still failing because WebCore does not currently know when ping loads (e.g. beacon loads) complete. This will be addressed via Bug 175443. Canonical link: https://commits.webkit.org/192262@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-15 19:35:11 +00:00
void didFail(const ResourceError&) final;
[Fetch API] Implement Fetch redirect mode https://bugs.webkit.org/show_bug.cgi?id=157837 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: * web-platform-tests/fetch/api/redirect/redirect-location.js: * web-platform-tests/fetch/api/redirect/redirect-method.js: * web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: * web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt: Source/WebCore: Implementing step 5 of https://fetch.spec.whatwg.org/#http-fetch. Making ResourceLoaderOptions include FetchOptions. This allows SubresourceLoader to follow or not redirections based on that option. CachedResource is made responsible to handle the type of the response (opaqueredirect, opaque, cors, basic...). If redirection is not to be followed, either an error is returned or an empty response is returned. Moved Response type and redirected flag from FetchResponse to ResourceResponse. This allows CachedResource to easily communicate that information to FetchResponse. Made some clean-up refactoring in ThreadableLoaderOptions. http/tests/fetch/caching-with-different-options.html ensures that caching at CachedResourceLoader will not have bad effects on fetch. Covered by updated and rebased tests. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::startFetching): * Modules/fetch/FetchResponse.h: * WebCore.xcodeproj/project.pbxproj: * loader/FetchOptions.h: Moved from Source/WebCore/Modules/fetch/FetchOptions.h. * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::fetchOptions): (WebCore::ResourceLoaderOptions::setFetchOptions): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/ThreadableLoader.cpp: * loader/ThreadableLoader.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setResponse): * loader/cache/CachedResource.h: (WebCore::CachedResource::setOpaqueRedirect): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::adopt): (WebCore::ResourceResponseBase::copyData): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::type): (WebCore::ResourceResponseBase::setType): (WebCore::ResourceResponseBase::encode): (WebCore::ResourceResponseBase::decode): LayoutTests: * http/tests/fetch/caching-with-different-options-expected.txt: Added. * http/tests/fetch/caching-with-different-options.html: Added. * http/tests/fetch/resources/redirect-with-cache.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt: * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: Canonical link: https://commits.webkit.org/176136@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-24 07:35:09 +00:00
void didReceiveResponse(const ResourceResponse&) final;
Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer https://bugs.webkit.org/show_bug.cgi?id=226623 Reviewed by Darin Adler. Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer. Also have SharedBuffer::data() return a `const uint8_t*` instead of `const char*`. This is our preferred type to store bytes. Source/WebCore: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeFormData): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::packageFormData): (WebCore::resolveWithTypeAndData): * Modules/highlight/AppHighlight.h: (WebCore::AppHighlight::encode const): * Modules/indexeddb/IDBGetResult.cpp: (WebCore::IDBGetResult::dataFromBuffer): * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::serializeIDBKeyData): * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::didReceiveRawData): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannelRemoteHandler.cpp: (WebCore::RTCDataChannelRemoteHandler::didReceiveRawData): (WebCore::RTCDataChannelRemoteHandler::sendRawData): * Modules/mediastream/RTCDataChannelRemoteHandler.h: * Modules/mediastream/RTCDataChannelRemoteSource.h: (WebCore::RTCDataChannelRemoteSource::sendRawData): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::sendRawData): (WebCore::LibWebRTCDataChannelHandler::OnMessage): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): * fileapi/Blob.cpp: (WebCore::Blob::Blob): * fileapi/NetworkSendQueue.cpp: (WebCore::NetworkSendQueue::enqueue): (WebCore::NetworkSendQueue::processMessages): * fileapi/NetworkSendQueue.h: * inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::ResourceData::appendData): (WebCore::NetworkResourcesData::maybeAddResourceData): * inspector/NetworkResourcesData.h: * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveData): * inspector/agents/InspectorPageAgent.cpp: (WebCore::decodeBuffer): (WebCore::InspectorPageAgent::dataContent): * inspector/agents/InspectorPageAgent.h: * loader/ContentFilter.cpp: (WebCore::ContentFilter::deliverResourceData): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::maybeCreateArchive): (WebCore::DocumentLoader::maybeFinishLoadingMultipartContent): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didFinishLoading): (WebCore::DocumentThreadableLoader::loadRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadResourceSynchronously): * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer): * loader/NetscapePlugInStreamLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveDataOrBuffer): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveDataOrBuffer): * loader/TextResourceDecoder.h: (WebCore::TextResourceDecoder::decode): (WebCore::TextResourceDecoder::decodeAndFlush): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::processNewCueData): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory): * loader/archive/mhtml/MHTMLArchive.cpp: (WebCore::MHTMLArchive::generateMHTMLData): * loader/archive/mhtml/MHTMLParser.cpp: (WebCore::MHTMLParser::parseNextPart): * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): (WebCore::CachedRawResource::finishLoading): (WebCore::CachedRawResource::didAddClient): * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::ensureCustomFontData): * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::SharedBuffer): (WebCore::SharedBuffer::create): (WebCore::SharedBuffer::combineIntoOneSegment const): (WebCore::SharedBuffer::data const): (WebCore::SharedBuffer::tryCreateArrayBuffer const): (WebCore::SharedBuffer::append): (WebCore::SharedBuffer::DataSegment::data const): (WebCore::SharedBuffer::DataSegment::size const): (WebCore::SharedBufferDataView::data const): (WebCore::utf8Buffer): * platform/SharedBuffer.h: * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::extractKeyidsLocationFromCencInitData): (WebCore::extractKeyidsFromCencInitData): * platform/graphics/Model.h: (WebCore::Model::encode const): * platform/graphics/displaylists/DisplayListItemBuffer.cpp: (WebCore::DisplayList::ItemBuffer::append): * platform/graphics/gstreamer/eme/CDMThunder.cpp: (WebCore::CDMInstanceThunder::setServerCertificate): (WebCore::ParsedResponseMessage::ParsedResponseMessage): (WebCore::CDMInstanceSessionThunder::errorCallback): (WebCore::CDMInstanceSessionThunder::requestLicense): (WebCore::CDMInstanceSessionThunder::updateLicense): (WebCore::CDMInstanceSessionThunder::loadSession): * platform/graphics/opentype/OpenTypeTypes.h: (WebCore::OpenType::TableBase::isValidEnd): * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelRemoteSourceConnection.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::sendRawData): * platform/mock/RTCDataChannelHandlerMock.h: * platform/network/FormData.cpp: (WebCore::FormData::asSharedBuffer const): * platform/network/ResourceHandleClient.cpp: (WebCore::ResourceHandleClient::didReceiveBuffer): * platform/network/cocoa/RangeResponseGenerator.mm: (WebCore::RangeResponseGenerator::giveResponseToTaskIfBytesInRangeReceived): * platform/text/TextEncoding.h: (WebCore::TextEncoding::decode const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged): * xml/XSLTProcessorLibxslt.cpp: (WebCore::docLoaderFunc): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::OffsetBuffer::OffsetBuffer): Source/WebKit: * Platform/IPC/SharedBufferCopy.h: (IPC::SharedBufferCopy::data const): * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::streamDidReceiveData): (WebKit::PluginControllerProxy::manualStreamDidReceiveData): * Shared/PersistencyUtils.cpp: (WebKit::writeToDisk): * Shared/WebCoreArgumentCoders.cpp: (IPC::tryConvertToShareableResourceHandle): * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::didComplete): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveData): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: (WebKit::RTCDataChannelRemoteManager::sendData): (WebKit::RTCDataChannelRemoteManager::receiveData): (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h: * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::parsePostBuffer): * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::streamDidReceiveData): (WebKit::NetscapePlugin::manualStreamDidReceiveData): * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::didReceiveData): (WebKit::NetscapePluginStream::sendJavaScriptStream): (WebKit::NetscapePluginStream::deliverData): (WebKit::NetscapePluginStream::deliverDataToFile): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData): (WebKit::PDFPlugin::streamDidReceiveData): (WebKit::PDFPlugin::manualStreamDidReceiveData): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::streamDidReceiveData): (WebKit::PluginProxy::manualStreamDidReceiveData): * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::Stream::didReceiveData): (WebKit::PluginView::manualLoadDidReceiveData): * WebProcess/Plugins/PluginView.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::committedLoad): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::bufferForType): Source/WebKitLegacy/mac: * Plugins/Hosted/HostedNetscapePluginStream.h: * Plugins/Hosted/HostedNetscapePluginStream.mm: (WebKit::HostedNetscapePluginStream::didReceiveData): * Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::evaluateJavaScript): * Plugins/Hosted/WebHostedNetscapePluginView.mm: (-[WebHostedNetscapePluginView pluginView:receivedData:]): * Plugins/WebNetscapePluginStream.h: * Plugins/WebNetscapePluginStream.mm: (WebNetscapePluginStream::didReceiveData): * Plugins/WebNetscapePluginView.mm: (-[WebNetscapePluginView pluginView:receivedData:]): (-[WebNetscapePluginView evaluateJavaScriptPluginRequest:]): Tools: * TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp: (TestWebKitAPI::TEST_F): (TestWebKitAPI::checkBuffer): Canonical link: https://commits.webkit.org/238515@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278516 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-05 01:16:43 +00:00
void didReceiveData(const uint8_t*, size_t) final;
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
FetchResponse& m_response;
NotificationCallback m_responseCallback;
FetchResponse should support ConsumeData callback on chunk data is received https://bugs.webkit.org/show_bug.cgi?id=181600 <rdar://problem/36932547> Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https-expected.txt: Added. * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html: Added. * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-body-loaded-in-chunk-worker.js: Added. Source/WebCore: Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream. Refactor to have one consumeBodyReceivedByChunk method for both cases. This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): (WebCore::FetchResponse::BodyLoader::consumeDataByChunk): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyReceivedByChunk): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): Canonical link: https://commits.webkit.org/198120@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-31 04:23:50 +00:00
ConsumeDataByChunkCallback m_consumeDataCallback;
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
std::unique_ptr<FetchLoader> m_loader;
Ref<PendingActivity<FetchResponse>> m_pendingActivity;
Implement wildcard behavior for Cross-Origin-Expose-Headers https://bugs.webkit.org/show_bug.cgi?id=208800 Patch by Rob Buis <rbuis@igalia.com> on 2020-03-12 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Update improved test results and add a test for testing xhr and wildcard behavior for Cross-Origin-Expose-Headers behavior. * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any-expected.txt: * web-platform-tests/fetch/api/cors/cors-expose-star.sub.any.worker-expected.txt: * web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt: * web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-cors-exposed-header-names.https-expected.txt: * web-platform-tests/xhr/cors-expose-star.sub.any-expected.txt: Added. * web-platform-tests/xhr/cors-expose-star.sub.any.html: Added. * web-platform-tests/xhr/cors-expose-star.sub.any.js: Added. (sharedHeaders.string_appeared_here.async_test): (string_appeared_here.async_test): * web-platform-tests/xhr/resources/top.txt: Added. Source/WebCore: Implement wildcard behavior for Cross-Origin-Expose-Headers [1] while also checking for credentials mode. Test: imported/w3c/web-platform-tests/xhr/cors-expose-star.sub.any.html [1] https://fetch.spec.whatwg.org/#ref-for-concept-response-cors-exposed-header-name-list%E2%91%A2 * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::BodyLoader::start): * Modules/fetch/FetchResponse.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didReceiveResponse): (WebCore::DocumentThreadableLoader::didFinishLoading): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::filter): (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting): * platform/network/ResourceResponseBase.h: Canonical link: https://commits.webkit.org/221900@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-12 15:38:01 +00:00
FetchOptions::Credentials m_credentials;
[Fetch API] Add basic loading of resources https://bugs.webkit.org/show_bug.cgi?id=155637 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebasing test expectations. Updating scheme-blob.js to ensure generated test names are stable run after run. * web-platform-tests/fetch/api/basic/accept-header-expected.txt: * web-platform-tests/fetch/api/basic/integrity-expected.txt: * web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt: * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt: * web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt: * web-platform-tests/fetch/api/basic/request-headers-expected.txt: * web-platform-tests/fetch/api/basic/scheme-about-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt: * web-platform-tests/fetch/api/basic/scheme-blob.js: (checkFetchResponse): Deleted. (checkKoUrl): Deleted. * web-platform-tests/fetch/api/basic/scheme-data-expected.txt: * web-platform-tests/fetch/api/basic/scheme-others-expected.txt: * web-platform-tests/fetch/api/basic/stream-response-expected.txt: Source/WebCore: Adding support for basic fetch for Window (no support for Worker yet). A FetchResponse object is created for every fetch task. But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved. Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method. Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise. Tests: http/tests/fetch/closing-while-fetching.html http/tests/fetch/get-response-body-while-loading.html Also covered by rebased tests. * Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching. (WebCore::DOMWindowFetch::fetch): * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer. (WebCore::FetchBody::consumeText): Passing the promise as a reference. (WebCore::blobFromArrayBuffer): Helper routine. (WebCore::FetchBody::fulfillTextPromise): Helper routine. (WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer. (WebCore::FetchBody::loadedAsText): (WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request. (WebCore::FetchBody::extractFromText): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore but will directly call failure callbacks. (WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines. (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer): * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::fill): (WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered. * Modules/fetch/FetchHeaders.h: (WebCore::FetchHeaders::internalHeaders): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::didFailRedirectCheck): * Modules/fetch/FetchLoader.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request. (WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback. (WebCore::FetchResponse::BodyLoader::didFail): Ditto. (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto. (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto. (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto. (WebCore::FetchResponse::BodyLoader::start): Starting fetch loader. (WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader. (WebCore::FetchResponse::stop): Stop loader if any. * Modules/fetch/FetchResponse.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET. (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers. (WebCore::BlobResourceHandle::createAsync): Removing GET verb check. LayoutTests: * TestExpectations: Removed flaky test expectations. * http/tests/fetch/closing-while-fetching-expected.txt: Added. * http/tests/fetch/closing-while-fetching.html: Added. * http/tests/fetch/get-response-body-while-loading-expected.txt: Added. * http/tests/fetch/get-response-body-while-loading.html: Added. * http/tests/resources/download-json-with-delay.php: Added. * platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added. Canonical link: https://commits.webkit.org/173973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-25 14:19:31 +00:00
};
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
mutable std::optional<ResourceResponse> m_filteredResponse;
FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker https://bugs.webkit.org/show_bug.cgi?id=179641 <rdar://problem/35923570> Patch by Youenn Fablet <youenn@apple.com> on 2017-12-08 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https-expected.txt: * web-platform-tests/service-workers/service-worker/fetch-response-taint.https-expected.txt: Source/WebCore: Covered by existing rebased tests. FetchResponse will now store an unfiltered response. If it needs to expose it to JavaScript, it will create a filtered response lazily. This allows service worker to send back to web pages, opaque responses containing every information. Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin. This ensures cross-origin checks to work if service worker returns such a response on a same origin URL. Updated SubresourceLoader to check cross origin service worker responses based on their tainting. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::url const): (WebCore::FetchResponse::filteredResponse const): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::resourceResponse const): * Modules/fetch/FetchResponse.h: (WebCore::FetchResponse::create): Deleted. * dom/Document.cpp: (WebCore::Document::initSecurityContext): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Source/WebKit: * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response. LayoutTests: * TestExpectations: Canonical link: https://commits.webkit.org/196518@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-08 22:41:48 +00:00
ResourceResponse m_internalResponse;
std::unique_ptr<BodyLoader> m_bodyLoader;
[Fetch API] Request and Response url getter should use URL serialization https://bugs.webkit.org/show_bug.cgi?id=159705 Patch by Youenn Fablet <youenn@apple.com> on 2016-07-14 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/fetch/api/basic/response-url-expected.txt: Added. * web-platform-tests/fetch/api/basic/response-url-worker-expected.txt: Added. * web-platform-tests/fetch/api/basic/response-url-worker.html: Added. * web-platform-tests/fetch/api/basic/response-url.html: Added. * web-platform-tests/fetch/api/basic/response-url.js: Added. (checkResponseURL): * web-platform-tests/fetch/api/request/request-init-003.sub-expected.txt: * web-platform-tests/fetch/api/request/request-init-003.sub.html: Source/WebCore: Tests: fetch/fetch-url-serialization.html imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html imported/w3c/web-platform-tests/fetch/api/basic/response-url.html Implementing https://url.spec.whatwg.org/#concept-url-serializer and applying it to Request and Response getter. Adding a temporary routine to compute url cannot-be-a-base-url flag. The parsing routine should store that information in the URL itself. Added tests to cover serialization routine. Failing tests are mostly due to limitations of the URL parser. Tests do not check for URLs with username and password as Request constructor throws with such URLs. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::url): Adding request url serialization, fragment included. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::url): Adding response url serialization, fragment excluded. * Modules/fetch/FetchResponse.h: * platform/URL.cpp: (WebCore::cannotBeABaseURL): Temporary helper function to have a coarse evaluation of url cannot-be-a-base-url flag. (WebCore::URL::serialize): Implementation of https://url.spec.whatwg.org/#concept-url-serializer. * platform/URL.h: (WebCore::URL::hasUser): Helper getter. (WebCore::URL::hasPassword): Ditto. (WebCore::URL::hasQuery): Ditto. (WebCore::URL::hasFragment): Ditto. LayoutTests: * fetch/fetch-url-serialization-expected.txt: Added. * fetch/fetch-url-serialization.html: Added. * fetch/fetch-urls.json: Added. Canonical link: https://commits.webkit.org/177911@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-14 10:14:53 +00:00
mutable String m_responseURL;
Add quota to cache API https://bugs.webkit.org/show_bug.cgi?id=177552 Patch by Youenn Fablet <youenn@apple.com> on 2017-10-09 Reviewed by Alex Christensen. Source/WebCore: Tests: http/wpt/cache-storage/cache-quota.any.html Storing padded opaque response body sizes within FetchResponse and CacheStorageConnection. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. Storing in CacheStorageConnection is needed for handling cloned network fetched created responses. Storing in FetchResponse is needed for handling cloned cache-storage created opaque responses. Adding internals to query and set the fuzzed size of a response. * Modules/cache/CacheStorageConnection.cpp: (WebCore::computeRealBodySize): (WebCore::CacheStorageConnection::computeRecordBodySize): (WebCore::CacheStorageConnection::setResponseBodySizeWithPadding): (WebCore::CacheStorageConnection::responseBodySizeWithPadding const): * Modules/cache/CacheStorageConnection.h: * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::toConnectionRecord): (WebCore::DOMCache::updateRecords): * Modules/cache/DOMCache.h: * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): (WebCore::DOMCacheEngine::Record::copy const): * Modules/cache/DOMCacheEngine.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::toCrossThreadRecordData): (WebCore::fromCrossThreadRecordData): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * testing/Internals.cpp: (WebCore::Internals::setResponseSizeWithPadding): (WebCore::Internals::responseSizeWithPadding const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Adding support for quota checking in CacheStorage::Caches. It is passed to NetworkProcess at creation time. Default quota size is configured to 400Ko by origin per default. This value is suitable for testing. Future patch should raise this default value and allows configuring it. Quota is computed based on the response body size. This size is padded at WebCore for opaque responses. Size is stored persistently as opaque response padded size should remain stable. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. In case of putting several records at the same time, the size of all records is computed so that all records will be written or rejected together. Sending QuotaExceeded error when quota is exceeded. Future effort should allow asking UIProcess for quota extension. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::cacheStoragePerOriginQuota const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::readCachesFromDisk): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::toRecordInformation): (WebKit::CacheStorage::isolatedCopy): (WebKit::CacheStorage::Cache::open): (WebKit::CacheStorage::Cache::storeRecords): (WebKit::CacheStorage::Cache::put): (WebKit::CacheStorage::Cache::writeRecordToDisk): (WebKit::CacheStorage::Cache::updateRecordToDisk): (WebKit::CacheStorage::Cache::removeRecordFromDisk): (WebKit::CacheStorage::Cache::encode): (WebKit::CacheStorage::Cache::decodeRecordHeader): (WebKit::CacheStorage::Cache::decode): * NetworkProcess/cache/CacheStorageEngineCache.h: * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::Caches): (WebKit::CacheStorage::Caches::initialize): (WebKit::CacheStorage::Caches::initializeSize): (WebKit::CacheStorage::Caches::requestSpace): (WebKit::CacheStorage::Caches::writeRecord): (WebKit::CacheStorage::Caches::removeRecord): (WebKit::CacheStorage::Caches::removeCacheEntry): * NetworkProcess/cache/CacheStorageEngineCaches.h: (WebKit::CacheStorage::Caches::create): (WebKit::CacheStorage::Caches::hasEnoughSpace const): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::traverse): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode): (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): LayoutTests: * http/wpt/cache-storage/cache-quota.https.any-expected.txt: Added. * http/wpt/cache-storage/cache-quota.https.any.html: Added. * http/wpt/cache-storage/cache-quota.https.any.js: Added. Canonical link: https://commits.webkit.org/194344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-09 22:17:05 +00:00
// Opaque responses will padd their body size when used with Cache API.
uint64_t m_bodySizeWithPadding { 0 };
uint64_t m_opaqueLoadIdentifier { 0 };
[Fetch API] Implement abortable fetch https://bugs.webkit.org/show_bug.cgi?id=174980 <rdar://problem/46861402> Reviewed by Chris Dumez. LayoutTests/imported/w3c: Fixed tests to run in WebKit CI. Also fixed a bug in a test where the fetch response body is not actually empty. * web-platform-tests/fetch/api/abort/cache.https-expected.txt: * web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt: * web-platform-tests/fetch/api/abort/general.any-expected.txt: * web-platform-tests/fetch/api/abort/general.any.js: * web-platform-tests/fetch/api/abort/general.any.worker-expected.txt: * web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: * web-platform-tests/fetch/api/response/response-consume-stream-expected.txt: Source/WebCore: Add an AbortSignal to FetchRequest. Add support for AbortSignal algorithm. The fetch request signal is added an algorithm to abort the fetch. Update clone algorithm to let signal of the cloned request be following the origin request. Update ReadableStream error handling to return an exception instead of a string. This allows passing an AbortError instead of a TypeError as previously done. Update FetchBodyOwner to store a loading error either as an exception or as a resource error. The latter is used for passing the error from service worker back to the page. The former is used to pass it to ReadableStream or body accessors. Covered by enabled tests. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyConsumer.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): (WebCore::FetchBodyOwner::setLoadingError): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::loadingError const): (WebCore::FetchBodyOwner::loadingException const): * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::error): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchRequestInit.h: (WebCore::FetchRequestInit::hasMembers const): * Modules/fetch/FetchRequestInit.idl: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error): * dom/AbortSignal.cpp: (WebCore::AbortSignal::abort): (WebCore::AbortSignal::follow): * dom/AbortSignal.h: LayoutTests: * TestExpectations: Enable abort tests. Canonical link: https://commits.webkit.org/207672@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-05 00:01:43 +00:00
RefPtr<AbortSignal> m_abortSignal;
[Fetch API] Implement Fetch API Response https://bugs.webkit.org/show_bug.cgi?id=154536 Reviewed by Alex Christensen. LayoutTests/imported/w3c: New tests covering fetch API. * web-platform-tests/fetch/api/response/response-clone-expected.txt: Added. * web-platform-tests/fetch/api/response/response-clone.html: Added. * web-platform-tests/fetch/api/response/response-consume-expected.txt: Added. * web-platform-tests/fetch/api/response/response-consume.html: Added. * web-platform-tests/fetch/api/response/response-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-error.html: Added. * web-platform-tests/fetch/api/response/response-idl-expected.txt: Added. * web-platform-tests/fetch/api/response/response-idl.html: Added. * web-platform-tests/fetch/api/response/response-init-001-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-001.html: Added. * web-platform-tests/fetch/api/response/response-init-002-expected.txt: Added. * web-platform-tests/fetch/api/response/response-init-002.html: Added. * web-platform-tests/fetch/api/response/response-static-error-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-error.html: Added. * web-platform-tests/fetch/api/response/response-static-redirect-expected.txt: Added. * web-platform-tests/fetch/api/response/response-static-redirect.html: Added. Source/WebCore: Tests: imported/w3c/web-platform-tests/fetch/api/response/response-clone.html imported/w3c/web-platform-tests/fetch/api/response/response-consume.html imported/w3c/web-platform-tests/fetch/api/response/response-error.html imported/w3c/web-platform-tests/fetch/api/response/response-idl.html imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html Adding Fetch Response as FetchResponse class. Constructor uses a built-in to pre-process the parameters. Support of body as ReadableStream is missing. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchBody.h: (WebCore::FetchBody::empty): * Modules/fetch/FetchResponse.cpp: Added. (WebCore::JSFetchResponse::body): (WebCore::isRedirectStatus): (WebCore::isNullBodyStatus): (WebCore::FetchResponse::error): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::type): * Modules/fetch/FetchResponse.h: Added. (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::url): (WebCore::FetchResponse::redirected): (WebCore::FetchResponse::status): (WebCore::FetchResponse::ok): (WebCore::FetchResponse::statusText): (WebCore::FetchResponse::headers): (WebCore::FetchResponse::isDisturbed): (WebCore::FetchResponse::arrayBuffer): (WebCore::FetchResponse::formData): (WebCore::FetchResponse::blob): (WebCore::FetchResponse::json): (WebCore::FetchResponse::text): * Modules/fetch/FetchResponse.idl: Added. * Modules/fetch/FetchResponse.js: Added. (initializeFetchResponse): * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreJSBuiltins.cpp: * bindings/js/WebCoreJSBuiltins.h: (WebCore::JSBuiltinFunctions::JSBuiltinFunctions): (WebCore::JSBuiltinFunctions::fetchResponseBuiltins): LayoutTests: Adding Response as constructor in global and worker scopes. * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: Canonical link: https://commits.webkit.org/172752@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-24 21:41:51 +00:00
};
} // namespace WebCore