Skip to content

Commit

Permalink
Support "manual" redirect mode for navigation requests. Fixes #66.
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Jul 15, 2015
1 parent c83edf6 commit c5dc814
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 24 deletions.
45 changes: 33 additions & 12 deletions Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ <h4 id="requests"><span class="secno">3.1.4 </span>Requests</h4>
whose <a href="#concept-request-context" title="concept-request-context">context</a> is "<code title="">embed</code>" or
"<code title="">object</code>".

<p>A <dfn id="navigation-request">navigation request</dfn> is a <a href="#concept-request" title="concept-request">request</a> whose
<a href="#concept-request-context" title="concept-request-context">context</a> is a
<a href="#navigation-request-context">navigation request-context</a>.

<p>A <dfn id="resource-request">resource request</dfn> is a <a href="#concept-request" title="concept-request">request</a> that is
neither a <a href="#client-request">client request</a> nor a <a href="#potential-client-request">potential-client request</a>.

Expand Down Expand Up @@ -1073,6 +1077,20 @@ <h4 id="responses"><span class="secno">3.1.5 </span>Responses</h4>
<a href="#concept-response-body" title="concept-response-body">body</a> is null, and
<a href="#concept-response-cache-state" title="concept-response-cache-state">cache state</a> is "<code title="">none</code>".

<p>An <dfn id="concept-filtered-response-opaque-redirect" title="concept-filtered-response-opaque-redirect">opaque-redirect filtered response</dfn>
is a <a href="#concept-filtered-response" title="concept-filtered-response">filtered response</a> whose
<a href="#concept-response-type" title="concept-response-type">type</a> is "<code title="">opaqueredirect</code>",
<a href="#concept-response-status" title="concept-response-status">status</a> is <code title="">0</code>,
<a href="#concept-response-status-message" title="concept-response-status-message">status message</a> is the empty byte sequence,
<a href="#concept-response-header-list" title="concept-response-header-list">header list</a> is the empty list,
<a href="#concept-response-body" title="concept-response-body">body</a> is null, and
<a href="#concept-response-cache-state" title="concept-response-cache-state">cache state</a> is "<code title="">none</code>".

<p class="note no-backref">Exposing the
<a href="#concept-response-url-list" title="concept-response-url-list">url list</a> for
<a href="#concept-filtered-response-opaque-redirect" title="concept-filtered-response-opaque-redirect">opaque-redirect filtered responses</a>
is harmless since no redirects are followed.

<p class="note no-backref">In other words, an
<a href="#concept-filtered-response-opaque" title="concept-filtered-response-opaque">opaque filtered response</a> is nearly
indistinguishable from a <a href="#concept-network-error" title="concept-network-error">network error</a>. When
Expand Down Expand Up @@ -1891,9 +1909,13 @@ <h3 id="http-fetch"><span class="secno">5.3 </span>HTTP fetch</h3>
"<code title="">no-cors</code>" and <var title="">response</var>'s
<a href="#concept-response-type" title="concept-response-type">type</a> is "<code title="">opaque</code>".

<li><var title="">request</var> is <em>not</em> a <a href="#navigation-request">navigation request</a> and
<var title="">response</var>'s <a href="#concept-response-type" title="concept-response-type">type</a> is
"<code title="">opaqueredirect</code>".

<li><var title="">request</var> is a <a href="#client-request">client request</a> and
<var title="">response</var>'s <a href="#concept-response-type" title="concept-response-type">type</a> is neither
"<code title="">basic</code>" nor "<code title="">default</code>".
<var title="">response</var>'s <a href="#concept-response-type" title="concept-response-type">type</a> is none of
"<code>basic</code>", "<code>default</code>", and "<code>opaqueredirect</code>".
<!-- This needs to be revisited somehow if we ever get cross-origin workers. -->
</ul>
</ol>
Expand Down Expand Up @@ -2098,6 +2120,13 @@ <h3 id="http-fetch"><span class="secno">5.3 </span>HTTP fetch</h3>
<a href="#concept-main-fetch" title="concept-main-fetch">main fetch</a> to get
<a href="#concept-request-response-tainting" title="concept-request-response-tainting">response tainting</a> correct.
</ol>

<li><p>Otherwise, <var title="">request</var>'s
<a href="#concept-request-redirect-mode" title="concept-request-redirect-mode">redirect mode</a> is
"<code title="">manual</code>", set <var title="">response</var> to an
<a href="#concept-filtered-response-opaque-redirect" title="concept-filtered-response-opaque-redirect">opaque-redirect filtered response</a>
whose <a href="#concept-internal-response" title="concept-internal-response">internal response</a> is
<var title="">response</var>.
</ol>

<dt><code title="">401</code>
Expand Down Expand Up @@ -3337,7 +3366,7 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
<a href="#requestmode">RequestMode</a> mode;
<a href="#requestcredentials">RequestCredentials</a> credentials;
<a href="#requestcache">RequestCache</a> cache;
<a href="#requestredirect">RequestRedirect</a> redirect; // "manual" cannot be set
<a href="#requestredirect">RequestRedirect</a> redirect;
any window; // can only be set to null
};

Expand Down Expand Up @@ -3501,10 +3530,6 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
<li><p>If <var title="">cache</var> is non-null, set <var title="">request</var>'s
<a href="#concept-request-cache-mode" title="concept-request-cache-mode">cache mode</a> to <var title="">cache</var>.

<li><p>If <var title="">init</var>'s <code title="">redirect</code> member is present and it is
"<code title="">manual</code>", <a class="external" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a
<code title="">TypeError</code>.

<li><p>Let <var title="">redirect</var> be <var title="">init</var>'s
<code title="">redirect</code> member if it is present, and
<var title="">fallbackRedirect</var> otherwise.
Expand All @@ -3513,10 +3538,6 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
<a href="#concept-request-redirect-mode" title="concept-request-redirect-mode">redirect mode</a> to
<var title="">redirect</var>.

<li><p>If <var title="">request</var>'s
<a href="#concept-request-redirect-mode" title="concept-request-redirect-mode">redirect mode</a> is
"<code title="">manual</code>", set it to "<code title="">follow</code>".

<li>
<p>If <var title="">init</var>'s <code title="">method</code> member is present, let
<var title="">method</var> be it and run these substeps:
Expand Down Expand Up @@ -3715,7 +3736,7 @@ <h3 id="response-class"><span class="secno">6.4 </span>Response class</h3>
<a href="#headersinit">HeadersInit</a> headers;
};

enum <dfn id="responsetype">ResponseType</dfn> { "basic", "cors", "default", "error", "opaque" };</pre>
enum <dfn id="responsetype">ResponseType</dfn> { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };</pre>

