Implement other routines of Promise (#1729)

Add Promise.resolve, Promise.reject, Promise.race, Promise.all and
Promise.prototype.catch

Also it fixes the issue 1763

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2017-04-26 19:47:51 +08:00
committed by GitHub
parent 9d4123c3c4
commit 078f6e101d
20 changed files with 1044 additions and 138 deletions
@@ -13,24 +13,10 @@
* limitations under the License.
*/
var a = new Promise(function(f, r){
r(0);
Promise.reject("abc").then(function(x)
{
assert (false); // should not run here.
}, function(x)
{
assert (x === "abc");
});
a
.then(function f1(x) {
return x + 1; // unreachable
}, function r1(x){
return x + 10;
})
.then(function f2(x) {
throw x + 100
})
.then(function f3(x) {
return x + 1000 //unreachable
}, function r3(x) {
return x + 10000
})
.then(function(x) {
assert (x === 10110);
})