Fix Promise.wait() for fired promises

Failure introduced in 80ace36e4c
pull/5370/head
Felix Geisendörfer 2010-02-15 23:54:55 +01:00 committed by Ryan Dahl
parent 80ace36e4c
commit 490cac0d7e
1 changed files with 12 additions and 0 deletions

View File

@ -297,6 +297,18 @@ var eventsModule = createInternalModule('events', function (exports) {
var ret;
var hadError = false;
if (this.hasFired) {
ret = (this._values.length == 1)
? this._values[0]
: this.values;
if (this.hasFired == 'success') {
return ret;
} else if (this.hasFired == 'error') {
throw ret;
}
}
self.addCallback(function () {
if (arguments.length == 1) {
ret = arguments[0];