Title: [208474] trunk/Source/WebCore
Revision
208474
Author
[email protected]
Date
2016-11-09 13:16:44 -0800 (Wed, 09 Nov 2016)

Log Message

[WebIDL] Add proper parsing for Promises
https://bugs.webkit.org/show_bug.cgi?id=164497

Patch by Sam Weinig <[email protected]> on 2016-11-09
Reviewed by Tim Horton.

* bindings/scripts/IDLParser.pm:
(parseNonAnyType):
(parseStringType):
Require Promise types to declare the type they resolve to.

* bindings/js/JSDOMPromise.h:
Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
overload of resolve that takes no arguments when in a DOMPromise<void>.

* Modules/applepay/ApplePaySession.idl:
* Modules/fetch/DOMWindowFetch.idl:
* Modules/fetch/FetchBody.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/fetch/WorkerGlobalScopeFetch.idl:
* Modules/mediastream/MediaDevices.idl:
* Modules/mediastream/MediaStreamTrack.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCStatsReport.idl:
* Modules/streams/ReadableStream.idl:
* Modules/streams/ReadableStreamDefaultReader.idl:
* Modules/streams/ReadableStreamSource.idl:
* Modules/streams/WritableStream.idl:
* Modules/webaudio/AudioContext.idl:
* bindings/scripts/test/TestNode.idl:
* bindings/scripts/test/TestObj.idl:
* crypto/SubtleCrypto.idl:
* crypto/WebKitSubtleCrypto.idl:
* css/FontFace.idl:
* css/FontFaceSet.idl:
* dom/CustomElementRegistry.idl:
* html/HTMLMediaElement.idl:
Update IDLs to specify the resolve type of promise types.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::replaceTrack):
(WebCore::MediaEndpointPeerConnection::replaceTrackTask):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::applyConstraints):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
(WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/streams/ReadableStreamSource.h:
(WebCore::ReadableStreamSource::start):
(WebCore::ReadableStreamSource::pull):
(WebCore::ReadableStreamSource::startFinished):
(WebCore::ReadableStreamSource::pullFinished):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::addReaction):
(WebCore::AudioContext::setState):
(WebCore::AudioContext::suspend):
(WebCore::AudioContext::resume):
(WebCore::AudioContext::close):
* Modules/webaudio/AudioContext.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::rejectPendingPlayPromises):
(WebCore::HTMLMediaElement::resolvePendingPlayPromises):
(WebCore::HTMLMediaElement::play):
* html/HTMLMediaElement.h:
Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
and use the new resolve() overload.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208473 => 208474)


--- trunk/Source/WebCore/ChangeLog	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/ChangeLog	2016-11-09 21:16:44 UTC (rev 208474)
@@ -1,3 +1,75 @@
+2016-11-09  Sam Weinig  <[email protected]>
+
+        [WebIDL] Add proper parsing for Promises
+        https://bugs.webkit.org/show_bug.cgi?id=164497
+
+        Reviewed by Tim Horton.
+
+        * bindings/scripts/IDLParser.pm:
+        (parseNonAnyType):
+        (parseStringType):
+        Require Promise types to declare the type they resolve to.
+        
+        * bindings/js/JSDOMPromise.h:
+        Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
+        overload of resolve that takes no arguments when in a DOMPromise<void>.
+
+        * Modules/applepay/ApplePaySession.idl:
+        * Modules/fetch/DOMWindowFetch.idl:
+        * Modules/fetch/FetchBody.idl:
+        * Modules/fetch/FetchResponse.idl:
+        * Modules/fetch/WorkerGlobalScopeFetch.idl:
+        * Modules/mediastream/MediaDevices.idl:
+        * Modules/mediastream/MediaStreamTrack.idl:
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * Modules/mediastream/RTCRtpSender.idl:
+        * Modules/mediastream/RTCStatsReport.idl:
+        * Modules/streams/ReadableStream.idl:
+        * Modules/streams/ReadableStreamDefaultReader.idl:
+        * Modules/streams/ReadableStreamSource.idl:
+        * Modules/streams/WritableStream.idl:
+        * Modules/webaudio/AudioContext.idl:
+        * bindings/scripts/test/TestNode.idl:
+        * bindings/scripts/test/TestObj.idl:
+        * crypto/SubtleCrypto.idl:
+        * crypto/WebKitSubtleCrypto.idl:
+        * css/FontFace.idl:
+        * css/FontFaceSet.idl:
+        * dom/CustomElementRegistry.idl:
+        * html/HTMLMediaElement.idl:
+        Update IDLs to specify the resolve type of promise types.
+
+        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
+        (WebCore::MediaEndpointPeerConnection::replaceTrack):
+        (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::applyConstraints):
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
+        (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
+        (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
+        * Modules/mediastream/PeerConnectionBackend.h:
+        * Modules/streams/ReadableStreamSource.h:
+        (WebCore::ReadableStreamSource::start):
+        (WebCore::ReadableStreamSource::pull):
+        (WebCore::ReadableStreamSource::startFinished):
+        (WebCore::ReadableStreamSource::pullFinished):
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::addReaction):
+        (WebCore::AudioContext::setState):
+        (WebCore::AudioContext::suspend):
+        (WebCore::AudioContext::resume):
+        (WebCore::AudioContext::close):
+        * Modules/webaudio/AudioContext.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
+        (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
+        (WebCore::HTMLMediaElement::play):
+        * html/HTMLMediaElement.h:
+        Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
+        and use the new resolve() overload.
+
 2016-11-07  Brady Eidson  <[email protected]>
 
         Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -42,8 +42,8 @@
 
     [CallWith=ScriptExecutionContext, MayThrowException] static boolean supportsVersion(unsigned long version);
     [CallWith=ScriptExecutionContext, MayThrowException] static boolean canMakePayments();
-    [CallWith=ScriptExecutionContext, MayThrowException] static Promise canMakePaymentsWithActiveCard(DOMString merchantIdentifier);
-    [CallWith=ScriptExecutionContext, MayThrowException] static Promise openPaymentSetup(DOMString merchantIdentifier);
+    [CallWith=ScriptExecutionContext, MayThrowException] static Promise<boolean> canMakePaymentsWithActiveCard(DOMString merchantIdentifier);
+    [CallWith=ScriptExecutionContext, MayThrowException] static Promise<boolean> openPaymentSetup(DOMString merchantIdentifier);
 
     [MayThrowException] void begin();
     [MayThrowException] void abort();

Modified: trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/fetch/DOMWindowFetch.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -30,7 +30,7 @@
     Conditional=FETCH_API,
     EnabledAtRuntime=FetchAPI,
 ] partial interface DOMWindow {
-    [JSBuiltin] Promise fetch(any input, optional Dictionary init);
+    [JSBuiltin] Promise<Response> fetch(any input, optional Dictionary init);
 
-    [PrivateIdentifier, ImplementedAs=fetch] Promise fetchRequest(FetchRequest request);
+    [PrivateIdentifier, ImplementedAs=fetch] Promise<Response> fetchRequest(FetchRequest request);
 };

Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/fetch/FetchBody.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -35,9 +35,9 @@
 ]
 interface FetchBody {
     [ImplementedAs=isDisturbed] readonly attribute boolean bodyUsed;
-    [NewObject] Promise arrayBuffer();
-    [NewObject] Promise blob();
-    [NewObject] Promise formData();
-    [NewObject] Promise json();
-    [NewObject] Promise text();
+    [NewObject] Promise<ArrayBuffer> arrayBuffer();
+    [NewObject] Promise<Blob> blob();
+    [NewObject] Promise<Blob> formData();
+    [NewObject] Promise<any> json();
+    [NewObject] Promise<USVString> text();
 };

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -54,11 +54,11 @@
 
     // Copy of FetchBody IDL as we want to implement some of these as built-ins.
     [JSBuiltin] readonly attribute boolean bodyUsed;
