W3cubDocs

/DOM

PresentationRequest.start

When the start method is called, the user agent MUST run the following steps to start a presentation:

Input
presentationRequest, the PresentationRequest object
presentationUrls, the presentation request URLs
Output
A Promise
  1. If the algorithm isn't allowed to show a popup, return a Promise rejected with an InvalidAccessError exception and abort these steps.
  2. Using the document's settings object, run the prohibits mixed security contexts algorithm.
  3. 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 SecurityError and abort these steps.
  4. 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.
  5. If there is already an unsettled Promise from a previous call to start for the same controlling browsing context, return a Promise rejected with an OperationError exception and abort all remaining steps.
  6. Let P be a new Promise.
  7. Return P, but continue running these steps in parallel.
  8. 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.
  9. Request user permission for the use of a presentation display and selection of one presentation display.
  10. If either of the following is true:
    1. The list of available presentation displays is empty and will remain so before the request for user permission is completed.
    2. No member in the list of available presentation displays is a compatible presentation display for any member of presentationUrls.
    Then run the following steps:
    1. Reject P with a NotFoundError exception.
    2. Abort all remaining steps.
  11. If the user denied permission to use a display, reject P with an NotAllowedError exception, and abort all remaining steps.
  12. Otherwise, the user granted permission to use a display; let D be that display and U the user agent connected to D.
  13. 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 following forms 4.4 or 4.5 of [rfc4122].
  14. Create a new PresentationConnection S.
  15. Set the presentation identifier of S to I.
  16. 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.
  17. Set the presentation connection state of S to connecting.
  18. Add S to the set of controlled presentations.
  19. Resolve P with S.
  20. 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 presentationRequest. The event must not bubble, must not be cancelable, and has no default action.
  21. If any of the following steps fails, abort all remaining steps and close the presentation connection S with error as closeReason, and a human readable message describing the failure as closeMessage.
  22. Using an implementation specific mechanism, tell U to create a receiving browsing context with D, presentationUrl, and I as parameters.
  23. 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 http or https schemes; behavior for other schemes is not defined by this specification.

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PresentationRequest/start