<p>A <code><a href="#response">Response</a></code> object has an associated
<dfn id="concept-response-response" title="concept-Response-response">response</dfn> (a
Expand Down
45 changes: 33 additions & 12 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,10 @@ <h4>Requests</h4>
whose <span title=concept-request-context>context</span> is "<code title>embed</code>" or
"<code title>object</code>".

<p>A <dfn>navigation request</dfn> is a <span title=concept-request>request</span> whose
<span title=concept-request-context>context</span> is a
<span>navigation request-context</span>.

<p>A <dfn>resource request</dfn> is a <span title=concept-request>request</span> that is
neither a <span>client request</span> nor a <span>potential-client request</span>.

Expand Down Expand Up @@ -1020,6 +1024,20 @@ <h4>Responses</h4>
<span title=concept-response-body>body</span> is null, and
<span title=concept-response-cache-state>cache state</span> is "<code title>none</code>".

<p>An <dfn title=concept-filtered-response-opaque-redirect>opaque-redirect filtered response</dfn>
is a <span title=concept-filtered-response>filtered response</span> whose
<span title=concept-response-type>type</span> is "<code title>opaqueredirect</code>",
<span title=concept-response-status>status</span> is <code title>0</code>,
<span title=concept-response-status-message>status message</span> is the empty byte sequence,
<span title=concept-response-header-list>header list</span> is the empty list,
<span title=concept-response-body>body</span> is null, and
<span title=concept-response-cache-state>cache state</span> is "<code title>none</code>".

<p class="note no-backref">Exposing the
<span title=concept-response-url-list>url list</span> for
<span title=concept-filtered-response-opaque-redirect>opaque-redirect filtered responses</span>
is harmless since no redirects are followed.

<p class="note no-backref">In other words, an
<span title=concept-filtered-response-opaque>opaque filtered response</span> is nearly
indistinguishable from a <span title=concept-network-error>network error</span>. When
Expand Down Expand Up @@ -1838,9 +1856,13 @@ <h3>HTTP fetch</h3>
"<code title>no-cors</code>" and <var title>response</var>'s
<span title=concept-response-type>type</span> is "<code title>opaque</code>".

<li><var title>request</var> is <em>not</em> a <span>navigation request</span> and
<var title>response</var>'s <span title=concept-response-type>type</span> is
"<code title>opaqueredirect</code>".

<li><var title>request</var> is a <span>client request</span> and
<var title>response</var>'s <span title=concept-response-type>type</span> is neither
"<code title>basic</code>" nor "<code title>default</code>".
<var title>response</var>'s <span title=concept-response-type>type</span> is none of
"<code>basic</code>", "<code>default</code>", and "<code>opaqueredirect</code>".
<!-- This needs to be revisited somehow if we ever get cross-origin workers. -->
</ul>
</ol>
Expand Down Expand Up @@ -2045,6 +2067,13 @@ <h3>HTTP fetch</h3>
<span title=concept-main-fetch>main fetch</span> to get
<span title=concept-request-response-tainting>response tainting</span> correct.
</ol>

<li><p>Otherwise, <var title>request</var>'s
<span title=concept-request-redirect-mode>redirect mode</span> is
"<code title>manual</code>", set <var title>response</var> to an
<span title=concept-filtered-response-opaque-redirect>opaque-redirect filtered response</span>
whose <span title=concept-internal-response>internal response</span> is
<var title>response</var>.
</ol>

<dt><code title>401</code>
Expand Down Expand Up @@ -3284,7 +3313,7 @@ <h3>Request class</h3>
<span>RequestMode</span> mode;
<span>RequestCredentials</span> credentials;
<span>RequestCache</span> cache;
<span>RequestRedirect</span> redirect; // "manual" cannot be set
<span>RequestRedirect</span> redirect;
any window; // can only be set to null
};

Expand Down Expand Up @@ -3448,10 +3477,6 @@ <h3>Request class</h3>
<li><p>If <var title>cache</var> is non-null, set <var title>request</var>'s
<span title=concept-request-cache-mode>cache mode</span> to <var title>cache</var>.

<li><p>If <var title>init</var>'s <code title>redirect</code> member is present and it is
"<code title>manual</code>", <span data-anolis-spec=webidl>throw</span> a
<code title>TypeError</code>.

<li><p>Let <var title>redirect</var> be <var title>init</var>'s
<code title>redirect</code> member if it is present, and
<var title>fallbackRedirect</var> otherwise.
Expand All @@ -3460,10 +3485,6 @@ <h3>Request class</h3>
<span title=concept-request-redirect-mode>redirect mode</span> to
<var title>redirect</var>.

<li><p>If <var title>request</var>'s
<span title=concept-request-redirect-mode>redirect mode</span> is
"<code title>manual</code>", set it to "<code title>follow</code>".

<li>
<p>If <var title>init</var>'s <code title>method</code> member is present, let
<var title>method</var> be it and run these substeps:
Expand Down Expand Up @@ -3662,7 +3683,7 @@ <h3>Response class</h3>
<span>HeadersInit</span> headers;
};

enum <dfn>ResponseType</dfn> { "basic", "cors", "default", "error", "opaque" };</pre>
enum <dfn>ResponseType</dfn> { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };</pre>

<p>A <code>Response</code> object has an associated
<dfn title=concept-Response-response>response</dfn> (a
Expand Down

0 comments on commit c5dc814

Please sign in to comment.