-    [JSBuiltin] Promise arrayBuffer();
-    [JSBuiltin] Promise blob();
-    [JSBuiltin] Promise formData();
-    [JSBuiltin] Promise json();
-    [JSBuiltin] Promise text();
+    [JSBuiltin] Promise<ArrayBuffer> arrayBuffer();
+    [JSBuiltin] Promise<Blob> blob();
+    [JSBuiltin] Promise<Blob> formData();
+    [JSBuiltin] Promise<any> json();
+    [JSBuiltin] Promise<USVString> text();
 
     [JSBuiltin] FetchResponse clone();
 
@@ -66,9 +66,9 @@
 
     [Conditional=READABLE_STREAM_API, PrivateIdentifier] void startConsumingStream(unsigned short type);
     [Conditional=READABLE_STREAM_API, PrivateIdentifier] void consumeChunk(Uint8Array chunk);
-    [Conditional=READABLE_STREAM_API, PrivateIdentifier] Promise finishConsumingStream();
+    [Conditional=READABLE_STREAM_API, PrivateIdentifier] Promise<any> finishConsumingStream();
 
-    [PrivateIdentifier] Promise consume(unsigned short type);
+    [PrivateIdentifier] Promise<any> consume(unsigned short type);
     [PrivateIdentifier] boolean isLoading();
     [MayThrowException, PrivateIdentifier] void setStatus(unsigned short status, DOMString statusText);
     [CallWith=ScriptState, PrivateIdentifier] void initializeWith(any body);

Modified: trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -30,7 +30,7 @@
     Conditional=FETCH_API,
     EnabledAtRuntime=FetchAPI,
 ] partial interface WorkerGlobalScope {
-    [JSBuiltin] Promise fetch(any input, optional Dictionary init);
+    [JSBuiltin] Promise<Response> fetch(any input, optional Dictionary init);
 
-    [PrivateIdentifier, ImplementedAs=fetch] Promise fetchRequest(FetchRequest request);
+    [PrivateIdentifier, ImplementedAs=fetch] Promise<Response> fetchRequest(FetchRequest request);
 };

Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -34,6 +34,6 @@
 ] interface MediaDevices {
     MediaTrackSupportedConstraints getSupportedConstraints();
 
-    [Custom, MayThrowException, PrivateIdentifier, PublicIdentifier] Promise getUserMedia(Dictionary options);
-    [MayThrowException] Promise enumerateDevices();
+    [Custom, MayThrowException, PrivateIdentifier, PublicIdentifier] Promise<MediaStream> getUserMedia(Dictionary options);
+    [MayThrowException] Promise<sequence<MediaDeviceInfo>> enumerateDevices();
 };

Modified: trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp	2016-11-09 21:16:44 UTC (rev 208474)
@@ -716,7 +716,7 @@
     if (mid.isNull()) {
         // Transceiver is not associated with a media description yet.
         sender.setTrack(WTFMove(withTrack));
-        promise.resolve(nullptr);
+        promise.resolve();
         return;
     }
 
@@ -733,7 +733,7 @@
     m_mediaEndpoint->replaceSendSource(withTrack->source(), mid);
 
     sender.setTrack(WTFMove(withTrack));
