W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2015

Re: Need guidance on promise-returning methods on a stateful object

From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Mon, 19 Oct 2015 15:17:12 -0400
To: Anne van Kesteren <annevk@annevk.nl>, Adam Bergkvist <adam.bergkvist@ericsson.com>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <562541B8.6010202@mozilla.com>
(Jumping in)

On 10/16/15 1:13 PM, Anne van Kesteren wrote:
> On Fri, Oct 16, 2015 at 6:55 PM, Adam Bergkvist
> <adam.bergkvist@ericsson.com> wrote:
>> Here's a simplified description of the algorithm. I hope it clarifies
>> where things live.
>> 1. Let p be a new promise.
>> 2. In paralell, do 'install configuration'.
>>     1. If 'install configuration' completes successfully, queue a task to
>> run the following steps:
>>       1. (possibly check for closed state, reject p and abort?)
>>       2. Resolve p with undefined.
>> 3. Return p.
>> So while the 'install configuration' processing is going on in some
>> other thread (not main), the instance might go to the closed state. When
>> that happens, you can't really do anything else with the instance
>> besides reading some attributes. So when this happens, should we reject
>> all pending promises, or just leave them be?
> In the abstract, what I don't understand is why the state transition
> to closed wouldn't terminate any existing algorithms. (You didn't
> really clarify on how the state transition happens and where that
> change process lives.)

In at least one implementation the transition to closed does terminate 
existing algorithms, but the question remains whether to reject promises 
at that point or stay silent.

.: Jan-Ivar :.
Received on Monday, 19 October 2015 19:17:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:24 UTC