Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1100013 of reconnect

  • Revision slug: Web/API/PresentationRequest/reconnect
  • Revision title: reconnect
  • Revision id: 1100013
  • Created:
  • Creator: PushpitaPikuDey
  • Is current revision? No
  • Comment

Revision Content

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 that reconnect() was called on.
presentationId, a valid presentation identifier
Output
P, a Promise
  1. Using the document's settings object run the prohibits mixed security contexts algorithm.
  2. 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 a SecurityError and abort these steps.
  3. 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.
  4. Let P be a new Promise.
  5. Return P but continue running these steps in parallel.
  6. 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 not terminated, its presentation URL is equal to one of the presentation request URLs of presentationRequest and its presentation identifier is equal to presentationId.
  7. If such a PresentationConnection exists, run the following steps:
    1. Let S be that PresentationConnection.
    2. Resolve P with S.
    3. If the presentation connection state of S is connecting or connected, then abort all remaining steps.
    4. Set the presentation connection state of S to connecting.
    5. Establish a presentation connection with S.
    6. Abort all remaining steps.
  8. Search the set of controlled presentations for the first PresentationConnection that meets the following criteria: its presentation connection state is not terminated, its presentation URL is equal to one of the presentation request URLs of presentationRequest, and its presentation identifier is equal to presentationId.
  9. If such a PresentationConnection exists, let E be that PresentationConnection, and run the following steps:
    1. Create a new PresentationConnection S.
    2. Set the presentation identifier of S to presentationId.
    3. Set the presentation URL of S to the presentation URL of E.
    4. Set the presentation connection state of S to connecting.
    5. Add S to the set of controlled presentations.
    6. Resolve P with S.
    7. 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 and cancelable and should have no default action.
    8. Establish a presentation connection with S.
    9. Abort all remaining steps.
  10. Reject P with a NotFoundError exception.

Revision Source

<p>When the <code><dfn data-dfn-for="presentationrequest" data-dfn-type="dfn" data-idl="" id="dom-presentationrequest-reconnect">reconnect</dfn>(presentationId)</code> method is called on a <code>PresentationRequest</code> <var>presentationRequest</var>, the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-user-agents">user agent</a> <em class="rfc2119" title="MUST">MUST</em> run the following steps to <dfn data-dfn-type="dfn" id="dfn-reconnect-to-a-presentation">reconnect to a presentation</dfn>:</p>

<dl>
 <dt>Input</dt>
 <dd><var>presentationRequest</var>, the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationrequest"><code>PresentationRequest</code></a> object that <code><a class="internalDFN" data-for="PresentationRequest" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationrequest-reconnect"><code>reconnect</code></a>()</code> was called on.</dd>
 <dd><var>presentationId</var>, a valid <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-identifier">presentation identifier</a></dd>
 <dt>Output</dt>
 <dd><var>P</var>, a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-promise">Promise</a></dd>
</dl>

<ol>
 <li>Using the document's <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-settings-object">settings object</a> run the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-prohibits-mixed-security-contexts-algorithm">prohibits mixed security contexts algorithm</a>.</li>
 <li>If the result of the algorithm is <code>"Prohibits Mixed Security Contexts"</code> and the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-request-urls">presentation request URL</a> of <var>presentationRequest</var> is an <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-a-priori-unauthenticated-url">a priori unauthenticated URL</a>, then return a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-promise">Promise</a> rejected with a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-securityerror"><code>SecurityError</code></a> and abort these steps.</li>
 <li>If the document object's <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-active-sandboxing-flag-set">active sandboxing flag set</a> has the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#sandboxed-presentation-browsing-context-flag">sandboxed presentation browsing context flag</a> set, then return a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-promise">Promise</a> rejected with a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-securityerror"><code>SecurityError</code></a> and abort these steps.</li>
 <li>Let <var>P</var> be a new <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-promise">Promise</a>.</li>
 <li>Return <var>P</var> but continue running these steps in parallel.</li>
 <li>Search the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-set-of-controlled-presentations">set of controlled presentations</a> for a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a> that meets the following criteria: its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-controlling-browsing-context">controlling browsing context</a> is the current <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-browsing-context">browsing context</a>, its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-connection-state">presentation connection state</a> is not <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-terminated"><code>terminated</code></a>, its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-url">presentation URL</a> is equal to one of the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-request-urls">presentation request URLs</a> of <var>presentationRequest</var> and its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-identifier">presentation identifier</a> is equal to <var>presentationId</var>.</li>
 <li>If such a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a> exists, run the following steps:
  <ol>
   <li>Let <var>S</var> be that <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a>.</li>
   <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-resolving-a-promise">Resolve</a> <var>P</var> with <var>S</var>.</li>
   <li>If the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-connection-state">presentation connection state</a> of <var>S</var> is <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-connecting"><code>connecting</code></a> or <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-connected"><code>connected</code></a>, then abort all remaining steps.</li>
   <li>Set the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-connection-state">presentation connection state</a> of <var>S</var> to <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-connecting"><code>connecting</code></a>.</li>
   <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-establish-a-presentation-connection">Establish a presentation connection</a> with <var>S</var>.</li>
   <li>Abort all remaining steps.</li>
  </ol>
 </li>
 <li>Search the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-set-of-controlled-presentations">set of controlled presentations</a> for the first <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a> that meets the following criteria: its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-connection-state">presentation connection state</a> is not <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-terminated"><code>terminated</code></a>, its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-url">presentation URL</a> is equal to one of the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-request-urls">presentation request URLs</a> of <var>presentationRequest</var>, and its <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-identifier">presentation identifier</a> is equal to <var>presentationId</var>.</li>
 <li>If such a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a> exists, let <var>E</var> be that <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a>, and run the following steps:
  <ol>
   <li>Create a new <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnection"><code>PresentationConnection</code></a> <var>S</var>.</li>
   <li>Set the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-identifier">presentation identifier</a> of <var>S</var> to <var>presentationId</var>.</li>
   <li>Set the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-url">presentation URL</a> of <var>S</var> to the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-url"> presentation URL</a> of <var>E</var>.</li>
   <li>Set the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-presentation-connection-state">presentation connection state</a> of <var>S</var> to <a class="internalDFN" data-for="PresentationConnectionState" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dom-presentationconnectionstate-connecting"><code>connecting</code></a>.</li>
   <li>Add <var>S</var> to the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-set-of-controlled-presentations">set of controlled presentations</a>.</li>
   <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-resolving-a-promise">Resolve</a> <var>P</var> with <var>S</var>.</li>
   <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-queue-a-task">Queue a task</a> to <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-firing-an-event">fire</a> a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-trusted-event">trusted event</a> with the name <a class="internalDFN" data-for="PresentationRequest" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-connectionavailable"><code>connectionavailable</code></a>, that uses the <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnectionavailableevent"><code>PresentationConnectionAvailableEvent</code></a> interface with the <a class="internalDFN" data-for="PresentationConnectionAvailableEvent" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#idl-def-presentationconnectionavailableevent-connection"><code>connection</code></a> attribute initialized to <var>S</var>, at <var>presentationRequest</var>. The event must not bubble and cancelable and should have no default action.</li>
   <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-establish-a-presentation-connection">Establish a presentation connection</a> with <var>S</var>.</li>
   <li>Abort all remaining steps.</li>
  </ol>
 </li>
 <li><a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-rejecting-a-promise">Reject</a> <var>P</var> with a <a class="internalDFN" data-link-type="dfn" href="https://www.w3.org/TR/presentation-api/#dfn-notfounderror"><code>NotFoundError</code></a> exception.</li>
</ol>
Revert to this revision