-    promise.resolve(nullptr);
+    promise.resolve();
 }
 
 void MediaEndpointPeerConnection::doStop()

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2016-11-09 21:16:44 UTC (rev 208474)
@@ -169,7 +169,7 @@
     return m_private->capabilities();
 }
 
-void MediaStreamTrack::applyConstraints(Ref<MediaConstraints>&& constraints, ApplyConstraintsPromise&& promise)
+void MediaStreamTrack::applyConstraints(Ref<MediaConstraints>&& constraints, DOMPromise<void>&& promise)
 {
     if (!constraints->isValid()) {
         promise.reject(TypeError);
@@ -196,7 +196,7 @@
         if (!weakThis || !weakThis->m_promise)
             return;
 
-        weakThis->m_promise->resolve(nullptr);
+        weakThis->m_promise->resolve();
     };
 
     m_private->applyConstraints(constraints, successHandler, failureHandler);

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -82,8 +82,7 @@
     RefPtr<MediaSourceSettings> getSettings() const;
     RefPtr<RealtimeMediaSourceCapabilities> getCapabilities() const;
 
-    using ApplyConstraintsPromise = DOMPromise<std::nullptr_t>;
-    void applyConstraints(Ref<MediaConstraints>&&, ApplyConstraintsPromise&&);
+    void applyConstraints(Ref<MediaConstraints>&&, DOMPromise<void>&&);
     void applyConstraints(const MediaConstraints&);
 
     RealtimeMediaSource& source() const { return m_private->source(); }
@@ -128,7 +127,7 @@
     Ref<MediaStreamTrackPrivate> m_private;
 
     RefPtr<MediaConstraints> m_constraints;
-    Optional<ApplyConstraintsPromise> m_promise;
+    Optional<DOMPromise<void>> m_promise;
     WeakPtrFactory<MediaStreamTrack> m_weakPtrFactory;
 
     bool m_ended { false };

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -50,7 +50,7 @@
     [Custom] MediaTrackConstraints getConstraints();
     [Custom] MediaSourceSettings getSettings();
     [Custom] MediaTrackCapabilities getCapabilities();
-    [Custom] Promise applyConstraints(Dictionary? constraints);
+    [Custom] Promise<void> applyConstraints(optional MediaTrackConstraints constraints);
 
     attribute EventHandler onoverconstrained;
 };

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2016-11-09 21:16:44 UTC (rev 208474)
@@ -148,7 +148,7 @@
 
     ASSERT(m_setDescriptionPromise);
 
-    m_setDescriptionPromise->resolve(nullptr);
+    m_setDescriptionPromise->resolve();
     m_setDescriptionPromise = Nullopt;
 }
 
@@ -206,7 +206,7 @@
 
     ASSERT(m_setDescriptionPromise);
 
-    m_setDescriptionPromise->resolve(nullptr);
+    m_setDescriptionPromise->resolve();
     m_setDescriptionPromise = Nullopt;
 }
 
@@ -245,7 +245,7 @@
     // FIXME: Update remote description and set ICE connection state to checking if not already done so.
     ASSERT(m_addIceCandidatePromise);
 
-    m_addIceCandidatePromise->resolve(nullptr);
+    m_addIceCandidatePromise->resolve();
     m_addIceCandidatePromise = Nullopt;
 }
 

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -58,7 +58,7 @@
 
 namespace PeerConnection {
 typedef DOMPromise<RTCSessionDescription> SessionDescriptionPromise;
-typedef DOMPromise<std::nullptr_t> VoidPromise;
+typedef DOMPromise<void> VoidPromise;
 typedef DOMPromise<RTCStatsResponse> StatsPromise;
 }
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -70,18 +70,18 @@
     [JSBuiltin] void addStream(MediaStream stream);
     [JSBuiltin] void removeStream(MediaStream stream);
 
-    [JSBuiltin] Promise createOffer(optional RTCOfferOptions offerOptions);
-    // Legacy signature: Promise createOffer(RTCSessionDescriptionCallback successCallback
+    [JSBuiltin] Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions offerOptions);
+    // Legacy signature: Promise<void> createOffer(RTCSessionDescriptionCallback successCallback
     //                                       RTCPeerConnectionErrorCallback errorCallback,
     //                                       optional Dictionary offerOptions);
 
-    [JSBuiltin] Promise createAnswer(optional RTCAnswerOptions answerOptions);
-    // Legacy signature: Promise createAnswer(RTCSessionDescriptionCallback successCallback
+    [JSBuiltin] Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions answerOptions);
+    // Legacy signature: Promise<void> createAnswer(RTCSessionDescriptionCallback successCallback
     //                                        RTCPeerConnectionErrorCallback errorCallback,
     //                                        optional Dictionary answerOptions);
 
-    [JSBuiltin] Promise setLocalDescription(RTCSessionDescription description);
-    // Legacy signature: Promise setLocalDescription(RTCSessionDescription description
+    [JSBuiltin] Promise<void> setLocalDescription(RTCSessionDescription description);
+    // Legacy signature: Promise<void> setLocalDescription(RTCSessionDescription description
     //                                               VoidCallback successCallback,
     //                                               RTCPeerConnectionErrorCallback errorCallback);
 
@@ -89,8 +89,8 @@
     readonly attribute RTCSessionDescription currentLocalDescription;
     readonly attribute RTCSessionDescription pendingLocalDescription;
 
-    [JSBuiltin] Promise setRemoteDescription(RTCSessionDescription description);
-    // Legacy signature: Promise setRemoteDescription(RTCSessionDescription description
+    [JSBuiltin] Promise<void> setRemoteDescription(RTCSessionDescription description);
+    // Legacy signature: Promise<void> setRemoteDescription(RTCSessionDescription description
     //                                                VoidCallback successCallback,
     //                                                RTCPeerConnectionErrorCallback errorCallback);
 
@@ -100,8 +100,8 @@
 
     readonly attribute DOMString signalingState;
 
-    [JSBuiltin] Promise addIceCandidate(RTCIceCandidate candidate);
-    // Legacy signature: Promise addIceCandidate(RTCIceCandidate candidate
+    [JSBuiltin] Promise<void> addIceCandidate(RTCIceCandidate candidate);
+    // Legacy signature: Promise<void> addIceCandidate(RTCIceCandidate candidate
     //                                           VoidCallback successCallback,
     //                                           RTCPeerConnectionErrorCallback errorCallback);
 
@@ -111,19 +111,19 @@
     RTCConfiguration getConfiguration();
     [MayThrowException] void setConfiguration(Dictionary configuration);
 
-    [JSBuiltin] Promise getStats(optional MediaStreamTrack? selector = null);
-    // Legacy signature: Promise getStats(MediaStreamTrack? selector
+    [JSBuiltin] Promise<RTCStatsReport> getStats(optional MediaStreamTrack? selector = null);
+    // Legacy signature: Promise<void> getStats(MediaStreamTrack? selector
     //                                    RTCStatsCallback successCallback,
     //                                    RTCPeerConnectionErrorCallback errorCallback);
 
     // Private API used to implement the overloaded operations above. Queued functions are called by
     // runQueuedOperation() (defined in RTCPeerConnectionInternals.js).
-    [PrivateIdentifier] Promise queuedCreateOffer(optional RTCOfferOptions offerOptions);
-    [PrivateIdentifier] Promise queuedCreateAnswer(optional RTCAnswerOptions answerOptions);
-    [PrivateIdentifier] Promise queuedSetLocalDescription(RTCSessionDescription description);
-    [PrivateIdentifier] Promise queuedSetRemoteDescription(RTCSessionDescription description);
-    [PrivateIdentifier] Promise queuedAddIceCandidate(RTCIceCandidate candidate);
-    [PrivateIdentifier] Promise privateGetStats(MediaStreamTrack? selector);
+    [PrivateIdentifier] Promise<RTCSessionDescriptionInit> queuedCreateOffer(optional RTCOfferOptions offerOptions);
+    [PrivateIdentifier] Promise<RTCSessionDescriptionInit> queuedCreateAnswer(optional RTCAnswerOptions answerOptions);
+    [PrivateIdentifier] Promise<void> queuedSetLocalDescription(RTCSessionDescription description);
+    [PrivateIdentifier] Promise<void> queuedSetRemoteDescription(RTCSessionDescription description);
+    [PrivateIdentifier] Promise<void> queuedAddIceCandidate(RTCIceCandidate candidate);
+    [PrivateIdentifier] Promise<RTCStatsReport> privateGetStats(MediaStreamTrack? selector);
 
     [MayThrowException] RTCDataChannel createDataChannel([TreatNullAs=EmptyString] DOMString label, optional Dictionary options);
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -33,5 +33,5 @@
 ] interface RTCRtpSender {
     readonly attribute MediaStreamTrack? track;
 
-    [MayThrowException] Promise replaceTrack(MediaStreamTrack withTrack);
+    [MayThrowException] Promise<void> replaceTrack(MediaStreamTrack withTrack);
 };

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -32,6 +32,7 @@
     readonly attribute DOMString type;
     DOMString stat(DOMString name);
     sequence<DOMString> names();
+
     // DEPRECATED - fake for old RTCStatsElement object.
     readonly attribute RTCStatsReport local;
     readonly attribute RTCStatsReport remote;

Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/streams/ReadableStream.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -35,9 +35,9 @@
     PrivateIdentifier,
     PublicIdentifier
 ] interface ReadableStream {
-    [NotEnumerable] Promise cancel(optional any reason);
+    [NotEnumerable] Promise<any> cancel(optional any reason);
     [NotEnumerable] Object getReader(optional any options);
-    [NotEnumerable] Promise pipeTo(any streams, optional any options);
+    [NotEnumerable] Promise<any> pipeTo(any streams, optional any options);
     [NotEnumerable] Object pipeThrough(any dest, any options);
     [NotEnumerable] Object tee();
 

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -34,9 +34,9 @@
     JSBuiltin,
     NoInterfaceObject
 ] interface ReadableStreamDefaultReader {
-    [NotEnumerable] Promise read();
-    [NotEnumerable] Promise cancel(optional any reason);
+    [NotEnumerable] Promise<any> read();
+    [NotEnumerable] Promise<any> cancel(optional any reason);
     [NotEnumerable] void releaseLock();
 
-    [NotEnumerable] readonly attribute Promise closed;
+    [NotEnumerable] readonly attribute Promise<boolean> closed;
 };

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h (208473 => 208474)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -42,10 +42,8 @@
 public:
     virtual ~ReadableStreamSource() { }
 
-    typedef DOMPromise<std::nullptr_t> Promise;
-
-    void start(ReadableStreamDefaultController&&, Promise&&);
-    void pull(Promise&&);
+    void start(ReadableStreamDefaultController&&, DOMPromise<void>&&);
+    void pull(DOMPromise<void>&&);
     void cancel(JSC::JSValue);
 
     bool isPulling() const { return !!m_promise; }
