Fix infinite coercion with Q #50

Merged
merged 1 commit into from Aug 24, 2012

Conversation

Projects
None yet
3 participants
Contributor

kriskowal commented Aug 23, 2012

Some promises, particularly Q promises, provide a valueOf method that
attempts to synchronously return the fulfilled value of the promise, or
returns the unresolved promise itself.  Attempting to break a fulfillment
value out of a promise appears to be necessary to break cycles between
Q and When attempting to coerce each-other's promises in an infinite loop.
For promises that do not implement "valueOf", the Object#valueOf is harmless.
See: kriskowal/q#106

@kriskowal kriskowal Fix infinite coercion with Q
Some promises, particularly Q promises, provide a valueOf method that
attempts to synchronously return the fulfilled value of the promise, or
returns the unresolved promise itself.  Attempting to break a fulfillment
value out of a promise appears to be necessary to break cycles between
Q and When attempting to coerce each-other's promises in an infinite loop.
For promises that do not implement "valueOf", the Object#valueOf is harmless.
See: kriskowal/q#106
fd3f4df

This pull request passes (merged fd3f4df into c0487a0).

@briancavalier briancavalier added a commit that referenced this pull request Aug 24, 2012

@briancavalier briancavalier Merge pull request #50 from kriskowal/patch-1
Fix infinite coercion with Q
1947cd0

@briancavalier briancavalier merged commit 1947cd0 into cujojs:master Aug 24, 2012

1 check passed

default The Travis build passed
Details

@briancavalier briancavalier added a commit that referenced this pull request Nov 1, 2012

@briancavalier briancavalier Fix #62. See also #50. Constrain valueOf usage only to promises to av…
…oid accidental coercion of things like Date whose valueOf doesnt return the object
84fa3f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment