[Promises] Out-of-sequence method invocation behavior

In the XMLHttpRequest spec the state machine is used to define the expected
behavior when XHR object methods are called out of sequence. For example,
if I invoke send() when an XHR object is not in the |opened| state then
implementations are expected to throw an InvalidStateError exception [1].

What is the expected behavior of Promises wrt out of sequence method
invocation? Specifically, if I call myPromise.then(func) after the Promise
has already reached the |fulfilled| state what should the UA do? Throw an
InvalidStateError (ala XHR), invoke the relevant fulfill or error callback
based on the object's previously established resolution or some other
behavior?

Looking through the mailing list archives I found [2] but believe that
differs from this discussion since it attempts to clarify the resolution
behavior rather than attempting to clarify consumer-side late/out-of-order
fulfill and reject callback invocation, as discussed here.

br/ Rich

[1] http://www.w3.org/TR/XMLHttpRequest/#the-send()-method

[2] http://lists.w3.org/Archives/Public/www-dom/2013AprJun/0283.html

Received on Monday, 29 July 2013 01:46:42 UTC