@@ -67,11 +65,11 @@
     virtual void doCancel() = 0;
 
 private:
-    Optional<Promise> m_promise;
+    Optional<DOMPromise<void>> m_promise;
     Optional<ReadableStreamDefaultController> m_controller;
 };
 
-inline void ReadableStreamSource::start(ReadableStreamDefaultController&& controller, Promise&& promise)
+inline void ReadableStreamSource::start(ReadableStreamDefaultController&& controller, DOMPromise<void>&& promise)
 {
     ASSERT(!m_promise);
     m_promise = WTFMove(promise);
@@ -81,7 +79,7 @@
     doStart();
 }
 
-inline void ReadableStreamSource::pull(Promise&& promise)
+inline void ReadableStreamSource::pull(DOMPromise<void>&& promise)
 {
     ASSERT(!m_promise);
     ASSERT(m_controller);
@@ -95,7 +93,7 @@
 inline void ReadableStreamSource::startFinished()
 {
     ASSERT(m_promise);
-    std::exchange(m_promise, Nullopt).value().resolve(nullptr);
+    std::exchange(m_promise, Nullopt).value().resolve();
     setInactive();
 }
 
@@ -102,7 +100,7 @@
 inline void ReadableStreamSource::pullFinished()
 {
     ASSERT(m_promise);
-    std::exchange(m_promise, Nullopt).value().resolve(nullptr);
+    std::exchange(m_promise, Nullopt).value().resolve();
     setInactive();
 }
 

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamSource.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamSource.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamSource.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -31,8 +31,8 @@
     Conditional=READABLE_STREAM_API,
     SkipVTableValidation
 ] interface ReadableStreamSource {
-    [Custom] Promise start(ReadableStreamDefaultController controller);
-    [Custom] Promise pull(ReadableStreamDefaultController controller);
+    [Custom] Promise<void> start(ReadableStreamDefaultController controller);
+    [Custom] Promise<void> pull(ReadableStreamDefaultController controller);
     void cancel(any reason);
 
     // Place holder to keep the controller linked to the source.

Modified: trunk/Source/WebCore/Modules/streams/WritableStream.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/streams/WritableStream.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/streams/WritableStream.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -32,11 +32,11 @@
     Constructor,
     JSBuiltin
 ] interface WritableStream {
-    Promise abort(optional any reason);
-    Promise close();
-    Promise write(any chunk);
+    Promise<any> abort(optional any reason);
+    Promise<any> close();
+    Promise<any> write(any chunk);
 
-    readonly attribute Promise closed;
-    readonly attribute Promise ready;
+    readonly attribute Promise<boolean> closed;
+    readonly attribute Promise<boolean> ready;
     readonly attribute DOMString state;
 };

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (208473 => 208474)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-11-09 21:16:44 UTC (rev 208474)
@@ -280,7 +280,7 @@
     return m_isInitialized;
 }
 
-void AudioContext::addReaction(State state, Promise&& promise)
+void AudioContext::addReaction(State state, DOMPromise<void>&& promise)
 {
     size_t stateIndex = static_cast<size_t>(state);
     if (stateIndex >= m_stateReactions.size())
@@ -301,11 +301,11 @@
     if (stateIndex >= m_stateReactions.size())
         return;
 
-    Vector<Promise> reactions;
+    Vector<DOMPromise<void>> reactions;
     m_stateReactions[stateIndex].swap(reactions);
 
     for (auto& promise : reactions)
-        promise.resolve(nullptr);
+        promise.resolve();
 }
 
 void AudioContext::stop()
@@ -1017,7 +1017,7 @@
     --m_activeSourceCount;
 }
 
-void AudioContext::suspend(Promise&& promise)
+void AudioContext::suspend(DOMPromise<void>&& promise)
 {
     if (isOfflineContext()) {
         promise.reject(INVALID_STATE_ERR);
@@ -1025,7 +1025,7 @@
     }
 
     if (m_state == State::Suspended) {
-        promise.resolve(nullptr);
+        promise.resolve();
         return;
     }
 
@@ -1046,7 +1046,7 @@
     });
 }
 
-void AudioContext::resume(Promise&& promise)
+void AudioContext::resume(DOMPromise<void>&& promise)
 {
     if (isOfflineContext()) {
         promise.reject(INVALID_STATE_ERR);
@@ -1054,7 +1054,7 @@
     }
 
     if (m_state == State::Running) {
-        promise.resolve(nullptr);
+        promise.resolve();
         return;
     }
 
@@ -1075,7 +1075,7 @@
     });
 }
 
