getAvailability
When the getAvailability()
method is called, the user agent MUST run the following steps:
- Input
- presentationUrls, a list of presentation request URLs
- Output
- P, a Promise
- If one of the following conditions is true:
- The result of running the prohibits mixed security contexts algorithm on the document's settings object is
"Prohibits Mixed Security Contexts"
and presentationUrl is an a priori unauthenticated URL. - The document object's active sandboxing flag set has the sandboxed presentation browsing context flag set.
- Return a Promise rejected with a
SecurityError
. - Abort these steps.
- The result of running the prohibits mixed security contexts algorithm on the document's settings object is
- Let P be a new Promise.
- Return P, but continue running these steps in parallel.
- If the user agent is unable to monitor the list of available presentation displays for the entire duration of the controlling browsing context (e.g., because the user has disabled this feature), then:
- Resolve P with a new
PresentationAvailability
object with itsvalue
property set tofalse
. - Abort all the remaining steps.
- Resolve P with a new
- If the user agent is unable to continuously monitor the list of available presentation displays but can find presentation displays in order to start a connection, then:
- Reject P with a
NotSupportedError
exception. - Abort all the remaining steps.
- Reject P with a
- If there exists a tuple (A, presentationUrls) in the set of availability objects, then:
- Resolve P with A.
- Abort all the remaining steps.
- Let A be a new
PresentationAvailability
object with itsvalue
property set as follows:false
if the list of available presentation displays is empty.true
if there is at least one compatible presentation display for some member of presentationUrls. That is, there is an entry (presentationUrl, display) in the list of available presentation displays for some presentationUrl in presentationUrls.false
otherwise.
- Create a tuple (A, presentationUrls) and add it to the set of availability objects.
- Run the algorithm to monitor the list of available presentation displays.
- Resolve P with A.
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/presentationrequest/getavailability