PresentationRequest.reconnect()
When the reconnect(presentationId)
method is called on a PresentationRequest
presentationRequest, the user agent MUST run the following steps to reconnect to a presentation:
Input
-
presentationRequest, the
PresentationRequest
object thatreconnect()
was called on. - presentationId, a valid presentation identifier
Output
P, a Promise.
Algorithm
- Using the document's settings object run the prohibits mixed security contexts algorithm.
- If the result of the algorithm is
"Prohibits Mixed Security Contexts"
and the presentation request URL of presentationRequest is an a priori unauthenticated URL, then return a Promise rejected with aSecurityError
and abort these steps. - If the document object's active sandboxing flag set has the sandboxed presentation browsing context flag set, then return a Promise rejected with a
SecurityError
and abort these steps. - Let P be a new Promise.
- Return P but continue running these steps in parallel.
- Search the set of controlled presentations for a
PresentationConnection
that meets the following criteria: its controlling browsing context is the current browsing context, its presentation connection state is notterminated
, its presentation URL is equal to one of the presentation request URLs of presentationRequest and its presentation identifier is equal to presentationId. - If such a
PresentationConnection
exists, run the following steps:- Let S be that
PresentationConnection
. - Resolve P with S.
- If the presentation connection state of S is
connecting
orconnected
, then abort all remaining steps. - Set the presentation connection state of S to
connecting
. - Establish a presentation connection with S.
- Abort all remaining steps.
- Let S be that
- Search the set of controlled presentations for the first
PresentationConnection
that meets the following criteria: its presentation connection state is notterminated
, its presentation URL is equal to one of the presentation request URLs of presentationRequest, and its presentation identifier is equal to presentationId. - If such a
PresentationConnection
exists, let E be thatPresentationConnection
, and run the following steps:- Create a new
PresentationConnection
S. - Set the presentation identifier of S to presentationId.
- Set the presentation URL of S to the presentation URL of E.
- Set the presentation connection state of S to
connecting
. - Add S to the set of controlled presentations.
- Resolve P with S.
-
Queue a task to fire a trusted event with the name
connectionavailable
, that uses thePresentationConnectionAvailableEvent
interface with theconnection
attribute initialized to S, at presentationRequest. The event must not bubble and cancelable and should have no default action. - Establish a presentation connection with S.
- Abort all remaining steps.
- Create a new
-
Reject P with a
NotFoundError
exception.
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
reconnect |
48 |
79 |
51-88 |
No |
35 |
No |
No |
48 |
51-79 |
35 |
No |
5.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PresentationRequest/reconnect