-void AudioContext::close(Promise&& promise)
+void AudioContext::close(DOMPromise<void>&& promise)
 {
     if (isOfflineContext()) {
         promise.reject(INVALID_STATE_ERR);
@@ -1083,7 +1083,7 @@
     }
 
     if (m_state == State::Closed || !m_destinationNode) {
-        promise.resolve(nullptr);
+        promise.resolve();
         return;
     }
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.h (208473 => 208474)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -109,12 +109,10 @@
     using ActiveDOMObject::suspend;
     using ActiveDOMObject::resume;
 
-    typedef DOMPromise<std::nullptr_t> Promise;
+    void suspend(DOMPromise<void>&&);
+    void resume(DOMPromise<void>&&);
+    void close(DOMPromise<void>&&);
 
-    void suspend(Promise&&);
-    void resume(Promise&&);
-    void close(Promise&&);
-
     enum class State { Suspended, Running, Interrupted, Closed };
     State state() const;
 
@@ -326,7 +324,7 @@
     void handleDirtyAudioSummingJunctions();
     void handleDirtyAudioNodeOutputs();
 
-    void addReaction(State, Promise&&);
+    void addReaction(State, DOMPromise<void>&&);
     void updateAutomaticPullNodes();
 
     // Only accessed in the audio thread.
@@ -363,7 +361,7 @@
     Vector<AudioNode*> m_renderingAutomaticPullNodes;
     // Only accessed in the audio thread.
     Vector<AudioNode*> m_deferredFinishDerefList;
-    Vector<Vector<Promise>> m_stateReactions;
+    Vector<Vector<DOMPromise<void>>> m_stateReactions;
 
     std::unique_ptr<PlatformMediaSession> m_mediaSession;
     std::unique_ptr<GenericEventQueue> m_eventQueue;

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (208473 => 208474)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -51,9 +51,9 @@
     // All panning is relative to this listener.
     readonly attribute AudioListener listener;
 
-    Promise suspend();
-    Promise resume();
-    Promise close();
+    Promise<void> suspend();
+    Promise<void> resume();
+    Promise<void> close();
 
     readonly attribute AudioContextState state;
     attribute EventHandler onstatechange;

Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (208473 => 208474)


--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -65,6 +65,12 @@
     typedef DOMClass& Type;
 };
 
+template<>
+struct PromiseResultInspector<void> {
+public:
+    typedef int Type;
+};
+
 template<typename DOMClass>
 struct PromiseResultInspector<DOMClass, typename std::enable_if<TypeInspector<DOMClass>::isPassByValueType>::type> {
 public:
@@ -197,8 +203,7 @@
 }
 
 // At the moment, Value cannot be a Ref<T> or RefPtr<T>, it should be a DOM class.
