[presentation-api] Pull Request: Algorithms updated to use "queue a task" only when needed

tidoust has just submitted a new pull request for 
https://github.com/w3c/presentation-api:

== Algorithms updated to use "queue a task" only when needed ==
This should address issue #231.

In particular, "queue a task" is now only used to schedule events and 
to create a synchronization point between algorithms or parts of 
algorithms that run in the background and the event loop, e.g. to 
update property values on objects exposed to JavaScript code.

The "close a presentation connection" algorithm could perhaps be 
further improved: as things stand, it gets closed both as part of the 
event loop when "close" is called or when some connection error is 
detected in the background. In the former case, it should update the 
presentation connection state immediately. In the latter case, it 
should only update the presentation connection state as part of a 
proper task. I updated the prose that called this algorithm from the 
background to add a "queue a task", which does the job but may not be 
the best way to phrase it.

(Again looking at how things are done in WebSockets, I see that 
calling "close" [1] actually switches the state to "closing" and 
triggers a "closing algorithm" that will run in the background and 
eventually queue a task to update the state to "closed" and fire an 
event. I do not know if we really need to expose a "closing" state in 
our case)

@mfoltzgoogle, note that in 6.5, the spec mentioned the need to run 
steps 1 and 4 or 5 of the close algorithm but these steps did not 
really exist. I updated that to target steps 1 and 5 or 6 in the new 
version but I'm not convinced this is what you had in mind.

[1] 
https://html.spec.whatwg.org/multipage/comms.html#dom-websocket-close


See https://github.com/w3c/presentation-api/pull/234

Received on Tuesday, 5 January 2016 16:55:34 UTC