From 214830c7600ef999d166c677b1993b0eedfeac2a Mon Sep 17 00:00:00 2001
From: Mark Foltz
Date: Fri, 20 Sep 2024 11:52:19 -0700
Subject: [PATCH] Fix task queueing. (#524)
* Fix task queueing
* Convert more tasks
* Address feedback from tidoust
* Make further adjustments
* Fix typo
* Further adjust termiantion steps
* Update algo to handle a termination confirmation
---
index.html | 131 +++++++++++++++++++++++++++++++++--------------------
1 file changed, 82 insertions(+), 49 deletions(-)
diff --git a/index.html b/index.html
index 1746c40..b1a8801 100644
--- a/index.html
+++ b/index.html
@@ -49,7 +49,7 @@
sotdAfterWGinfo: true,
group: 'secondscreen',
github: 'https://github.com/w3c/presentation-api',
- xref: ['dom', 'fileapi', 'secure-contexts', 'html', 'url', 'webidl', 'webrtc', 'websockets'],
+ xref: ['dom', 'fileapi', 'secure-contexts', 'html', 'url', 'webidl', 'webrtc', 'websockets', 'infra'],
localBiblio: {
DIAL: {
title: 'DIscovery And Launch Protocol Specification',
@@ -291,8 +291,9 @@
context of {{Promise}} objects are used as defined in [[!ECMASCRIPT]].
- The terms Accept-Language
- and HTTP authentication are
+ The terms Accept-Language and
+ HTTP authentication are
used as defined in [[!RFC9110]].
@@ -835,7 +836,14 @@
The task source for the tasks mentioned in this specification
- is the presentation task source.
+ is the presentation task source.
+
+
+ When an algorithm queues
+ a Presentation API task T, the user agent
+ MUST queue a global task T on the presentation
+ task source using the global object of the current
+ realm.
Unless otherwise specified, the JavaScript realm for script
@@ -1104,16 +1112,16 @@
Then run the following steps:
-
- Reject P with a {{NotFoundError}}
- exception.
+ Queue a Presentation API task to reject
+ P with a {{NotFoundError}} exception.
- Abort all remaining steps.
-
If the user denies permission to use a display, reject
- P with an {{NotAllowedError}} exception, and abort all
- remaining steps.
+ If the user denies permission to use a display,
+ queue a Presentation API task to reject P with an
+ {{NotAllowedError}} exception, and abort all remaining steps.
Otherwise, the user grants permission to use a
display; let D be that display.
@@ -1175,6 +1183,8 @@
- Resolve P with A.
+ Queue a Presentation API task to resolve
+ P with A.
@@ -1674,6 +1691,9 @@
steps:
+ -
+ Assert: this is running in parallel.
+
- Let availabilitySet be a shallow copy of the set
of presentation availability objects.
@@ -1741,8 +1761,8 @@
newAvailability and skip the following step.
- If previousAvailability is not equal to
- newAvailability, then queue a task to run the
- following steps:
+ newAvailability, then queue a Presentation API
+ task to run the following steps:
- Set A's value property to
newAvailability.
@@ -2025,6 +2045,9 @@
+ -
+ Assert: this is running in parallel.
+
- If the presentation connection state of
presentationConnection is not connecting, then abort all
@@ -2035,8 +2058,8 @@
identifier of presentationConnection MUST be sent
with this request.
- - If connection completes successfully, queue a task to
- run the following steps:
+
- If connection completes successfully, queue a Presentation
+ API task to run the following steps:
- Set the presentation connection state of
presentationConnection to
+ -
+ Assert: this is running in parallel.
+
- If the state property of
presentationConnection is not connected, abort these steps.
@@ -2220,8 +2246,8 @@
-
- Queue a task to [=fire an event|fire=] event at
- presentationConnection.
+ Queue a Presentation API task to [=fire an event|fire=]
+ event at presentationConnection.
@@ -2386,7 +2412,7 @@
presentationConnection, then abort the remaining steps.
-
- Queue a task to run the following steps:
+ Queue a Presentation API task to run the following steps:
- If the presentation connection state of
presentationConnection is not
connection is connected or
connecting,
- then queue a task to run the following steps:
+ then queue a global task on the presentation task
+ source given known connection's relevant
+ global object to run the following steps:
- Set the presentation connection state of
known connection to
-
- Send a termination request for the presentation to its
- receiving user agent using an implementation specific
- mechanism.
+ In parallel, send a termination request for the
+ presentation to its receiving user agent using an
+ implementation specific mechanism.
@@ -2535,10 +2563,10 @@
the user interface and discard it.
- For each connection in
- connectedControllers, queue a task to send a
- termination confirmation for P using an implementation
- specific mechanism to the controlling user agent that owns
- the destination browsing context for connection.
+ connectedControllers, send a termination confirmation
+ for P using an implementation specific mechanism to the
+ controlling user agent that owns the destination browsing
+ context for connection.
Only one termination confirmation needs to be sent per
controlling user agent.
@@ -2559,7 +2587,9 @@
- For each connection in the set of controlled
presentations that was connected to P, queue a
- task to run the following steps:
+ global task on the presentation task source given
+ connection's relevant global object to run the
+ following steps:
- If the presentation connection state of
connection is not
+ -
+ Assert: this is running in parallel.
+
- If presentationId and I are not equal,
refuse the connection and abort all remaining steps.
@@ -2920,9 +2953,9 @@
the set of presentation controllers.
- If the presentation controllers promise is not
-
null
, resolve the presentation
- controllers promise with the presentation controllers
- monitor.
+ null
, queue a Presentation API task to
+ resolve the presentation controllers promise with
+ the presentation controllers monitor.
- Abort all remaining steps.
@@ -2934,8 +2967,8 @@
the set of presentation controllers.
-
- Queue a task to [=fire an event=] named
- Queue a Presentation API task to [=fire an event=]
+ named connectionavailable, that
uses the PresentationConnectionAvailableEvent
interface, with the