-template <typename Value>
-class DOMPromise {
+template<typename Value> class DOMPromise {
 public:
     DOMPromise(Ref<DeferredPromise>&& genericPromise) : m_promiseDeferred(WTFMove(genericPromise)) { }
 
@@ -207,8 +212,12 @@
     DOMPromise(const DOMPromise&) = default;
     DOMPromise& operator=(DOMPromise const&) = default;
 
-    void resolve(typename PromiseResultInspector<Value>::Type value) { m_promiseDeferred->resolve(value); }
+    template<typename T = Value>
+    typename std::enable_if<!std::is_void<T>::value, void>::type resolve(typename PromiseResultInspector<Value>::Type value) { m_promiseDeferred->resolve(value); }
 
+    template<typename T = Value>
+    typename std::enable_if<std::is_void<T>::value, void>::type resolve() { m_promiseDeferred->resolve(nullptr); }
+
     template<typename... ErrorType> void reject(ErrorType&&... error) { m_promiseDeferred->reject(std::forward<ErrorType>(error)...); }
 
     JSC::JSValue promise() const { return m_promiseDeferred->promise(); };

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (208473 => 208474)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2016-11-09 21:16:44 UTC (rev 208474)
@@ -414,6 +414,7 @@
 my $nextPrimitiveType_2 = '^(double|float|unrestricted)$';
 my $nextArgumentList_1 = '^(\(|ByteString|DOMString|USVString|Date|\[|any|boolean|byte|double|float|in|long|object|octet|optional|sequence|short|unrestricted|unsigned)$';
 my $nextNonAnyType_1 = '^(boolean|byte|double|float|long|octet|short|unrestricted|unsigned)$';
+my $nextStringType_1 = '^(ByteString|DOMString|USVString)$';
 my $nextInterfaceMember_1 = '^(\(|ByteString|DOMString|USVString|Date|any|attribute|boolean|byte|creator|deleter|double|float|getter|inherit|legacycaller|long|object|octet|readonly|sequence|serializer|setter|short|static|stringifier|unrestricted|unsigned|void)$';
 my $nextAttributeOrOperation_1 = '^(static|stringifier)$';
 my $nextAttributeOrOperation_2 = '^(\(|ByteString|DOMString|USVString|Date|any|boolean|byte|creator|deleter|double|float|getter|legacycaller|long|object|octet|sequence|setter|short|unrestricted|unsigned|void)$';
@@ -2061,24 +2062,10 @@
         $type->name($self->parsePrimitiveType());
         return $type;
     }
-    if ($next->value() eq "ByteString") {
-        $self->assertTokenValue($self->getToken(), "ByteString", __LINE__);
-
-        $type->name("ByteString");
+    if ($next->value() =~ /$nextStringType_1/) {
+        $type->name($self->parseStringType());
         return $type;
     }
-    if ($next->value() eq "DOMString") {
-        $self->assertTokenValue($self->getToken(), "DOMString", __LINE__);
-
-        $type->name("DOMString");
-        return $type;
-    }
-    if ($next->value() eq "USVString") {
-        $self->assertTokenValue($self->getToken(), "USVString", __LINE__);
-
-        $type->name("USVString");
-        return $type;
-    }
     if ($next->value() eq "object") {
         $self->assertTokenValue($self->getToken(), "object", __LINE__);
 
@@ -2137,6 +2124,20 @@
 
         return $type;
     }
+    if ($next->value() eq "Promise") {
+        $self->assertTokenValue($self->getToken(), "Promise", __LINE__);
+        $self->assertTokenValue($self->getToken(), "<", __LINE__);
+
+        my $subtype = $self->parseReturnType();
+        my $subtypeName = $subtype->name;
+
+        $self->assertTokenValue($self->getToken(), ">", __LINE__);
+
+        $type->name("Promise");
+        push(@{$type->subtypes}, $subtype);
+
+        return $type;
+    }
     if ($next->type() == IdentifierToken) {
         my $identifier = $self->getToken();
 
@@ -2169,6 +2170,25 @@
     $self->assertUnexpectedToken($next->value(), __LINE__);
 }
 
+sub parseStringType
+{
+    my $self = shift;
+    my $next = $self->nextToken();
+    if ($next->value() eq "ByteString") {
+        $self->assertTokenValue($self->getToken(), "ByteString", __LINE__);
+        return "ByteString";
+    }
+    if ($next->value() eq "DOMString") {
+        $self->assertTokenValue($self->getToken(), "DOMString", __LINE__);
+        return "DOMString";
+    }
+    if ($next->value() eq "USVString") {
+        $self->assertTokenValue($self->getToken(), "USVString", __LINE__);
+        return "USVString";
+    }
+    $self->assertUnexpectedToken($next->value(), __LINE__);
+}
+
 sub parsePrimitiveType
 {
     my $self = shift;

Modified: trunk/Source/WebCore/bindings/scripts/test/TestNode.idl (208473 => 208474)


--- trunk/Source/WebCore/bindings/scripts/test/TestNode.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/bindings/scripts/test/TestNode.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -26,7 +26,7 @@
     attribute DOMString name;
 
     [EnabledAtRuntime=DOMIterator] iterable<TestNode>;
-    Promise testWorkerPromise();
+    Promise<void> testWorkerPromise();
 
     serializer;
 };

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (208473 => 208474)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -403,17 +403,17 @@
     void _any(unrestricted float a, long b);
 
 
-    readonly attribute Promise testReadOnlyPromiseAttribute;
+    readonly attribute Promise<void> testReadOnlyPromiseAttribute;
     // Promise function
-    Promise testPromiseFunction();
-    Promise testPromiseFunctionWithFloatArgument(float a);
-    [MayThrowLegacyException] Promise testPromiseFunctionWithException();
-    Promise testPromiseFunctionWithOptionalIntArgument(optional long a);
-    Promise testPromiseOverloadedFunction(float a);
-    Promise testPromiseOverloadedFunction(FetchRequest request);
-    static Promise testStaticPromiseFunction();
-    [MayThrowLegacyException] static Promise testStaticPromiseFunctionWithException();
-    [Custom] Promise testCustomPromiseFunction();
+    Promise<void> testPromiseFunction();
+    Promise<void> testPromiseFunctionWithFloatArgument(float a);
+    [MayThrowLegacyException] Promise<void> testPromiseFunctionWithException();
+    Promise<void> testPromiseFunctionWithOptionalIntArgument(optional long a);
+    Promise<void> testPromiseOverloadedFunction(float a);
+    Promise<void> testPromiseOverloadedFunction(FetchRequest request);
+    static Promise<void> testStaticPromiseFunction();
+    [MayThrowLegacyException] static Promise<void> testStaticPromiseFunctionWithException();
+    [Custom] Promise<void> testCustomPromiseFunction();
 
     // PutForwards
     [PutForwards=name] readonly attribute TestNode putForwardsAttribute;

Modified: trunk/Source/WebCore/crypto/SubtleCrypto.idl (208473 => 208474)


--- trunk/Source/WebCore/crypto/SubtleCrypto.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/crypto/SubtleCrypto.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -29,5 +29,6 @@
     GenerateIsReachable=ImplScriptExecutionContext,
     NoInterfaceObject,
 ] interface SubtleCrypto {
-    [Custom] Promise generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
+    // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
+    [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
 };

Modified: trunk/Source/WebCore/crypto/WebKitSubtleCrypto.idl (208473 => 208474)


--- trunk/Source/WebCore/crypto/WebKitSubtleCrypto.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/crypto/WebKitSubtleCrypto.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -28,14 +28,14 @@
     GenerateIsReachable=ImplDocument,
     NoInterfaceObject,
 ] interface WebKitSubtleCrypto {
-    [Custom] Promise encrypt(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
-    [Custom] Promise decrypt(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
-    [Custom] Promise sign(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
-    [Custom] Promise verify(AlgorithmIdentifier algorithm, Key key, CryptoOperationData signature, sequence<CryptoOperationData> data);
-    [Custom] Promise digest(AlgorithmIdentifier algorithm, sequence<CryptoOperationData> data);
-    [Custom] Promise generateKey(AlgorithmIdentifier algorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
-    [Custom] Promise importKey(KeyFormat format, CryptoOperationData keyData, AlgorithmIdentifier? algorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
-    [Custom] Promise exportKey(KeyFormat format, Key key);
-    [Custom] Promise wrapKey(KeyFormat format, Key key, Key wrappingKey, AlgorithmIdentifier wrapAlgorithm);
-    [Custom] Promise unwrapKey(KeyFormat format, CryptoOperationData wrappedKey, Key unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, AlgorithmIdentifier? unwrappedKeyAlgorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
+    [Custom] Promise<ArrayBuffer> encrypt(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
+    [Custom] Promise<ArrayBuffer> decrypt(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
+    [Custom] Promise<ArrayBuffer> sign(AlgorithmIdentifier algorithm, Key key, sequence<CryptoOperationData> data);
+    [Custom] Promise<boolean> verify(AlgorithmIdentifier algorithm, Key key, CryptoOperationData signature, sequence<CryptoOperationData> data);
+    [Custom] Promise<ArrayBuffer> digest(AlgorithmIdentifier algorithm, sequence<CryptoOperationData> data);
+    [Custom] Promise<(CryptoKey or CryptoKeyPair)> generateKey(AlgorithmIdentifier algorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
+    [Custom] Promise<CryptoKey> importKey(KeyFormat format, CryptoOperationData keyData, AlgorithmIdentifier? algorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
+    [Custom] Promise<ArrayBuffer> exportKey(KeyFormat format, Key key);
+    [Custom] Promise<ArrayBuffer> wrapKey(KeyFormat format, Key key, Key wrappingKey, AlgorithmIdentifier wrapAlgorithm);
+    [Custom] Promise<CryptoKey> unwrapKey(KeyFormat format, CryptoOperationData wrappedKey, Key unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, AlgorithmIdentifier? unwrappedKeyAlgorithm, optional boolean extractable, optional sequence<KeyUsage> keyUsages);
 };

Modified: trunk/Source/WebCore/css/FontFace.idl (208473 => 208474)


--- trunk/Source/WebCore/css/FontFace.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/css/FontFace.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -54,6 +54,6 @@
 
     readonly attribute FontFaceLoadStatus status;
 
-    [Custom] Promise load();
-    [CachedAttribute, CustomGetter] readonly attribute Object loaded;
+    [Custom] Promise<FontFace> load();
+    [CachedAttribute, CustomGetter] readonly attribute Promise<FontFace> loaded;
 };

Modified: trunk/Source/WebCore/css/FontFaceSet.idl (208473 => 208474)


--- trunk/Source/WebCore/css/FontFaceSet.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/css/FontFaceSet.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -47,9 +47,9 @@
     attribute EventHandler onloadingdone;
     attribute EventHandler onloadingerror;
 
-    Promise load(DOMString font, optional DOMString text = " ");
+    Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " ");
     [MayThrowException] boolean check(DOMString font, optional DOMString text = " ");
 
-    [CustomGetter, CachedAttribute] readonly attribute Promise ready;
+    [CustomGetter, CachedAttribute] readonly attribute Promise<FontFaceSet> ready;
     readonly attribute FontFaceSetLoadStatus status;
 };

Modified: trunk/Source/WebCore/dom/CustomElementRegistry.idl (208473 => 208474)


--- trunk/Source/WebCore/dom/CustomElementRegistry.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -30,5 +30,5 @@
 ] interface CustomElementRegistry {
     [CEReactions, Custom] void define(DOMString name, Function constructor);
     any get(DOMString name);
-    [Custom, MayThrowException] Promise whenDefined(DOMString name);
+    [Custom, MayThrowException] Promise<void> whenDefined(DOMString name);
 };

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (208473 => 208474)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-11-09 21:16:44 UTC (rev 208474)
@@ -959,7 +959,7 @@
 
 void HTMLMediaElement::rejectPendingPlayPromises(DOMError& error)
 {
-    Vector<PlayPromise> pendingPlayPromises = WTFMove(m_pendingPlayPromises);
+    Vector<DOMPromise<void>> pendingPlayPromises = WTFMove(m_pendingPlayPromises);
 
     for (auto& promise : pendingPlayPromises)
         promise.reject(error);
@@ -967,10 +967,10 @@
 
 void HTMLMediaElement::resolvePendingPlayPromises()
 {
-    Vector<PlayPromise> pendingPlayPromises = WTFMove(m_pendingPlayPromises);
+    Vector<DOMPromise<void>> pendingPlayPromises = WTFMove(m_pendingPlayPromises);
 
     for (auto& promise : pendingPlayPromises)
-        promise.resolve(nullptr);
+        promise.resolve();
 }
 
 void HTMLMediaElement::scheduleNotifyAboutPlaying()
@@ -3025,7 +3025,7 @@
     setAttributeWithoutSynchronization(preloadAttr, preload);
 }
 
-void HTMLMediaElement::play(PlayPromise&& promise)
+void HTMLMediaElement::play(DOMPromise<void>&& promise)
 {
     LOG(Media, "HTMLMediaElement::play(%p)", this);
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (208473 => 208474)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2016-11-09 21:16:44 UTC (rev 208474)
@@ -216,8 +216,7 @@
     bool loop() const;
     void setLoop(bool b);
 
-    typedef DOMPromise<std::nullptr_t> PlayPromise;
-    void play(PlayPromise&&);
+    void play(DOMPromise<void>&&);
 
     WEBCORE_EXPORT void play() override;
     WEBCORE_EXPORT void pause() override;
@@ -820,7 +819,7 @@
     RefPtr<TimeRanges> m_playedTimeRanges;
     GenericEventQueue m_asyncEventQueue;
 
-    Vector<PlayPromise> m_pendingPlayPromises;
+    Vector<DOMPromise<void>> m_pendingPlayPromises;
 
     double m_requestedPlaybackRate { 1 };
     double m_reportedPlaybackRate { 1 };

Modified: trunk/Source/WebCore/html/HTMLMediaElement.idl (208473 => 208474)


--- trunk/Source/WebCore/html/HTMLMediaElement.idl	2016-11-09 21:12:23 UTC (rev 208473)
+++ trunk/Source/WebCore/html/HTMLMediaElement.idl	2016-11-09 21:16:44 UTC (rev 208474)
@@ -71,7 +71,7 @@
     readonly attribute boolean ended;
     [Reflect] attribute boolean autoplay;
     [Reflect] attribute boolean loop;
-    Promise play();
+    Promise<void> play();
     void pause();
     void fastSeek(unrestricted double time);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to