[Promises] Out-of-sequence method invocation behavior

Rich Tibbett <[email protected]>
Newsgroups gmane.comp.web.dom.general
Message-ID <CAAsrAZBQJ3Rb=oTpkXdb3PhmMT0cxPeU-Yrj-pVex5ne95UrRQ@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.