[JS] Implement Promise.race()
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jan 2014 04:18:32 +0000 (04:18 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jan 2014 04:18:32 +0000 (04:18 +0000)
commitbcaffc26769cb7b139d8e9268218ff17ea6600dd
treeafbe0d90829ad44253bd1c4b92d9844c8e14bbe3
parenteb80567985c4f12dde294cc0319a2c57d82c89e3
[JS] Implement Promise.race()
https://bugs.webkit.org/show_bug.cgi?id=126506

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

* runtime/CommonIdentifiers.h:
Add identifier for "cast".

* runtime/JSPromiseConstructor.cpp:
(JSC::abruptRejection):
Helper for the RejectIfAbrupt abstract operation.

(JSC::JSPromiseConstructorFuncRace):
Add implementation of Promise.race()

LayoutTests:

Enabled and fix the existing Promise.race() test case.
- Promise.race() and Promise.race({}) should reject by my reading of the spec.

* js/dom/Promise-static-race-expected.txt:
* js/dom/Promise-static-race.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/dom/Promise-static-race-expected.txt
LayoutTests/js/dom/Promise-static-race.html
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp