From 34c8b84b7fd7627fddb66e47b1566a6b3f7e49bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Daoust?=
Date: Wed, 20 Apr 2016 14:36:29 +0200
Subject: [PATCH] Getting connectionList now always returns the same object
This update should address last Pull Request comments, as well as #281.
Note I ended up introducing two new idioms to talk about the Promise and
PresentationConnectionList singletons, as I believe it improves the readability
of algorithms, and makes the list of objects that user agents need to maintain
explicit.
However, as usual, finding names for things is hard. I came up with
"presentation controllers monitor" and "presentation controllers promise".
It may be possible to find better names. For instance, instead of "monitor", we
could use "manager", "holder", "wrapper", "container".
---
index.html | 101 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 62 insertions(+), 39 deletions(-)
diff --git a/index.html b/index.html
index 2bcceb9..2a1eb3d 100644
--- a/index.html
+++ b/index.html
@@ -728,6 +728,22 @@
+
+ In a receiving browsing context, the presentation
+ controllers monitor, initially set to null
,
+ exposes the current set of presentation controllers to the
+ receiving application. The presentation controllers monitor is
+ represented by a PresentationConnectionList.
+
+
+ In a receiving browsing context, the presentation
+ controllers promise, which is initially set to
+ null
, exposes the presentation controllers
+ monitor once the initial presentation connection is
+ established. The presentation controllers promise is
+ represented by a Promise that holds the presentation
+ controllers monitor.
+
- When the PresentationReceiver object is created, a
- PresentationConnectionList object is also created and
- associated with that PresentationReceiver object.
-
On getting, the connectionList
attribute MUST return the result of running the following steps:
- - If there is already an unsettled Promise P from
- a previous call to get the connectionList attribute for the same
- PresentationReceiver object, return P and abort all
- remaining steps.
+
- If the presentation controllers promise is not
+
null
, return the presentation controllers promise
+ and abort all remaining steps.
- - Let P be a new Promise.
+
- Otherwise, let the presentation controllers promise be a
+ new Promise.
- - Return P, but continue running these steps in
- parallel.
+
- Return the presentation controllers promise, but continue
+ running these steps in parallel.
- If the set of presentation controllers contains at least
- one presentation connection, resolve P with
- the PresentationConnectionList object associated with the
- PresentationReceiver object.
+ one presentation connection, then run the following steps:
+
+ - Let the presentation controllers monitor be a new
+ PresentationConnectionList.
+
+ -
+ Resolve the presentation controllers promise with
+ the presentation controllers monitor.
+
+
- - Otherwise, P remains unsettled and associated with the
- PresentationReceiver object.
+
- Otherwise, the presentation controllers promise remains
+ unsettled.
@@ -2423,24 +2439,31 @@
Add S to the set of presentation controllers.
- If there is an unsettled Promise P from a
- previous call to get the connectionList attribute for the same
- PresentationReceiver object, resolve P
- with the PresentationConnectionList object associated with
- the PresentationReceiver object and abort all remaining
- steps.
+ If the presentation controllers promise is
+ null
, then abort all remaining steps.
-
- Queue a task to fire a trusted event with
- the name connectionavailable, that uses
- the PresentationConnectionAvailableEvent interface, with
- the connection
- attribute initialized to S, at the
- PresentationConnectionList object associated with the
- PresentationReceiver object. The event must not bubble,
- must not be cancelable, and has no default action.
+ Otherwise, if the presentation controllers promise is
+ unsettled, then run the following steps:
+
+ - Let the presentation controllers monitor be a new
+ PresentationConnectionList.
+
+ -
+ Resolve the presentation controllers promise
+ with the presentation controllers monitor.
+
+ - Abort all remaining steps.
+
+
+
+ Otherwise, queue a task to fire a trusted
+ event with the name connectionavailable, that uses the
+ PresentationConnectionAvailableEvent interface, with the
+ connection
+ attribute initialized to S, at the presentation
+ controllers monitor. The event must not bubble, must not be
+ cancelable, and has no default action.