From df45672ef3ecf26669260d0069584abe24f637ae Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Thu, 19 Nov 2015 13:26:29 -0800 Subject: [PATCH] Update PresentationReceiver spec to match the results from the discussions in #201. --- index.html | 220 +++++++++++++++++++++++------------------------------ 1 file changed, 94 insertions(+), 126 deletions(-) diff --git a/index.html b/index.html index 3cfc867..ac74433 100644 --- a/index.html +++ b/index.html @@ -995,7 +995,7 @@

attribute EventHandler onchange; }; - +

A PresentationAvailability object is associated @@ -1178,7 +1178,7 @@

attribute EventHandler onconnectionavailable; }; - +

A PresentationRequest object is associated with a @@ -1650,24 +1650,6 @@

-
-

- Establishing a presentation connection in a receiving browsing - context -

-

- When a new receiving browsing context has been created and - navigated to the presentationUrl on a user-selected - presentation display, the user agent MUST run the following - steps: -

-
    -
  1. - Queue a task to start monitoring incoming presentation - connections from controlling browsing contexts. -
  2. -
-

Event Handlers @@ -1715,7 +1697,7 @@

required PresentationConnection connection; }; - +

A controlling user agent MUST fire an event named @@ -1725,8 +1707,8 @@

PresentationConnectionAvailableEvent interface, with the connection attribute set to the PresentationConnection - object that was created. The event is fired for all connections - that are created for the controller, either by the + object that was created. The event is fired for each connection + that is created for the controller, either by the controller calling start() or reconnect(), or by the controlling user agent creating a connection on the controller's behalf via

- Interface PresentationReceiver + Interface PresentationConnectionList

-          interface PresentationReceiver : EventTarget {
-            Promise<PresentationConnection> getConnection();
-            Promise<sequence<PresentationConnection>> getConnections();
+          interface PresentationConnectionList : EventTarget {
+            readonly attribute FrozenArray<PresentationConnection> connections;
             attribute EventHandler onconnectionavailable;
           };
 
-        
+
 

- The PresentationReceiver object is available to a receiving - browsing context in order to access the controlling browsing context and - communicate with it. The PresentationReceiver - object MUST be implemented in a receiving browsing context - provided by a receiving user agent. + The connections attribute + MUST return a non-terminated set of presentations connections + available for the receiving browsing context.

@@ -1797,23 +1775,22 @@

  • Queue a task to fire an event named - connectionavailable at presentation.receiver. + connectionavailable at all + PresentationConnectionList.
  • A receiving user agent MUST fire an event named - connectionavailable on a PresentationReceiver - when a connection associated with the object is created. It is - fired at the PresentationReceiver instance, using the - PresentationConnectionAvailableEvent interface, with the - connection - attribute set to the PresentationConnection - object that was created. The event is fired for all connections - that are created for the presentation when monitoring - incoming presentation connections. + connectionavailable on all + PresentationConnectionList when a connection is created. It + is fired using the PresentationConnectionAvailableEvent + interface, with the connection attribute set + to the PresentationConnection object that was + created. The event is fired for all connections that are created + when monitoring incoming presentation connections.

    The receiving user agent MUST fire the event as soon as it @@ -1821,83 +1798,6 @@

    associated with the event.

    -
    -

    - Getting the first presentation connection on the startup of a - receiving browsing context -

    -

    - When the getConnection() method is - called, the user agent MUST run the following steps: -

    -
      -
    1. Let P be a new Promise. -
    2. -
    3. Return P. -
    4. -
    5. - Queue a task T to run the following steps in - order: -
        -
      1. If the set of presentations is empty, then wait - until at least one element is added to the set of - presentations. -
      2. -
      3. Let S be the first presentation - connection added to the set of presentations. -
      4. -
      5. - Resolve P with S. -
      6. -
      -
    6. -
    -
    - If the set of presentations is empty, we leave the - Promise pending until connecting request arrives from the - controlling browsing context. If the first controlling - browsing context disconnects after initial connection, then the - Promise returned to subsequent calls to getConnection() will resolve with - a presentation connection that has its presentation - connection state set to closed. -
    -
    -
    -

    - Getting all connected presentation connections in a receiving - browsing context -

    -

    - When the getConnections() method is - called, the user agent MUST run the following steps: -

    -
      -
    1. Let P be a new Promise. -
    2. -
    3. Return P. -
    4. -
    5. - Queue a task to run the following steps in order: -
        -
      1. Let array be an empty array. -
      2. -
      3. For each known connection in the set of - presentations -
          -
        1. Add known connection to array. -
        2. -
        -
      4. -
      5. - Resolve P with array. -
      6. -
      -
    6. -
    -

    Event Handlers @@ -1905,10 +1805,10 @@

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL - attributes, by objects implementing the PresentationReceiver - interface: + attributes, by objects implementing the + PresentationConnectionList interface:

    - +
    @@ -1932,6 +1832,74 @@

    +
    +

    + Interface PresentationReceiver +

    +
    +          interface PresentationReceiver {
    +            [SameObject] readonly attribute Promise<PresentationConnectionList> connections;
    +          };
    +
    +
    +
    +
    +

    + The text about "PresentationReceiver object" should probably move + to the section about the Presentation interface. This section is + about the interface, not its instance (the object). +

    +

    + Furthermore, we probably need a better way to explain how + PresentationConnectionList is initialized -- how the set of + presentations is populated. This is addressed in issue + #193. +

    +
    +

    + The PresentationReceiver object is available to a receiving + browsing context in order to access the controlling browsing context and + communicate with it. The PresentationReceiver + object MUST be implemented in a receiving browsing context + provided by a receiving user agent. +

    +

    + For each PresentationReceiver, there is a connection list + promise which is initially set to null. It is a + Promise object which holds a + PresentationConnectionList. +

    +
      +
    1. If connection list promise is not null, + return connection list promise and abort these steps. +
    2. +
    3. Otherwise, set connection list promise be a new + Promise. +
    4. +
    5. Return p. +
    6. +
    7. Run the following substeps asynchronously: +
        +
      1. Let list be a new + PresentationConnectionList. +
      2. +
      3. Initialize list with the set of + presentations associated with the receiving browsing + context. +
      4. +
      5. If the user agent is not monitoring incoming presentation + connections, queue a task to start monitoring + incoming presentation connections from controlling + browsing contexts. +
      6. +
      7. Resolve p with list. +
      8. +
      +
    8. +
    +

    Interface Presentation @@ -1945,7 +1913,7 @@

    attribute PresentationRequest? defaultRequest; [SameObject] readonly attribute PresentationReceiver? receiver; }; - +

    The presentation attribute is