Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an algorithm for creating a receiving browsing context #219

Merged
merged 4 commits into from
Nov 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 152 additions & 75 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,19 @@ <h2>
<dfn><a href="http://www.w3.org/TR/html5/webappapis.html">queue a
task</a></dfn>, <dfn><a href=
"http://www.w3.org/TR/html5/infrastructure.html#concept-events-trusted">
trusted event</a></dfn>, and <dfn><a href=
trusted event</a></dfn>, <dfn><a href=
"http://www.w3.org/TR/html5/browsers.html#allowed-to-show-a-popup">allowed
to show a popup</a></dfn> are defined in [[!HTML5]].
to show a popup</a></dfn>, <dfn><a href=
"http://www.w3.org/TR/html5/browsers.html#top-level-browsing-context">top-level
browsing context</a></dfn>, <dfn><a href=
"http://www.w3.org/TR/html5/browsers.html#session-history">session
history</a></dfn>, <dfn><a href=
"http://www.w3.org/TR/html5/browsers.html#sandboxed-auxiliary-navigation-browsing-context-flag">
sandboxed auxiliary navigation browsing context flag</a></dfn>, and
<dfn><a href=
"http://www.w3.org/TR/html5/browsers.html#sandboxed-top-level-navigation-browsing-context-flag">
sandboxed top-level navigation browsing context flag</a></dfn> are
defined in [[!HTML5]].
</p>
<p>
This document provides interface definitions using the Web IDL standard
Expand Down Expand Up @@ -377,6 +387,30 @@ <h2>
"http://w3c.github.io/webrtc-pc/#idl-def-RTCDataChannel">RTCDataChannel</a></dfn>
is defined in the WebRTC API specification [[WEBRTC]].
</p>
<p>
The term <dfn><a href=
"http://tools.ietf.org/html/rfc6265#section-4.2">cookie store</a></dfn>
is defined in RFC 6265 [[COOKIES]].
</p>
<p>
The terms <dfn data-lt="permission|permissions"><a href=
"https://w3c.github.io/permissions/#idl-def-Permission">permission</a></dfn>
and <dfn><a href=
"https://w3c.github.io/permissions/#idl-def-PermissionState">permission
state</a></dfn> are defined in [[PERMISSIONS]].
</p>
<p>
The term <dfn data-lt="database|databases"><a href=
"http://www.w3.org/TR/IndexedDB/#database-concept">database</a></dfn>
is defined in [[INDEXEDDB]].
</p>
<p>
The terms <dfn><a href=
"http://www.w3.org/TR/webstorage/#the-localstorage-attribute"><code>localStorage</code></a></dfn>
and <dfn><a href=
"http://www.w3.org/TR/webstorage/#the-sessionstorage-attribute"><code>sessionStorage</code></a></dfn>
are defined in [[WEBSTORAGE]].
</p>
</section>
<section>
<h2>
Expand Down Expand Up @@ -606,7 +640,8 @@ <h3>
browsing context responsible for rendering to a <a>presentation
display</a>. A <a>receiving browsing context</a> can reside in the
same user agent as the <a>controlling browsing context</a> or a
different one.
different one. A <a>receiving browsing context</a> is created by
following the steps to <a>create a receiving browsing context</a>.
</p>
<p>
The <dfn>set of presentations</dfn>, initially empty, contains the
Expand Down Expand Up @@ -1233,33 +1268,35 @@ <h4>
<li>If there is already an unsettled <a>Promise</a> from a previous
call to <code>start</code> for the same <a>controlling browsing
context</a>, return a <a>Promise</a> rejected with an
<a>OperationError</a> exception and abort these steps.
<a>OperationError</a> exception and abort all remaining steps.
</li>
<li>Let <em>P</em> be a new <a>Promise</a>.
</li>
<li>Return <em>P</em>.
</li>
<li>Run the following steps:
<li>Run the following steps in parallel:
<ol>
<li>
<a>Monitor the list of available presentation displays</a>.
</li>
<li>Wait until the algorithm completes.
<li>
<a>Queue a task</a> <em>T</em> to request user permission for
the use of a <a>presentation display</a> and selection of one
presentation display.
</li>
</ol>
</li>
<li>If either of the following is true:
<ol>
<li>The <a>list of available presentation displays</a> is
empty;
<li>The <a>list of available presentation displays</a> is empty
and will remain so before the request for user permission is
completed.
</li>
<li>No member if the list of available presentation displays is
a <a>compatible presentation display</a> for
<code>presentationUrl</code>;
<li>No member if the <a>list of available presentation
displays</a> is a <a>compatible presentation display</a> for
<code>presentationUrl</code>.
</li>
</ol>
</li>
<li>Then run the following steps:
</ol>Then run the following steps:
<ol>
<li>
<a>Reject</a> <em>P</em> with a <a>NotFoundError</a>
Expand All @@ -1269,73 +1306,53 @@ <h4>
</li>
</ol>
</li>
<li>If <em>T</em> completes with the user <em>denying
permission</em>, reject <em>P</em> with an <a>AbortError</a>
exception, and abort all remaining steps.
</li>
<li>Otherwise, <em>T</em> has completed with the user <em>granting
permission</em> to use a display; let <em>D</em> be that display.
</li>
<li>
<a>Queue a task</a> <em>T</em> to request user permission for the
use of a <a>presentation display</a> and selection of one
presentation display.
<a>Queue a task</a> <em>C</em> to run the following steps:
<ol>
<li>If <em>T</em> completes with the user <em>granting
permission</em> to use a display, <a>queue a task</a>
<em>C</em> to create a new <a>browsing context</a> on the
user-selected <a>presentation display</a> and <a>navigate</a>
to <code>presentationUrl</code> in it.
<ol>
<li>If <em>C</em> completes successfully, run the following
steps:
<ol>
<li>Let <var>I</var> be a new <a>valid presentation
identifier</a> unique among all <a>presentation
identifiers</a> for known presentations in the <a>set
of presentations</a>.
</li>
<li>Create a new <a>PresentationConnection</a>
<em>S</em>.
</li>
<li>Set the <a>presentation identifier</a> of
<var>S</var> to <var>I</var>, and set the
<a>presentation connection state</a> of <var>S</var> to
<code>disconnected</code>.
</li>
<li>Add the tuple {<em>presentationUrl</em>,
<em>S.id</em>, <em>S</em>} to the <a>set of
presentations</a>.
</li>
<li>
<a>Resolve</a> <em>P</em> with <em>S</em>.
</li>
<li>
<a>Queue a task</a> to <a>fire</a> an event named
<code>connectionavailable</code> at
<code>presentationRequest</code> with <em>S</em> as
its <code>connection</code> attribute.
</li>
<li>
<a>Establish a presentation connection</a> with
<em>S</em>.
</li>
</ol>
</li>
<li>If <em>C</em> fails, run the following steps:
<ol>
<li>
<a>Reject</a> P with an <a>OperationError</a>
exception.
</li>
</ol>
</li>
</ol>
<li>
<a>Create a receiving browsing context</a> on <em>D</em> and
let <em>R</em> be the result.
</li>
<li>If <em>T</em> completes with the user <em>denying
permission</em>, run the following steps:
<ol>
<li>
<a>Reject</a> <em>P</em> with an <a>AbortError</a>
exception.
</li>
</ol>
<li>
<a>Navigate</a> <em>R</em> to <code>presentationUrl</code>.
</li>
</ol>
</li>
<li>If <em>C</em> fails, <a>reject</a> P with an
<a>OperationError</a> exception and abort all remaining steps.
</li>
<li>Let <var>I</var> be a new <a>valid presentation identifier</a>
unique among all <a>presentation identifiers</a> for known
presentations in the <a>set of presentations</a>.
</li>
<li>Create a new <a>PresentationConnection</a> <em>S</em>.
</li>
<li>Set the <a>presentation identifier</a> of <var>S</var> to <var>
I</var>, and set the <a>presentation connection state</a> of
<var>S</var> to <code>disconnected</code>.
</li>
<li>Add the tuple {<em>presentationUrl</em>, <em>S.id</em>,
<em>S</em>} to the <a>set of presentations</a>.
</li>
<li>
<a>Resolve</a> <em>P</em> with <em>S</em>.
</li>
<li>
<a>Queue a task</a> to <a>fire</a> an event named
<code>connectionavailable</code> at
<code>presentationRequest</code> with <em>S</em> as its
<code>connection</code> attribute.
</li>
<li>
<a>Establish a presentation connection</a> with <em>S</em>.
</li>
</ol>
<div class="note">
The details of implementing the permission request and display
Expand All @@ -1357,6 +1374,66 @@ <h4>
anyway from <code>getAvailability()</code>.
</div>
</section>
<section>
<h4>
Creating a receiving browsing context
</h4>
<dl>
<dt>
Input
</dt>
<dd>
<em>D</em>, a <a>presentation display</a> chosen by the user
</dd>
<dt>
Output
</dt>
<dd>
<em>R</em>, a <a>receiving browsing context</a>
</dd>
</dl>
<p>
When the user agent is to <dfn>create a receiving browsing
context</dfn>, it must run the following steps:
</p>
<ol>
<li>Create a new <a>top-level browsing context</a> <em>C</em> on
the user agent connected to <em>D</em>.
</li>
<li>Set the <a>session history</a> of <em>C</em> to be the empty
list.
</li>
<li>Set the <a>sandboxed auxiliary navigation browsing context
flag</a> on <em>C</em>.
</li>
<li>Set the <a><code>sessionStorage</code></a> attribute for the
<code>Window</code> object associated with <em>C</em> to a new,
empty storage area.
</li>
<li>Set the <a><code>localStorage</code></a> attribute for the
<code>Window</code> object associated with <em>C</em> to a new,
empty storage area.
</li>
<li>Set the <a>cookie store</a> for <em>C</em> to an empty
<a>cookie store</a>.
</li>
<li>Set the <a>permission state</a> of all <a>Permissions</a> for
<em>C</em> to <code>"denied"</code>.
</li>
<li>Set the IndexedDB <a>databases</a> for <em>C</em> to an empty
set of <a>databases</a>.
</li>
<li>Return <em>C</em>.
</li>
</ol>
<p>
When the <a>receiving browsing context</a> is closed, any
associated browsing state, including <a>session history</a>,
<code>sessionStorage</code>, <code>localStorage</code>, the
<a>cookie store</a>, and <a>databases</a> must be discarded and not
used for any other <a>receiving browsing context</a>.
</p>
</section>
<section>
<h4>
Reconnecting to a presentation connection
Expand Down