[Bindings] Standardize on DOMPromise as the way to store passed in promises
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 23:31:03 +0000 (23:31 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 23:31:03 +0000 (23:31 +0000)
commit6e4f8a55a98e090caa51722a235d91af52cbea6d
tree70e890a4102d9f50a6f4e6046c7330cb326d9caf
parent9740dec9eef699530bf08f812619a6d173c0d93c
[Bindings] Standardize on DOMPromise as the way to store passed in promises
https://bugs.webkit.org/show_bug.cgi?id=178533

Reviewed by Youenn Fablet.

This standardizes on RefPtr<DOMPromise> as the canonical way to store a promise
that has been passed in from JS. This does not change promises that start off in
WebCore and are passed to JS; they remain using DOMPromiseDeferred and DOMPromiseProxy.

* Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
* Modules/paymentrequest/PaymentRequestUpdateEvent.h:
* dom/PromiseRejectionEvent.cpp:
* dom/PromiseRejectionEvent.h:
* dom/RejectedPromiseTracker.cpp:

    Use a RefPtr<DOMPromise> rather than a JSPromise* to hold onto the promise.

* bindings/IDLTypes.h:

    Use IDLWrapper to get better defaults, since DOMPromise is refcounted.

* bindings/js/JSDOMConvertPromise.h:
(WebCore::Converter<IDLPromise<T>>::convert):

    Switch default conversion to return a RefPtr<DOMPromise> rather than a JSPromise*

(WebCore::JSConverter<IDLPromise<T>>::convert):

    Add support for converting from a DOMPromise to a JSValue.

* bindings/js/JSDOMPromise.cpp:
* bindings/js/JSDOMPromise.h:
(WebCore::DOMPromise::create): Deleted.

    Remove now unused constructor.

* workers/service/ExtendableEvent.cpp:
(WebCore::ExtendableEvent::waitUntil):
* workers/service/ExtendableEvent.h:
* workers/service/ExtendableEvent.idl:
* workers/service/FetchEvent.cpp:
(WebCore::FetchEvent::respondWith):
(WebCore::FetchEvent::promiseIsSettled):
* workers/service/FetchEvent.h:
* workers/service/FetchEvent.idl:

    Address FIXMEs and remove need for passing an ExecState to ExtendableEvent
    and FetchEvent by using the new default conversion to DOMPromise.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/paymentrequest/PaymentRequestUpdateEvent.cpp
Source/WebCore/Modules/paymentrequest/PaymentRequestUpdateEvent.h
Source/WebCore/bindings/IDLTypes.h
Source/WebCore/bindings/js/JSDOMConvertPromise.h
Source/WebCore/bindings/js/JSDOMPromise.cpp
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/dom/PromiseRejectionEvent.cpp
Source/WebCore/dom/PromiseRejectionEvent.h
Source/WebCore/dom/RejectedPromiseTracker.cpp
Source/WebCore/workers/service/ExtendableEvent.cpp
Source/WebCore/workers/service/ExtendableEvent.h
Source/WebCore/workers/service/ExtendableEvent.idl
Source/WebCore/workers/service/FetchEvent.cpp
Source/WebCore/workers/service/FetchEvent.h
Source/WebCore/workers/service/FetchEvent.idl