Skip to content
Commit 7817ee1e authored by weinig@apple.com's avatar weinig@apple.com
Browse files

[JS] Implement Promise.all()

https://bugs.webkit.org/show_bug.cgi?id=126510

Reviewed by Gavin Barraclough.

Source/JavaScriptCore: 

Add Promise.all() implementation and factor out performing resolves and rejects
on deferreds to share a bit of code. Also moves the abruptRejection helper to
JSPromiseDeferred so it can be used in JSPromiseFunctions.

* runtime/CommonIdentifiers.h:
* runtime/JSPromiseConstructor.cpp:
(JSC::JSPromiseConstructorFuncCast):
(JSC::JSPromiseConstructorFuncResolve):
(JSC::JSPromiseConstructorFuncReject):
(JSC::JSPromiseConstructorFuncAll):
* runtime/JSPromiseDeferred.cpp:
(JSC::updateDeferredFromPotentialThenable):
(JSC::performDeferredResolve):
(JSC::performDeferredReject):
(JSC::abruptRejection):
* runtime/JSPromiseDeferred.h:
* runtime/JSPromiseFunctions.cpp:
(JSC::promiseAllCountdownFunction):
(JSC::createPromiseAllCountdownFunction):
* runtime/JSPromiseFunctions.h:
* runtime/JSPromiseReaction.cpp:
(JSC::ExecutePromiseReactionMicrotask::run):

LayoutTests: 

Enabled and fix the existing Promise.all() test case.
- Promise.all() and Promise.all({}) should reject by my reading of the spec.
Also removes the Promise.all() shim used by the crypto tests.

* crypto/subtle/resources/common.js:
* js/dom/Promise-static-all-expected.txt:
* js/dom/Promise-static-all.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ba83364c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment