DOMPromise should only restrict the resolution type
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 May 2016 09:36:00 +0000 (09:36 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 May 2016 09:36:00 +0000 (09:36 +0000)
commitd9274811078771eada976a0822df764c28b89736
tree6b880f34a1224b9a06e20ca6c8734598e3325cca
parente29e26d3c85f8b048920186c20709824b8f99213
DOMPromise should only restrict the resolution type
https://bugs.webkit.org/show_bug.cgi?id=157307

Reviewed by Darin Adler.

Removing from DOMPromise the rejection template parameter.
Supported rejection types are integers (Exception codes) and DOM objects (DOMError typically).

Updated toJS and DeferredWrapper to accept Ref<>&& and RefPtr<>&&.
Previously Ref<>&& were not accepted and only "const RefPtr<>&" was accepted.
This in turn created an unecessary churn count when calling toJS.

Changes also allow in most cases to remove the need for explictly declaring the
rejection/resolution type.

Minor refactoring of FontFaceSet promise handling to use DOMPromise in lieu of DeferredWrapper.

Covered by existing tests.
Changes should not be visible from user scripts.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeText):
(WebCore::blobFromArrayBuffer):
(WebCore::FetchBody::loadingFailed):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::formData):
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::arrayBuffer):
(WebCore::FetchBodyOwner::blob):
(WebCore::FetchBodyOwner::formData):
(WebCore::FetchBodyOwner::json):
(WebCore::FetchBodyOwner::text):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::BodyLoader::didReceiveResponse):
* Modules/fetch/FetchResponse.h:
* Modules/mediastream/MediaDevices.h:
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::didCreateStream):
* Modules/streams/ReadableStreamSource.h:
* Modules/webaudio/AudioContext.h:
* bindings/js/JSDOMBinding.h:
(WebCore::toJS):
(WebCore::jsPair):
* bindings/js/JSDOMPromise.cpp:
(WebCore::fulfillPromiseWithJSON):
* bindings/js/JSDOMPromise.h:
(WebCore::TypeInspector::decltype):
(WebCore::TypeInspector::testIsVector):
(WebCore::TypeInspector::testIsRefOrRefPtr):
(WebCore::DeferredWrapper::resolve):
(WebCore::DeferredWrapper::reject):
(WebCore::DOMPromise::resolve):
(WebCore::DOMPromise::reject):
(WebCore::DeferredWrapper::resolveWithValue):
(WebCore::DeferredWrapper::rejectWithValue):
(WebCore::callPromiseFunction):
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::JSSubtleCrypto::importKey):
(WebCore::JSSubtleCrypto::unwrapKey):
* css/FontFace.h:
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::PendingPromise::PendingPromise):
(WebCore::FontFaceSet::load):
(WebCore::FontFaceSet::registerReady):
* css/FontFaceSet.h:
* html/HTMLMediaElement.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBody.cpp
Source/WebCore/Modules/fetch/FetchBody.h
Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/fetch/FetchResponse.h
Source/WebCore/Modules/mediastream/MediaDevices.h
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/streams/ReadableStreamSource.h
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMPromise.cpp
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
Source/WebCore/css/FontFace.h
Source/WebCore/css/FontFaceSet.cpp
Source/WebCore/css/FontFaceSet.h
Source/WebCore/html/HTMLMediaElement.h