Financial-Times/polyfill-service — pull request #191 by juandopazo (2014-11-23 23:25:20+00:00)
Title: Promise fixes

After @jonathantneal 's last pull request, there are still a few issues with the current Promise implementation:

1. It's lacking *Promise.reject*
1. It's not passing two A+ tests:
1. Resolving a promise with another one is not working correctly:
```js
var p1 = new Promise(function (resolve, reject) {
reject(new Error('hello'));
});
var p2 = new Promise(function (resolve) {
resolve(p1);
});
// p2 should be rejected with an error
```
1. An infinite loop is caused when resolving a promise with itself:
```js
var p = Promise.resolve(42).then(function () {
return p;
});
```

I'm trying to fix the resolution of promises, but I'm having a hard time understanding the "promiseChain" logic. @jonathantneal can you explain a bit how it works?