This article needs a technical review. How you can help.
start method is called, the user agent MUST run the following steps to start a presentation:
- presentationRequest, the
- presentationUrls, the presentation request URLs
- A Promise
- If the algorithm isn't allowed to show a popup, return a Promise rejected with an
InvalidAccessErrorexception and abort these steps.
- 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 presentationUrl is an a priori unauthenticated URL, then return a Promise rejected with a
SecurityErrorand 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
SecurityErrorand abort these steps.
- If there is already an unsettled Promise from a previous call to
startfor the same controlling browsing context, return a Promise rejected with an
OperationErrorexception and abort all remaining steps.
- Let P be a new Promise.
- Return P, but continue running these steps in parallel.
- If the user agent is not monitoring the list of available presentation displays, run the steps to monitor the list of available presentation displays in parallel.
- Request user permission for the use of a presentation display and selection of one presentation display.
- If either of the following is true:
- The list of available presentation displays is empty and will remain so before the request for user permission is completed.
- No member in the list of available presentation displays is a compatible presentation display for any member of presentationUrls.
- If the user denied permission to use a display, reject P with an
NotAllowedErrorexception, and abort all remaining steps.
- Otherwise, the user granted permission to use a display; let D be that display and U the user agent connected to D.
- Let I be a new valid presentation identifier unique among all presentation identifiers for known presentation connections in the set of controlled presentations. To avoid fingerprinting, it is recommended that the presentation identifier be set to a UUID generated by following the forms 4.4 or 4.5 of [rfc4122].
- Create a new
- Set the presentation identifier of S to I.
- Set the presentation URL for S to the first presentationUrl in presentationUrls for which there exists an entry (presentationUrl, D) in the list of available presentation displays.
- Set the presentation connection state of S to
- 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 the
PresentationConnectionAvailableEventinterface, with the
connectionattribute initialized to S, at presentationRequest. The event must not bubble, must not be cancelable, and has no default action.
- If any of the following steps fails, abort all remaining steps and close the presentation connection S with
erroras closeReason, and a human readable message describing the failure as closeMessage.
- Using an implementation specific mechanism, tell U to create a receiving browsing context with D, presentationUrl, and I as parameters.
- Establish a presentation connection with S.
Note: The details of implementing the permission request and display selection are left to the user agent; for example it may show the user a dialog and allow the user to select an available display (granting permission), or cancel the selection (denying permission). Implementers are encouraged to show the user whether an available display is currently in use, to facilitate presentations that can make use of multiple displays.
Note: The presentationUrl should name a resource accessible to the local or a remote user agent. This specification defines behavior for presentationUrl using the
https schemes; behavior for other schemes is not defined by this specification.