Comparing version 0.10.13-0 to 0.10.13-1
@@ -49,3 +49,3 @@ /** | ||
ret._unsetCancellable(); | ||
ret._assumeStateOf( this, true ); | ||
ret._follow( this, true ); | ||
ret._boundTo = this._boundTo; | ||
@@ -52,0 +52,0 @@ return ret; |
@@ -46,3 +46,3 @@ /** | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
fulfilleds[i] = fulfill._settledValue; | ||
continue; | ||
@@ -66,3 +66,3 @@ } | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
fulfilleds[i] = fulfill._settledValue; | ||
continue; | ||
@@ -69,0 +69,0 @@ } |
@@ -30,10 +30,10 @@ /** | ||
Promise.prototype.progressed = function Promise$progressed( fn ) { | ||
return this._then( void 0, void 0, fn, | ||
void 0, void 0, this.progressed ); | ||
Promise.prototype.progressed = function Promise$progressed(fn) { | ||
return this._then(void 0, void 0, fn, | ||
void 0, void 0, this.progressed); | ||
}; | ||
Promise.prototype._progress = function Promise$_progress( progressValue ) { | ||
Promise.prototype._progress = function Promise$_progress(progressValue) { | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveProgress( progressValue ); | ||
this._progressUnchecked(progressValue); | ||
@@ -43,3 +43,3 @@ }; | ||
Promise.prototype._progressAt = function Promise$_progressAt( index ) { | ||
if( index === 0 ) return this._progress0; | ||
if( index === 0 ) return this._progressHandler0; | ||
return this[ index + 2 - 5 ]; | ||
@@ -79,4 +79,4 @@ }; | ||
Promise.prototype._resolveProgress = | ||
function Promise$_resolveProgress( progressValue ) { | ||
Promise.prototype._progressUnchecked = | ||
function Promise$_progressUnchecked( progressValue ) { | ||
var len = this._length(); | ||
@@ -83,0 +83,0 @@ |
@@ -64,7 +64,7 @@ /** | ||
PromiseArray.prototype._init = | ||
function PromiseArray$_init( _, fulfillValueIfEmpty ) { | ||
function PromiseArray$_init( _, resolveValueIfEmpty ) { | ||
var values = this._values; | ||
if( Promise.is( values ) ) { | ||
if(Promise.is(values)) { | ||
if( values.isFulfilled() ) { | ||
values = values._resolvedValue; | ||
values = values._settledValue; | ||
if( !isArray( values ) ) { | ||
@@ -83,3 +83,3 @@ var err = new Promise.TypeError("expecting an array, a promise or a thenable"); | ||
this, | ||
fulfillValueIfEmpty, | ||
resolveValueIfEmpty, | ||
this.constructor | ||
@@ -90,3 +90,3 @@ ); | ||
else { | ||
this._reject( values._resolvedValue ); | ||
this._reject( values._settledValue ); | ||
return; | ||
@@ -96,3 +96,3 @@ } | ||
if( values.length === 0 ) { | ||
this._fulfill( toResolutionValue( fulfillValueIfEmpty ) ); | ||
this._resolve( toResolutionValue( resolveValueIfEmpty ) ); | ||
return; | ||
@@ -133,7 +133,7 @@ } | ||
if( newLen === 0 ) { | ||
if( fulfillValueIfEmpty === 1 ) { | ||
this._fulfill( newValues ); | ||
if( resolveValueIfEmpty === 1 ) { | ||
this._resolve( newValues ); | ||
} | ||
else { | ||
this._fulfill( toResolutionValue( fulfillValueIfEmpty ) ); | ||
this._resolve( toResolutionValue( resolveValueIfEmpty ) ); | ||
} | ||
@@ -152,13 +152,13 @@ return; | ||
PromiseArray.prototype._resolvePromiseAt = | ||
function PromiseArray$_resolvePromiseAt( i ) { | ||
var value = this._values[i]; | ||
if( !Promise.is( value ) ) { | ||
this._promiseFulfilled( value, i ); | ||
PromiseArray.prototype._settlePromiseAt = | ||
function PromiseArray$_settlePromiseAt(index) { | ||
var value = this._values[index]; | ||
if (!Promise.is(value)) { | ||
this._promiseFulfilled(value, index); | ||
} | ||
else if( value.isFulfilled() ) { | ||
this._promiseFulfilled( value._resolvedValue, i ); | ||
else if (value.isFulfilled()) { | ||
this._promiseFulfilled(value._settledValue, index); | ||
} | ||
else if( value.isRejected() ) { | ||
this._promiseRejected( value._resolvedValue, i ); | ||
else if (value.isRejected()) { | ||
this._promiseRejected(value._settledValue, index); | ||
} | ||
@@ -174,3 +174,3 @@ }; | ||
if( hasOwn.call( this._values, i ) ) { | ||
this._resolvePromiseAt( i ); | ||
this._settlePromiseAt( i ); | ||
} | ||
@@ -186,3 +186,3 @@ } | ||
} | ||
this._resolvePromiseAt( i ); | ||
this._settlePromiseAt( i ); | ||
} | ||
@@ -195,5 +195,5 @@ }; | ||
PromiseArray.prototype._fulfill = function PromiseArray$_fulfill( value ) { | ||
PromiseArray.prototype._resolve = function PromiseArray$_resolve( value ) { | ||
this._values = null; | ||
this._resolver.fulfill( value ); | ||
this._resolver.resolve( value ); | ||
}; | ||
@@ -224,3 +224,3 @@ | ||
if( totalResolved >= this._length ) { | ||
this._fulfill( this._values ); | ||
this._resolve( this._values ); | ||
} | ||
@@ -227,0 +227,0 @@ }; |
@@ -28,4 +28,4 @@ /** | ||
this._bitField = promise._bitField; | ||
this._resolvedValue = promise.isResolved() | ||
? promise._resolvedValue | ||
this._settledValue = promise.isResolved() | ||
? promise._settledValue | ||
: void 0; | ||
@@ -35,3 +35,3 @@ } | ||
this._bitField = 0; | ||
this._resolvedValue = void 0; | ||
this._settledValue = void 0; | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
} | ||
return this._resolvedValue; | ||
return this._settledValue; | ||
}; | ||
@@ -67,5 +67,5 @@ | ||
} | ||
return this._resolvedValue; | ||
return this._settledValue; | ||
}; | ||
module.exports = PromiseInspection; |
@@ -93,25 +93,27 @@ /** | ||
PromiseResolver.prototype.resolve = | ||
PromiseResolver.prototype.fulfill = function PromiseResolver$resolve( value ) { | ||
if( this.promise._tryAssumeStateOf( value, false ) ) { | ||
PromiseResolver.prototype.fulfill = function PromiseResolver$resolve(value) { | ||
var promise = this.promise; | ||
if (promise._tryFollow(value, false)) { | ||
return; | ||
} | ||
async.invoke( this.promise._fulfill, this.promise, value ); | ||
async.invoke(promise._fulfill, promise, value); | ||
}; | ||
PromiseResolver.prototype.reject = function PromiseResolver$reject( reason ) { | ||
this.promise._attachExtraTrace( reason ); | ||
async.invoke( this.promise._reject, this.promise, reason ); | ||
PromiseResolver.prototype.reject = function PromiseResolver$reject(reason) { | ||
var promise = this.promise; | ||
promise._attachExtraTrace(reason); | ||
async.invoke(promise._reject, promise, reason); | ||
}; | ||
PromiseResolver.prototype.progress = | ||
function PromiseResolver$progress( value ) { | ||
async.invoke( this.promise._progress, this.promise, value ); | ||
function PromiseResolver$progress(value) { | ||
async.invoke(this.promise._progress, this.promise, value); | ||
}; | ||
PromiseResolver.prototype.cancel = function PromiseResolver$cancel() { | ||
async.invoke( this.promise.cancel, this.promise, void 0 ); | ||
async.invoke(this.promise.cancel, this.promise, void 0); | ||
}; | ||
PromiseResolver.prototype.timeout = function PromiseResolver$timeout() { | ||
this.reject( new TimeoutError( "timeout" ) ); | ||
this.reject(new TimeoutError("timeout")); | ||
}; | ||
@@ -118,0 +120,0 @@ |
@@ -78,11 +78,11 @@ /** | ||
this._bitField = 67108864; | ||
this._fulfill0 = void 0; | ||
this._reject0 = void 0; | ||
this._progress0 = void 0; | ||
this._fulfillmentHandler0 = void 0; | ||
this._rejectionHandler0 = void 0; | ||
this._progressHandler0 = void 0; | ||
this._promise0 = void 0; | ||
this._receiver0 = void 0; | ||
this._resolvedValue = void 0; | ||
this._settledValue = void 0; | ||
this._cancellationParent = void 0; | ||
this._boundTo = void 0; | ||
if (longStackTraces) this._traceParent = this._peekContext(); | ||
if (debugging) this._traceParent = this._peekContext(); | ||
if (resolver !== INTERNAL) this._resolveFromResolver(resolver); | ||
@@ -93,5 +93,5 @@ } | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( this.bind, this ); | ||
ret._assumeStateOf( this, true ); | ||
ret._setBoundTo( obj ); | ||
ret._setTrace(this.bind, this); | ||
ret._follow(this, true); | ||
ret._setBoundTo(obj); | ||
return ret; | ||
@@ -216,7 +216,7 @@ }; | ||
if( this.isFulfilled() ) { | ||
ret.fulfillmentValue = this._resolvedValue; | ||
ret.fulfillmentValue = this._settledValue; | ||
ret.isFulfilled = true; | ||
} | ||
else if( this.isRejected() ) { | ||
ret.rejectionReason = this._resolvedValue; | ||
ret.rejectionReason = this._settledValue; | ||
ret.isRejected = true; | ||
@@ -251,3 +251,3 @@ } | ||
Promise.resolve = Promise.fulfilled = | ||
function Promise$Resolve( value, caller ) { | ||
function Promise$Resolve(value, caller) { | ||
var ret = new Promise(INTERNAL); | ||
@@ -257,3 +257,3 @@ ret._setTrace( typeof caller === "function" | ||
: Promise.resolve, void 0 ); | ||
if( ret._tryAssumeStateOf( value, false ) ) { | ||
if(ret._tryFollow(value, false)) { | ||
return ret; | ||
@@ -263,12 +263,12 @@ } | ||
ret._setFulfilled(); | ||
ret._resolvedValue = value; | ||
ret._settledValue = value; | ||
return ret; | ||
}; | ||
Promise.reject = Promise.rejected = function Promise$Reject( reason ) { | ||
Promise.reject = Promise.rejected = function Promise$Reject(reason) { | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( Promise.reject, void 0 ); | ||
ret._setTrace(Promise.reject, void 0); | ||
ret._cleanValues(); | ||
ret._setRejected(); | ||
ret._resolvedValue = reason; | ||
ret._settledValue = reason; | ||
return ret; | ||
@@ -282,3 +282,3 @@ }; | ||
this._setRejected(); | ||
this._resolvedValue = value.e; | ||
this._settledValue = value.e; | ||
} | ||
@@ -288,3 +288,3 @@ else { | ||
if (maybePromise instanceof Promise) { | ||
this._assumeStateOf(maybePromise, true); | ||
this._follow(maybePromise, true); | ||
} | ||
@@ -294,3 +294,3 @@ else { | ||
this._setFulfilled(); | ||
this._resolvedValue = value; | ||
this._settledValue = value; | ||
} | ||
@@ -343,7 +343,7 @@ } | ||
Promise.bind = function Promise$Bind( obj ) { | ||
Promise.bind = function Promise$Bind(thisArg) { | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( Promise.bind, void 0 ); | ||
ret._setTrace(Promise.bind, void 0); | ||
ret._setFulfilled(); | ||
ret._setBoundTo( obj ); | ||
ret._setBoundTo(thisArg); | ||
return ret; | ||
@@ -364,3 +364,3 @@ }; | ||
Promise.onPossiblyUnhandledRejection = | ||
function Promise$OnPossiblyUnhandledRejection( fn ) { | ||
function Promise$OnPossiblyUnhandledRejection(fn) { | ||
if( typeof fn === "function" ) { | ||
@@ -374,7 +374,8 @@ CapturedTrace.possiblyUnhandledRejection = fn; | ||
var longStackTraces = false || !!( | ||
var debugging = false || !!( | ||
typeof process !== "undefined" && | ||
typeof process.execPath === "string" && | ||
typeof process.env === "object" && | ||
process.env[ "BLUEBIRD_DEBUG" ] | ||
(process.env[ "BLUEBIRD_DEBUG" ] || | ||
process.env["NODE_ENV"] === "development") | ||
); | ||
@@ -385,3 +386,3 @@ | ||
if( async.haveItemsQueued() && | ||
longStackTraces === false | ||
debugging === false | ||
) { | ||
@@ -391,7 +392,7 @@ throw new Error("Cannot enable long stack traces " + | ||
} | ||
longStackTraces = true; | ||
debugging = true; | ||
}; | ||
Promise.hasLongStackTraces = function Promise$HasLongStackTraces() { | ||
return longStackTraces; | ||
return debugging && CapturedTrace.isSupported(); | ||
}; | ||
@@ -411,3 +412,3 @@ | ||
if( longStackTraces && !haveInternalData ) { | ||
if( debugging && !haveInternalData ) { | ||
var haveSameContext = this._peekContext() === this._traceParent; | ||
@@ -428,3 +429,3 @@ ret._traceParent = haveSameContext ? this._traceParent : this; | ||
if( this.isResolved() ) { | ||
async.invoke( this._resolveLast, this, callbackIndex ); | ||
async.invoke( this._queueSettleAt, this, callbackIndex ); | ||
} | ||
@@ -504,3 +505,3 @@ else if( !haveInternalData && this.isCancellable() ) { | ||
Promise.prototype._fulfillAt = function Promise$_fulfillAt( index ) { | ||
if( index === 0 ) return this._fulfill0; | ||
if( index === 0 ) return this._fulfillmentHandler0; | ||
return this[ index + 0 - 5 ]; | ||
@@ -510,3 +511,3 @@ }; | ||
Promise.prototype._rejectAt = function Promise$_rejectAt( index ) { | ||
if( index === 0 ) return this._reject0; | ||
if( index === 0 ) return this._rejectionHandler0; | ||
return this[ index + 1 - 5 ]; | ||
@@ -517,5 +518,5 @@ }; | ||
if( index === 0 ) { | ||
this._fulfill0 = | ||
this._reject0 = | ||
this._progress0 = | ||
this._fulfillmentHandler0 = | ||
this._rejectionHandler0 = | ||
this._progressHandler0 = | ||
this._promise0 = | ||
@@ -562,5 +563,5 @@ this._receiver0 = void 0; | ||
if( index === 0 ) { | ||
this._fulfill0 = fulfill; | ||
this._reject0 = reject; | ||
this._progress0 = progress; | ||
this._fulfillmentHandler0 = fulfill; | ||
this._rejectionHandler0 = reject; | ||
this._progressHandler0 = progress; | ||
this._promise0 = promise; | ||
@@ -584,3 +585,3 @@ this._receiver0 = receiver; | ||
function Promise$_spreadSlowCase( targetFn, promise, values, boundTo ) { | ||
promise._assumeStateOf( | ||
promise._follow( | ||
Promise$_All( values, PromiseArray, this._spreadSlowCase, boundTo ) | ||
@@ -606,8 +607,9 @@ .promise() | ||
var ignore = CatchFilter.prototype.doFilter; | ||
Promise.prototype._resolvePromise = function Promise$_resolvePromise( | ||
onFulfilledOrRejected, receiver, value, promise | ||
Promise.prototype._settlePromiseFromHandler = | ||
function Promise$_settlePromiseFromHandler( | ||
handler, receiver, value, promise | ||
) { | ||
if( !isPromise( promise ) ) { | ||
onFulfilledOrRejected.call( receiver, value, promise ); | ||
handler.call( receiver, value, promise ); | ||
return; | ||
@@ -635,7 +637,7 @@ } | ||
if( isArray( value ) ) { | ||
var caller = this._resolvePromise; | ||
var caller = this._settlePromiseFromHandler; | ||
for( var i = 0, len = value.length; i < len; ++i ) { | ||
if (isPromise(Promise._cast(value[i], caller, void 0))) { | ||
this._spreadSlowCase( | ||
onFulfilledOrRejected, | ||
handler, | ||
promise, | ||
@@ -649,6 +651,6 @@ value, | ||
promise._pushContext(); | ||
x = tryCatchApply( onFulfilledOrRejected, value, this._boundTo ); | ||
x = tryCatchApply( handler, value, this._boundTo ); | ||
} | ||
else { | ||
this._spreadSlowCase( onFulfilledOrRejected, promise, | ||
this._spreadSlowCase( handler, promise, | ||
value, this._boundTo ); | ||
@@ -660,3 +662,3 @@ return; | ||
promise._pushContext(); | ||
x = tryCatch1( onFulfilledOrRejected, receiver, value ); | ||
x = tryCatch1( handler, receiver, value ); | ||
} | ||
@@ -668,3 +670,3 @@ | ||
ensureNotHandled(x.e); | ||
if( onFulfilledOrRejected !== ignore ) { | ||
if( handler !== ignore ) { | ||
promise._attachExtraTrace( x.e ); | ||
@@ -684,7 +686,8 @@ } | ||
else { | ||
var castValue = Promise._cast(x, this._resolvePromise, promise); | ||
var castValue = Promise._cast(x, this._settlePromiseFromHandler, | ||
promise); | ||
var isThenable = castValue !== x; | ||
if (isThenable || isPromise(castValue)) { | ||
promise._assumeStateOf(castValue, true); | ||
promise._follow(castValue, true); | ||
} | ||
@@ -697,4 +700,4 @@ else { | ||
Promise.prototype._assumeStateOf = | ||
function Promise$_assumeStateOf( promise, mustAsync ) { | ||
Promise.prototype._follow = | ||
function Promise$_follow( promise, mustAsync ) { | ||
this._setFollowing(); | ||
@@ -706,25 +709,25 @@ if( promise.isPending() ) { | ||
promise._then( | ||
this._resolveFulfill, | ||
this._resolveReject, | ||
this._resolveProgress, | ||
this._fulfillUnchecked, | ||
this._rejectUnchecked, | ||
this._progressUnchecked, | ||
this, | ||
null, | ||
this._assumeStateOf | ||
this._follow | ||
); | ||
} | ||
else if( promise.isFulfilled() ) { | ||
if( mustAsync === true ) | ||
async.invoke( this._resolveFulfill, this, promise._resolvedValue ); | ||
else if (promise.isFulfilled()) { | ||
if(mustAsync === true) | ||
async.invoke(this._fulfillUnchecked, this, promise._settledValue); | ||
else | ||
this._resolveFulfill( promise._resolvedValue ); | ||
this._fulfillUnchecked( promise._settledValue ); | ||
} | ||
else { | ||
if( mustAsync === true ) | ||
async.invoke( this._resolveReject, this, promise._resolvedValue ); | ||
if (mustAsync === true) | ||
async.invoke(this._rejectUnchecked, this, promise._settledValue); | ||
else | ||
this._resolveReject( promise._resolvedValue ); | ||
this._rejectUnchecked(promise._settledValue); | ||
} | ||
if( longStackTraces && | ||
promise._traceParent == null ) { | ||
if(debugging && | ||
promise._traceParent == null) { | ||
promise._traceParent = this; | ||
@@ -734,4 +737,4 @@ } | ||
Promise.prototype._tryAssumeStateOf = | ||
function Promise$_tryAssumeStateOf( value, mustAsync ) { | ||
Promise.prototype._tryFollow = | ||
function Promise$_tryFollow( value, mustAsync ) { | ||
if (this._isFollowingOrFulfilledOrRejected() || | ||
@@ -741,7 +744,7 @@ value === this) { | ||
} | ||
var maybePromise = Promise._cast(value, this._tryAssumeStateOf, void 0); | ||
var maybePromise = Promise._cast(value, this._tryFollow, void 0); | ||
if (!isPromise(maybePromise)) { | ||
return false; | ||
} | ||
this._assumeStateOf(maybePromise, mustAsync); | ||
this._follow(maybePromise, mustAsync); | ||
return true; | ||
@@ -751,3 +754,3 @@ }; | ||
Promise.prototype._resetTrace = function Promise$_resetTrace( caller ) { | ||
if( longStackTraces ) { | ||
if( debugging ) { | ||
var context = this._peekContext(); | ||
@@ -765,3 +768,3 @@ var isTopLevel = context === void 0; | ||
Promise.prototype._setTrace = function Promise$_setTrace( caller, parent ) { | ||
if( longStackTraces ) { | ||
if( debugging ) { | ||
var context = this._peekContext(); | ||
@@ -787,3 +790,3 @@ var isTopLevel = context === void 0; | ||
function Promise$_attachExtraTrace( error ) { | ||
if( longStackTraces && | ||
if( debugging && | ||
canAttach( error ) ) { | ||
@@ -843,3 +846,3 @@ var promise = this; | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveFulfill( value ); | ||
this._fulfillUnchecked( value ); | ||
@@ -850,52 +853,40 @@ }; | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveReject( reason ); | ||
this._rejectUnchecked( reason ); | ||
}; | ||
Promise.prototype._doResolveAt = function Promise$_doResolveAt( i ) { | ||
var fn = this.isFulfilled() | ||
? this._fulfillAt( i ) | ||
: this._rejectAt( i ); | ||
var value = this._resolvedValue; | ||
var receiver = this._receiverAt( i ); | ||
var promise = this._promiseAt( i ); | ||
this._unsetAt( i ); | ||
this._resolvePromise( fn, receiver, value, promise ); | ||
}; | ||
Promise.prototype._settlePromiseAt = function Promise$_settlePromiseAt(index) { | ||
var handler = this.isFulfilled() | ||
? this._fulfillAt(index) | ||
: this._rejectAt(index); | ||
Promise.prototype._resolveLast = function Promise$_resolveLast( index ) { | ||
this._setLength( 0 ); | ||
var fn; | ||
if( this.isFulfilled() ) { | ||
fn = this._fulfillAt( index ); | ||
var value = this._settledValue; | ||
var receiver = this._receiverAt(index); | ||
var promise = this._promiseAt(index); | ||
this._unsetAt(index); | ||
if (typeof handler === "function") { | ||
this._settlePromiseFromHandler(handler, receiver, value, promise); | ||
} | ||
else { | ||
fn = this._rejectAt( index ); | ||
else if (this.isFulfilled()) { | ||
promise._fulfill(value); | ||
} | ||
if( fn !== void 0 ) { | ||
async.invoke( this._doResolveAt, this, index ); | ||
} | ||
else { | ||
var promise = this._promiseAt( index ); | ||
var value = this._resolvedValue; | ||
this._unsetAt( index ); | ||
if( this.isFulfilled() ) { | ||
async.invoke( promise._fulfill, promise, value ); | ||
} | ||
else { | ||
async.invoke( promise._reject, promise, value ); | ||
} | ||
promise._reject(value); | ||
} | ||
}; | ||
Promise.prototype._queueSettleAt = function Promise$_queueSettleAt(index) { | ||
this._setLength(0); | ||
async.invoke(this._settlePromiseAt, this, index); | ||
}; | ||
Promise.prototype._resolveFulfill = function Promise$_resolveFulfill( value ) { | ||
Promise.prototype._fulfillUnchecked = | ||
function Promise$_fulfillUnchecked( value ) { | ||
if( value === this ) { | ||
var err = makeSelfResolutionError(); | ||
this._attachExtraTrace( err ); | ||
return this._resolveReject( err ); | ||
return this._rejectUnchecked( err ); | ||
} | ||
this._cleanValues(); | ||
this._setFulfilled(); | ||
this._resolvedValue = value; | ||
this._settledValue = value; | ||
var len = this._length(); | ||
@@ -905,3 +896,3 @@ this._setLength( 0 ); | ||
if( this._fulfillAt( i ) !== void 0 ) { | ||
async.invoke( this._doResolveAt, this, i ); | ||
async.invoke( this._settlePromiseAt, this, i ); | ||
} | ||
@@ -917,11 +908,12 @@ else { | ||
Promise.prototype._resolveReject = function Promise$_resolveReject( reason ) { | ||
Promise.prototype._rejectUnchecked = | ||
function Promise$_rejectUnchecked( reason ) { | ||
if( reason === this ) { | ||
var err = makeSelfResolutionError(); | ||
this._attachExtraTrace( err ); | ||
return this._resolveReject( err ); | ||
return this._rejectUnchecked( err ); | ||
} | ||
this._cleanValues(); | ||
this._setRejected(); | ||
this._resolvedValue = reason; | ||
this._settledValue = reason; | ||
if( this._isFinal() ) { | ||
@@ -938,3 +930,3 @@ async.invokeLater( thrower, void 0, reason ); | ||
rejectionWasHandled = true; | ||
async.invoke( this._doResolveAt, this, i ); | ||
async.invoke( this._settlePromiseAt, this, i ); | ||
} | ||
@@ -988,3 +980,3 @@ else { | ||
Promise.prototype._pushContext = function Promise$_pushContext() { | ||
if( !longStackTraces ) return; | ||
if( !debugging ) return; | ||
contextStack.push( this ); | ||
@@ -994,3 +986,3 @@ }; | ||
Promise.prototype._popContext = function Promise$_popContext() { | ||
if( !longStackTraces ) return; | ||
if( !debugging ) return; | ||
contextStack.pop(); | ||
@@ -1038,4 +1030,4 @@ }; | ||
if( !CapturedTrace.isSupported() ) { | ||
Promise.longStackTraces = function(){}; | ||
longStackTraces = false; | ||
Promise.debugging = function(){}; | ||
debugging = false; | ||
} | ||
@@ -1042,0 +1034,0 @@ |
@@ -60,3 +60,3 @@ /** | ||
} | ||
this._fulfill( val ); | ||
this._resolve( val ); | ||
} | ||
@@ -63,0 +63,0 @@ }; |
@@ -106,3 +106,3 @@ /** | ||
if( initialValue.isFulfilled() ) { | ||
initialValue = initialValue._resolvedValue; | ||
initialValue = initialValue._settledValue; | ||
} | ||
@@ -109,0 +109,0 @@ else { |
@@ -38,3 +38,3 @@ /** | ||
if( totalResolved >= this._length ) { | ||
this._fulfill( this._values ); | ||
this._resolve( this._values ); | ||
} | ||
@@ -48,3 +48,3 @@ }; | ||
ret._bitField = 268435456; | ||
ret._resolvedValue = value; | ||
ret._settledValue = value; | ||
this._promiseResolved( index, ret ); | ||
@@ -57,3 +57,3 @@ }; | ||
ret._bitField = 134217728; | ||
ret._resolvedValue = reason; | ||
ret._settledValue = reason; | ||
this._promiseResolved( index, ret ); | ||
@@ -63,2 +63,2 @@ }; | ||
return SettledPromiseArray; | ||
}; | ||
}; |
@@ -65,12 +65,12 @@ /** | ||
SomePromiseArray.prototype._promiseFulfilled = | ||
function SomePromiseArray$_promiseFulfilled( value ) { | ||
if( this._isResolved() ) return; | ||
function SomePromiseArray$_promiseFulfilled(value) { | ||
if (this._isResolved()) return; | ||
this._addFulfilled( value ); | ||
if( this._fulfilled() === this.howMany() ) { | ||
if (this._fulfilled() === this.howMany()) { | ||
this._values.length = this.howMany(); | ||
if( this.howMany() === 1 && this._unwrap ) { | ||
this._fulfill( this._values[0] ); | ||
if (this.howMany() === 1 && this._unwrap) { | ||
this._resolve(this._values[0]); | ||
} | ||
else { | ||
this._fulfill( this._values ); | ||
this._resolve(this._values); | ||
} | ||
@@ -77,0 +77,0 @@ } |
@@ -49,3 +49,3 @@ /** | ||
ret._unsetCancellable(); | ||
ret._assumeStateOf( this, true ); | ||
ret._follow( this, true ); | ||
ret._boundTo = this._boundTo; | ||
@@ -52,0 +52,0 @@ return ret; |
@@ -46,3 +46,3 @@ /** | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
fulfilleds[i] = fulfill._settledValue; | ||
continue; | ||
@@ -66,3 +66,3 @@ } | ||
if( fulfill.isFulfilled() ) { | ||
fulfilleds[i] = fulfill._resolvedValue; | ||
fulfilleds[i] = fulfill._settledValue; | ||
continue; | ||
@@ -69,0 +69,0 @@ } |
@@ -30,10 +30,10 @@ /** | ||
Promise.prototype.progressed = function Promise$progressed( fn ) { | ||
return this._then( void 0, void 0, fn, | ||
void 0, void 0, this.progressed ); | ||
Promise.prototype.progressed = function Promise$progressed(fn) { | ||
return this._then(void 0, void 0, fn, | ||
void 0, void 0, this.progressed); | ||
}; | ||
Promise.prototype._progress = function Promise$_progress( progressValue ) { | ||
Promise.prototype._progress = function Promise$_progress(progressValue) { | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveProgress( progressValue ); | ||
this._progressUnchecked(progressValue); | ||
@@ -43,3 +43,3 @@ }; | ||
Promise.prototype._progressAt = function Promise$_progressAt( index ) { | ||
if( index === 0 ) return this._progress0; | ||
if( index === 0 ) return this._progressHandler0; | ||
return this[ index + 2 - 5 ]; | ||
@@ -79,4 +79,4 @@ }; | ||
Promise.prototype._resolveProgress = | ||
function Promise$_resolveProgress( progressValue ) { | ||
Promise.prototype._progressUnchecked = | ||
function Promise$_progressUnchecked( progressValue ) { | ||
var len = this._length(); | ||
@@ -83,0 +83,0 @@ |
@@ -64,7 +64,7 @@ /** | ||
PromiseArray.prototype._init = | ||
function PromiseArray$_init( _, fulfillValueIfEmpty ) { | ||
function PromiseArray$_init( _, resolveValueIfEmpty ) { | ||
var values = this._values; | ||
if( Promise.is( values ) ) { | ||
if(Promise.is(values)) { | ||
if( values.isFulfilled() ) { | ||
values = values._resolvedValue; | ||
values = values._settledValue; | ||
if( !isArray( values ) ) { | ||
@@ -83,3 +83,3 @@ var err = new Promise.TypeError("expecting an array, a promise or a thenable"); | ||
this, | ||
fulfillValueIfEmpty, | ||
resolveValueIfEmpty, | ||
this.constructor | ||
@@ -90,3 +90,3 @@ ); | ||
else { | ||
this._reject( values._resolvedValue ); | ||
this._reject( values._settledValue ); | ||
return; | ||
@@ -96,3 +96,3 @@ } | ||
if( values.length === 0 ) { | ||
this._fulfill( toResolutionValue( fulfillValueIfEmpty ) ); | ||
this._resolve( toResolutionValue( resolveValueIfEmpty ) ); | ||
return; | ||
@@ -133,7 +133,7 @@ } | ||
if( newLen === 0 ) { | ||
if( fulfillValueIfEmpty === 1 ) { | ||
this._fulfill( newValues ); | ||
if( resolveValueIfEmpty === 1 ) { | ||
this._resolve( newValues ); | ||
} | ||
else { | ||
this._fulfill( toResolutionValue( fulfillValueIfEmpty ) ); | ||
this._resolve( toResolutionValue( resolveValueIfEmpty ) ); | ||
} | ||
@@ -152,13 +152,13 @@ return; | ||
PromiseArray.prototype._resolvePromiseAt = | ||
function PromiseArray$_resolvePromiseAt( i ) { | ||
var value = this._values[i]; | ||
if( !Promise.is( value ) ) { | ||
this._promiseFulfilled( value, i ); | ||
PromiseArray.prototype._settlePromiseAt = | ||
function PromiseArray$_settlePromiseAt(index) { | ||
var value = this._values[index]; | ||
if (!Promise.is(value)) { | ||
this._promiseFulfilled(value, index); | ||
} | ||
else if( value.isFulfilled() ) { | ||
this._promiseFulfilled( value._resolvedValue, i ); | ||
else if (value.isFulfilled()) { | ||
this._promiseFulfilled(value._settledValue, index); | ||
} | ||
else if( value.isRejected() ) { | ||
this._promiseRejected( value._resolvedValue, i ); | ||
else if (value.isRejected()) { | ||
this._promiseRejected(value._settledValue, index); | ||
} | ||
@@ -174,3 +174,3 @@ }; | ||
if( hasOwn.call( this._values, i ) ) { | ||
this._resolvePromiseAt( i ); | ||
this._settlePromiseAt( i ); | ||
} | ||
@@ -186,3 +186,3 @@ } | ||
} | ||
this._resolvePromiseAt( i ); | ||
this._settlePromiseAt( i ); | ||
} | ||
@@ -195,5 +195,5 @@ }; | ||
PromiseArray.prototype._fulfill = function PromiseArray$_fulfill( value ) { | ||
PromiseArray.prototype._resolve = function PromiseArray$_resolve( value ) { | ||
this._values = null; | ||
this._resolver.fulfill( value ); | ||
this._resolver.resolve( value ); | ||
}; | ||
@@ -224,3 +224,3 @@ | ||
if( totalResolved >= this._length ) { | ||
this._fulfill( this._values ); | ||
this._resolve( this._values ); | ||
} | ||
@@ -227,0 +227,0 @@ }; |
@@ -28,4 +28,4 @@ /** | ||
this._bitField = promise._bitField; | ||
this._resolvedValue = promise.isResolved() | ||
? promise._resolvedValue | ||
this._settledValue = promise.isResolved() | ||
? promise._settledValue | ||
: void 0; | ||
@@ -35,3 +35,3 @@ } | ||
this._bitField = 0; | ||
this._resolvedValue = void 0; | ||
this._settledValue = void 0; | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
} | ||
return this._resolvedValue; | ||
return this._settledValue; | ||
}; | ||
@@ -67,5 +67,5 @@ | ||
} | ||
return this._resolvedValue; | ||
return this._settledValue; | ||
}; | ||
module.exports = PromiseInspection; |
@@ -93,16 +93,18 @@ /** | ||
PromiseResolver.prototype.resolve = | ||
PromiseResolver.prototype.fulfill = function PromiseResolver$resolve( value ) { | ||
if( this.promise._tryAssumeStateOf( value, false ) ) { | ||
PromiseResolver.prototype.fulfill = function PromiseResolver$resolve(value) { | ||
var promise = this.promise; | ||
if (promise._tryFollow(value, false)) { | ||
return; | ||
} | ||
this.promise._fulfill(value); | ||
promise._fulfill(value); | ||
}; | ||
PromiseResolver.prototype.reject = function PromiseResolver$reject( reason ) { | ||
this.promise._attachExtraTrace( reason ); | ||
this.promise._reject(reason); | ||
PromiseResolver.prototype.reject = function PromiseResolver$reject(reason) { | ||
var promise = this.promise; | ||
promise._attachExtraTrace(reason); | ||
promise._reject(reason); | ||
}; | ||
PromiseResolver.prototype.progress = | ||
function PromiseResolver$progress( value ) { | ||
function PromiseResolver$progress(value) { | ||
this.promise._progress(value); | ||
@@ -116,3 +118,3 @@ }; | ||
PromiseResolver.prototype.timeout = function PromiseResolver$timeout() { | ||
this.reject( new TimeoutError( "timeout" ) ); | ||
this.reject(new TimeoutError("timeout")); | ||
}; | ||
@@ -119,0 +121,0 @@ |
@@ -78,11 +78,11 @@ /** | ||
this._bitField = 67108864; | ||
this._fulfill0 = void 0; | ||
this._reject0 = void 0; | ||
this._progress0 = void 0; | ||
this._fulfillmentHandler0 = void 0; | ||
this._rejectionHandler0 = void 0; | ||
this._progressHandler0 = void 0; | ||
this._promise0 = void 0; | ||
this._receiver0 = void 0; | ||
this._resolvedValue = void 0; | ||
this._settledValue = void 0; | ||
this._cancellationParent = void 0; | ||
this._boundTo = void 0; | ||
if (longStackTraces) this._traceParent = this._peekContext(); | ||
if (debugging) this._traceParent = this._peekContext(); | ||
if (resolver !== INTERNAL) this._resolveFromResolver(resolver); | ||
@@ -93,5 +93,5 @@ } | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( this.bind, this ); | ||
ret._assumeStateOf( this, true ); | ||
ret._setBoundTo( obj ); | ||
ret._setTrace(this.bind, this); | ||
ret._follow(this, true); | ||
ret._setBoundTo(obj); | ||
return ret; | ||
@@ -216,7 +216,7 @@ }; | ||
if( this.isFulfilled() ) { | ||
ret.fulfillmentValue = this._resolvedValue; | ||
ret.fulfillmentValue = this._settledValue; | ||
ret.isFulfilled = true; | ||
} | ||
else if( this.isRejected() ) { | ||
ret.rejectionReason = this._resolvedValue; | ||
ret.rejectionReason = this._settledValue; | ||
ret.isRejected = true; | ||
@@ -251,3 +251,3 @@ } | ||
Promise.resolve = Promise.fulfilled = | ||
function Promise$Resolve( value, caller ) { | ||
function Promise$Resolve(value, caller) { | ||
var ret = new Promise(INTERNAL); | ||
@@ -257,3 +257,3 @@ ret._setTrace( typeof caller === "function" | ||
: Promise.resolve, void 0 ); | ||
if( ret._tryAssumeStateOf( value, false ) ) { | ||
if(ret._tryFollow(value, false)) { | ||
return ret; | ||
@@ -263,12 +263,12 @@ } | ||
ret._setFulfilled(); | ||
ret._resolvedValue = value; | ||
ret._settledValue = value; | ||
return ret; | ||
}; | ||
Promise.reject = Promise.rejected = function Promise$Reject( reason ) { | ||
Promise.reject = Promise.rejected = function Promise$Reject(reason) { | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( Promise.reject, void 0 ); | ||
ret._setTrace(Promise.reject, void 0); | ||
ret._cleanValues(); | ||
ret._setRejected(); | ||
ret._resolvedValue = reason; | ||
ret._settledValue = reason; | ||
return ret; | ||
@@ -282,3 +282,3 @@ }; | ||
this._setRejected(); | ||
this._resolvedValue = value.e; | ||
this._settledValue = value.e; | ||
} | ||
@@ -288,3 +288,3 @@ else { | ||
if (maybePromise instanceof Promise) { | ||
this._assumeStateOf(maybePromise, true); | ||
this._follow(maybePromise, true); | ||
} | ||
@@ -294,3 +294,3 @@ else { | ||
this._setFulfilled(); | ||
this._resolvedValue = value; | ||
this._settledValue = value; | ||
} | ||
@@ -343,7 +343,7 @@ } | ||
Promise.bind = function Promise$Bind( obj ) { | ||
Promise.bind = function Promise$Bind(thisArg) { | ||
var ret = new Promise(INTERNAL); | ||
ret._setTrace( Promise.bind, void 0 ); | ||
ret._setTrace(Promise.bind, void 0); | ||
ret._setFulfilled(); | ||
ret._setBoundTo( obj ); | ||
ret._setBoundTo(thisArg); | ||
return ret; | ||
@@ -364,3 +364,3 @@ }; | ||
Promise.onPossiblyUnhandledRejection = | ||
function Promise$OnPossiblyUnhandledRejection( fn ) { | ||
function Promise$OnPossiblyUnhandledRejection(fn) { | ||
if( typeof fn === "function" ) { | ||
@@ -374,7 +374,8 @@ CapturedTrace.possiblyUnhandledRejection = fn; | ||
var longStackTraces = false || !!( | ||
var debugging = false || !!( | ||
typeof process !== "undefined" && | ||
typeof process.execPath === "string" && | ||
typeof process.env === "object" && | ||
process.env[ "BLUEBIRD_DEBUG" ] | ||
(process.env[ "BLUEBIRD_DEBUG" ] || | ||
process.env["NODE_ENV"] === "development") | ||
); | ||
@@ -385,3 +386,3 @@ | ||
if( async.haveItemsQueued() && | ||
longStackTraces === false | ||
debugging === false | ||
) { | ||
@@ -391,7 +392,7 @@ throw new Error("Cannot enable long stack traces " + | ||
} | ||
longStackTraces = true; | ||
debugging = true; | ||
}; | ||
Promise.hasLongStackTraces = function Promise$HasLongStackTraces() { | ||
return longStackTraces; | ||
return debugging && CapturedTrace.isSupported(); | ||
}; | ||
@@ -411,3 +412,3 @@ | ||
if( longStackTraces && !haveInternalData ) { | ||
if( debugging && !haveInternalData ) { | ||
var haveSameContext = this._peekContext() === this._traceParent; | ||
@@ -428,3 +429,3 @@ ret._traceParent = haveSameContext ? this._traceParent : this; | ||
if( this.isResolved() ) { | ||
this._resolveLast(callbackIndex); | ||
this._queueSettleAt(callbackIndex); | ||
} | ||
@@ -504,3 +505,3 @@ else if( !haveInternalData && this.isCancellable() ) { | ||
Promise.prototype._fulfillAt = function Promise$_fulfillAt( index ) { | ||
if( index === 0 ) return this._fulfill0; | ||
if( index === 0 ) return this._fulfillmentHandler0; | ||
return this[ index + 0 - 5 ]; | ||
@@ -510,3 +511,3 @@ }; | ||
Promise.prototype._rejectAt = function Promise$_rejectAt( index ) { | ||
if( index === 0 ) return this._reject0; | ||
if( index === 0 ) return this._rejectionHandler0; | ||
return this[ index + 1 - 5 ]; | ||
@@ -517,5 +518,5 @@ }; | ||
if( index === 0 ) { | ||
this._fulfill0 = | ||
this._reject0 = | ||
this._progress0 = | ||
this._fulfillmentHandler0 = | ||
this._rejectionHandler0 = | ||
this._progressHandler0 = | ||
this._promise0 = | ||
@@ -562,5 +563,5 @@ this._receiver0 = void 0; | ||
if( index === 0 ) { | ||
this._fulfill0 = fulfill; | ||
this._reject0 = reject; | ||
this._progress0 = progress; | ||
this._fulfillmentHandler0 = fulfill; | ||
this._rejectionHandler0 = reject; | ||
this._progressHandler0 = progress; | ||
this._promise0 = promise; | ||
@@ -584,3 +585,3 @@ this._receiver0 = receiver; | ||
function Promise$_spreadSlowCase( targetFn, promise, values, boundTo ) { | ||
promise._assumeStateOf( | ||
promise._follow( | ||
Promise$_All( values, PromiseArray, this._spreadSlowCase, boundTo ) | ||
@@ -606,8 +607,9 @@ .promise() | ||
var ignore = CatchFilter.prototype.doFilter; | ||
Promise.prototype._resolvePromise = function Promise$_resolvePromise( | ||
onFulfilledOrRejected, receiver, value, promise | ||
Promise.prototype._settlePromiseFromHandler = | ||
function Promise$_settlePromiseFromHandler( | ||
handler, receiver, value, promise | ||
) { | ||
if( !isPromise( promise ) ) { | ||
onFulfilledOrRejected.call( receiver, value, promise ); | ||
handler.call( receiver, value, promise ); | ||
return; | ||
@@ -635,7 +637,7 @@ } | ||
if( isArray( value ) ) { | ||
var caller = this._resolvePromise; | ||
var caller = this._settlePromiseFromHandler; | ||
for( var i = 0, len = value.length; i < len; ++i ) { | ||
if (isPromise(Promise._cast(value[i], caller, void 0))) { | ||
this._spreadSlowCase( | ||
onFulfilledOrRejected, | ||
handler, | ||
promise, | ||
@@ -649,6 +651,6 @@ value, | ||
promise._pushContext(); | ||
x = tryCatchApply( onFulfilledOrRejected, value, this._boundTo ); | ||
x = tryCatchApply( handler, value, this._boundTo ); | ||
} | ||
else { | ||
this._spreadSlowCase( onFulfilledOrRejected, promise, | ||
this._spreadSlowCase( handler, promise, | ||
value, this._boundTo ); | ||
@@ -660,3 +662,3 @@ return; | ||
promise._pushContext(); | ||
x = tryCatch1( onFulfilledOrRejected, receiver, value ); | ||
x = tryCatch1( handler, receiver, value ); | ||
} | ||
@@ -668,3 +670,3 @@ | ||
ensureNotHandled(x.e); | ||
if( onFulfilledOrRejected !== ignore ) { | ||
if( handler !== ignore ) { | ||
promise._attachExtraTrace( x.e ); | ||
@@ -680,7 +682,8 @@ } | ||
else { | ||
var castValue = Promise._cast(x, this._resolvePromise, promise); | ||
var castValue = Promise._cast(x, this._settlePromiseFromHandler, | ||
promise); | ||
var isThenable = castValue !== x; | ||
if (isThenable || isPromise(castValue)) { | ||
promise._assumeStateOf(castValue, true); | ||
promise._follow(castValue, true); | ||
} | ||
@@ -693,4 +696,4 @@ else { | ||
Promise.prototype._assumeStateOf = | ||
function Promise$_assumeStateOf( promise, mustAsync ) { | ||
Promise.prototype._follow = | ||
function Promise$_follow( promise, mustAsync ) { | ||
this._setFollowing(); | ||
@@ -702,25 +705,25 @@ if( promise.isPending() ) { | ||
promise._then( | ||
this._resolveFulfill, | ||
this._resolveReject, | ||
this._resolveProgress, | ||
this._fulfillUnchecked, | ||
this._rejectUnchecked, | ||
this._progressUnchecked, | ||
this, | ||
null, | ||
this._assumeStateOf | ||
this._follow | ||
); | ||
} | ||
else if( promise.isFulfilled() ) { | ||
if( mustAsync === true ) | ||
this._resolveFulfill(promise._resolvedValue); | ||
else if (promise.isFulfilled()) { | ||
if(mustAsync === true) | ||
this._fulfillUnchecked(promise._settledValue); | ||
else | ||
this._resolveFulfill( promise._resolvedValue ); | ||
this._fulfillUnchecked( promise._settledValue ); | ||
} | ||
else { | ||
if( mustAsync === true ) | ||
this._resolveReject(promise._resolvedValue); | ||
if (mustAsync === true) | ||
this._rejectUnchecked(promise._settledValue); | ||
else | ||
this._resolveReject( promise._resolvedValue ); | ||
this._rejectUnchecked(promise._settledValue); | ||
} | ||
if( longStackTraces && | ||
promise._traceParent == null ) { | ||
if(debugging && | ||
promise._traceParent == null) { | ||
promise._traceParent = this; | ||
@@ -730,4 +733,4 @@ } | ||
Promise.prototype._tryAssumeStateOf = | ||
function Promise$_tryAssumeStateOf( value, mustAsync ) { | ||
Promise.prototype._tryFollow = | ||
function Promise$_tryFollow( value, mustAsync ) { | ||
if (this._isFollowingOrFulfilledOrRejected() || | ||
@@ -737,7 +740,7 @@ value === this) { | ||
} | ||
var maybePromise = Promise._cast(value, this._tryAssumeStateOf, void 0); | ||
var maybePromise = Promise._cast(value, this._tryFollow, void 0); | ||
if (!isPromise(maybePromise)) { | ||
return false; | ||
} | ||
this._assumeStateOf(maybePromise, mustAsync); | ||
this._follow(maybePromise, mustAsync); | ||
return true; | ||
@@ -747,3 +750,3 @@ }; | ||
Promise.prototype._resetTrace = function Promise$_resetTrace( caller ) { | ||
if( longStackTraces ) { | ||
if( debugging ) { | ||
var context = this._peekContext(); | ||
@@ -761,3 +764,3 @@ var isTopLevel = context === void 0; | ||
Promise.prototype._setTrace = function Promise$_setTrace( caller, parent ) { | ||
if( longStackTraces ) { | ||
if( debugging ) { | ||
var context = this._peekContext(); | ||
@@ -783,3 +786,3 @@ var isTopLevel = context === void 0; | ||
function Promise$_attachExtraTrace( error ) { | ||
if( longStackTraces && | ||
if( debugging && | ||
canAttach( error ) ) { | ||
@@ -839,3 +842,3 @@ var promise = this; | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveFulfill( value ); | ||
this._fulfillUnchecked( value ); | ||
@@ -846,52 +849,40 @@ }; | ||
if( this._isFollowingOrFulfilledOrRejected() ) return; | ||
this._resolveReject( reason ); | ||
this._rejectUnchecked( reason ); | ||
}; | ||
Promise.prototype._doResolveAt = function Promise$_doResolveAt( i ) { | ||
var fn = this.isFulfilled() | ||
? this._fulfillAt( i ) | ||
: this._rejectAt( i ); | ||
var value = this._resolvedValue; | ||
var receiver = this._receiverAt( i ); | ||
var promise = this._promiseAt( i ); | ||
this._unsetAt( i ); | ||
this._resolvePromise( fn, receiver, value, promise ); | ||
}; | ||
Promise.prototype._settlePromiseAt = function Promise$_settlePromiseAt(index) { | ||
var handler = this.isFulfilled() | ||
? this._fulfillAt(index) | ||
: this._rejectAt(index); | ||
Promise.prototype._resolveLast = function Promise$_resolveLast( index ) { | ||
this._setLength( 0 ); | ||
var fn; | ||
if( this.isFulfilled() ) { | ||
fn = this._fulfillAt( index ); | ||
var value = this._settledValue; | ||
var receiver = this._receiverAt(index); | ||
var promise = this._promiseAt(index); | ||
this._unsetAt(index); | ||
if (typeof handler === "function") { | ||
this._settlePromiseFromHandler(handler, receiver, value, promise); | ||
} | ||
else { | ||
fn = this._rejectAt( index ); | ||
else if (this.isFulfilled()) { | ||
promise._fulfill(value); | ||
} | ||
if( fn !== void 0 ) { | ||
this._doResolveAt(index); | ||
} | ||
else { | ||
var promise = this._promiseAt( index ); | ||
var value = this._resolvedValue; | ||
this._unsetAt( index ); | ||
if( this.isFulfilled() ) { | ||
promise._fulfill(value); | ||
} | ||
else { | ||
promise._reject(value); | ||
} | ||
promise._reject(value); | ||
} | ||
}; | ||
Promise.prototype._queueSettleAt = function Promise$_queueSettleAt(index) { | ||
this._setLength(0); | ||
this._settlePromiseAt(index); | ||
}; | ||
Promise.prototype._resolveFulfill = function Promise$_resolveFulfill( value ) { | ||
Promise.prototype._fulfillUnchecked = | ||
function Promise$_fulfillUnchecked( value ) { | ||
if( value === this ) { | ||
var err = makeSelfResolutionError(); | ||
this._attachExtraTrace( err ); | ||
return this._resolveReject( err ); | ||
return this._rejectUnchecked( err ); | ||
} | ||
this._cleanValues(); | ||
this._setFulfilled(); | ||
this._resolvedValue = value; | ||
this._settledValue = value; | ||
var len = this._length(); | ||
@@ -901,3 +892,3 @@ this._setLength( 0 ); | ||
if( this._fulfillAt( i ) !== void 0 ) { | ||
this._doResolveAt(i); | ||
this._settlePromiseAt(i); | ||
} | ||
@@ -913,11 +904,12 @@ else { | ||
Promise.prototype._resolveReject = function Promise$_resolveReject( reason ) { | ||
Promise.prototype._rejectUnchecked = | ||
function Promise$_rejectUnchecked( reason ) { | ||
if( reason === this ) { | ||
var err = makeSelfResolutionError(); | ||
this._attachExtraTrace( err ); | ||
return this._resolveReject( err ); | ||
return this._rejectUnchecked( err ); | ||
} | ||
this._cleanValues(); | ||
this._setRejected(); | ||
this._resolvedValue = reason; | ||
this._settledValue = reason; | ||
if( this._isFinal() ) { | ||
@@ -934,3 +926,3 @@ async.invokeLater( thrower, void 0, reason ); | ||
rejectionWasHandled = true; | ||
this._doResolveAt(i); | ||
this._settlePromiseAt(i); | ||
} | ||
@@ -984,3 +976,3 @@ else { | ||
Promise.prototype._pushContext = function Promise$_pushContext() { | ||
if( !longStackTraces ) return; | ||
if( !debugging ) return; | ||
contextStack.push( this ); | ||
@@ -990,3 +982,3 @@ }; | ||
Promise.prototype._popContext = function Promise$_popContext() { | ||
if( !longStackTraces ) return; | ||
if( !debugging ) return; | ||
contextStack.pop(); | ||
@@ -1034,4 +1026,4 @@ }; | ||
if( !CapturedTrace.isSupported() ) { | ||
Promise.longStackTraces = function(){}; | ||
longStackTraces = false; | ||
Promise.debugging = function(){}; | ||
debugging = false; | ||
} | ||
@@ -1038,0 +1030,0 @@ |
@@ -60,3 +60,3 @@ /** | ||
} | ||
this._fulfill( val ); | ||
this._resolve( val ); | ||
} | ||
@@ -63,0 +63,0 @@ }; |
@@ -106,3 +106,3 @@ /** | ||
if( initialValue.isFulfilled() ) { | ||
initialValue = initialValue._resolvedValue; | ||
initialValue = initialValue._settledValue; | ||
} | ||
@@ -109,0 +109,0 @@ else { |
@@ -38,3 +38,3 @@ /** | ||
if( totalResolved >= this._length ) { | ||
this._fulfill( this._values ); | ||
this._resolve( this._values ); | ||
} | ||
@@ -48,3 +48,3 @@ }; | ||
ret._bitField = 268435456; | ||
ret._resolvedValue = value; | ||
ret._settledValue = value; | ||
this._promiseResolved( index, ret ); | ||
@@ -57,3 +57,3 @@ }; | ||
ret._bitField = 134217728; | ||
ret._resolvedValue = reason; | ||
ret._settledValue = reason; | ||
this._promiseResolved( index, ret ); | ||
@@ -63,2 +63,2 @@ }; | ||
return SettledPromiseArray; | ||
}; | ||
}; |
@@ -65,12 +65,12 @@ /** | ||
SomePromiseArray.prototype._promiseFulfilled = | ||
function SomePromiseArray$_promiseFulfilled( value ) { | ||
if( this._isResolved() ) return; | ||
function SomePromiseArray$_promiseFulfilled(value) { | ||
if (this._isResolved()) return; | ||
this._addFulfilled( value ); | ||
if( this._fulfilled() === this.howMany() ) { | ||
if (this._fulfilled() === this.howMany()) { | ||
this._values.length = this.howMany(); | ||
if( this.howMany() === 1 && this._unwrap ) { | ||
this._fulfill( this._values[0] ); | ||
if (this.howMany() === 1 && this._unwrap) { | ||
this._resolve(this._values[0]); | ||
} | ||
else { | ||
this._fulfill( this._values ); | ||
this._resolve(this._values); | ||
} | ||
@@ -77,0 +77,0 @@ } |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "0.10.13-0", | ||
"version": "0.10.13-1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "promise", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
471826
9877
20