Revised to comply with Promise/A+ spec 1.1 and port fixes and conceptual changes from newer releases of Promise.coffee.