W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2013

[Promises] Out-of-sequence method invocation behavior

From: Rich Tibbett <richt@opera.com>
Date: Mon, 29 Jul 2013 11:46:15 +1000
Message-ID: <CAAsrAZBQJ3Rb=oTpkXdb3PhmMT0cxPeU-Yrj-pVex5ne95UrRQ@mail.gmail.com>
To: www-dom@w3.org
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:03 UTC