Skip to content

Commit

Permalink
Fix #152: give up on forced CORS preflights being a mode
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 25, 2015
1 parent 69eda57 commit 2ca5730
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 55 deletions.
42 changes: 15 additions & 27 deletions Overview.html
Expand Up @@ -804,9 +804,11 @@ <h4 id="requests"><span class="secno">3.1.5 </span>Requests</h4>

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated
<dfn id="concept-request-mode" title="concept-request-mode">mode</dfn>, which is one of "<code title="">navigate</code>",
"<code title="">same-origin</code>", "<code title="">no-cors</code>", "<code title="">cors</code>", and
"<code title="">cors-with-forced-preflight</code>". Unless stated otherwise, it is
"<code title="">no-cors</code>".
"<code title="">same-origin</code>", "<code title="">no-cors</code>", and "<code title="">cors</code>".
Unless stated otherwise, it is "<code title="">no-cors</code>".

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated
<dfn id="use-cors-preflight-flag">use-CORS-preflight flag</dfn>. Unless stated otherwise, it is unset.

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated
<dfn id="concept-request-credentials-mode" title="concept-request-credentials-mode">credentials mode</dfn>, which is
Expand Down Expand Up @@ -1803,8 +1805,7 @@ <h3 id="main-fetch"><span class="secno">5.1 </span>Main fetch</h3>

<dd><p>A <a href="#concept-network-error" title="concept-network-error">network error</a>.

<dt><var>request</var>'s <a href="#concept-request-mode" title="concept-request-mode">mode</a> is
"<code title="">cors-with-forced-preflight</code>"
<dt><var>request</var>'s <a href="#use-cors-preflight-flag">use-CORS-preflight flag</a> is set
<dt><var>request</var>'s <a href="#unsafe-request-flag">unsafe-request flag</a> is set and either
<var>request</var>'s <a href="#concept-request-method" title="concept-request-method">method</a> is not
a <a href="#simple-method">simple method</a> or a <a href="#concept-header" title="concept-header">header</a> in
Expand Down Expand Up @@ -2176,8 +2177,7 @@ <h3 id="http-fetch"><span class="secno">5.3 </span>HTTP fetch</h3>
<var>request</var>'s <a href="#concept-request-method" title="concept-request-method">method</a> using
<var>request</var>, and either <var>request</var>'s
<a href="#concept-request-method" title="concept-request-method">method</a> is a not <a href="#simple-method">simple method</a>
or <var>request</var>'s <a href="#concept-request-mode" title="concept-request-mode">mode</a> is
"<code title="">cors-with-forced-preflight</code>".
or <var>request</var>'s <a href="#use-cors-preflight-flag">use-CORS-preflight flag</a> is set.

<li>There is at least one <a href="#concept-header" title="concept-header">header</a> in
<var>request</var>'s <a href="#concept-request-header-list" title="concept-request-header-list">header list</a>
Expand Down Expand Up @@ -2290,8 +2290,7 @@ <h3 id="http-fetch"><span class="secno">5.3 </span>HTTP fetch</h3>

<ol>
<li><p>If <var>request</var>'s <a href="#concept-request-mode" title="concept-request-mode">mode</a> is
either "<code>cors</code>" or "<code>cors-with-forced-preflight</code>",
<var>request</var>'s <a href="#concept-request-origin" title="concept-request-origin">origin</a> is
"<code>cors</code>", <var>request</var>'s <a href="#concept-request-origin" title="concept-request-origin">origin</a> is
<em>not</em> <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#same-origin">same origin</a> with
<var>locationURL</var>'s
<a class="external" data-anolis-spec="url" href="https://url.spec.whatwg.org/#concept-url-origin" title="concept-url-origin">origin</a>, and
Expand Down Expand Up @@ -2905,15 +2904,13 @@ <h3 id="cors-preflight-fetch"><span class="secno">5.6 </span>CORS-preflight fetc
return a <a href="#concept-network-error" title="concept-network-error">network error</a>.

<li>
<p>If <var>methods</var> is null and <var>request</var>'s
<a href="#concept-request-mode" title="concept-request-mode">mode</a> is
"<code title="">cors-with-forced-preflight</code>", set <var>methods</var> to
<var>request</var>'s <a href="#concept-request-method" title="concept-request-method">method</a>.
<p>If <var>methods</var> is null and <var>request</var>'s <a href="#use-cors-preflight-flag">use-CORS-preflight flag</a>
is set, set <var>methods</var> to <var>request</var>'s
<a href="#concept-request-method" title="concept-request-method">method</a>.

<p class="note no-backref">This ensures that a <a href="#cors-preflight-fetch-0">CORS-preflight fetch</a> that
happened due to <var>request</var>'s
<a href="#concept-request-mode" title="concept-request-mode">mode</a> being
"<code title="">cors-with-forced-preflight</code>" is <a href="#concept-cache" title="concept-cache">cached</a>.
happened due to <var>request</var>'s <a href="#use-cors-preflight-flag">use-CORS-preflight flag</a> being set is
<a href="#concept-cache" title="concept-cache">cached</a>.

<li><p>If <var>request</var>'s <a href="#concept-request-method" title="concept-request-method">method</a>
is not in <var>methods</var> and is not a <a href="#simple-method">simple method</a>, return a
Expand Down Expand Up @@ -4026,17 +4023,8 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
getter must return <a href="#concept-request-request" title="concept-Request-request">request</a>'s
<a href="#concept-request-referrer-policy" title="concept-Request-referrer-policy">referrer policy</a>.

<p>The <dfn id="dom-request-mode" title="dom-Request-mode"><code>mode</code></dfn> attribute's getter must
return the value corresponding to the first matching statement, switching on
<a href="#concept-request-request" title="concept-Request-request">request</a>'s
<a href="#concept-request-mode" title="concept-request-mode">mode</a>:

<dl class="switch">
<dt>"<code title="">cors-with-forced-preflight</code>"
<dd>"<code title="">cors</code>"
<dt>Otherwise
<dd>Value as is.
</dl>
<p>The <dfn id="dom-request-mode" title="dom-Request-mode"><code>mode</code></dfn> attribute's getter must return
<a href="#concept-request-request" title="concept-Request-request">request</a>'s <a href="#concept-request-mode" title="concept-request-mode">mode</a>.

<p>The <dfn id="dom-request-credentials" title="dom-Request-credentials"><code>credentials</code></dfn> attribute's
getter must return <a href="#concept-request-request" title="concept-Request-request">request</a>'s
Expand Down
42 changes: 15 additions & 27 deletions Overview.src.html
Expand Up @@ -743,9 +743,11 @@ <h4>Requests</h4>

<p>A <span title=concept-request>request</span> has an associated
<dfn title=concept-request-mode>mode</dfn>, which is one of "<code title>navigate</code>",
"<code title>same-origin</code>", "<code title>no-cors</code>", "<code title>cors</code>", and
"<code title>cors-with-forced-preflight</code>". Unless stated otherwise, it is
"<code title>no-cors</code>".
"<code title>same-origin</code>", "<code title>no-cors</code>", and "<code title>cors</code>".
Unless stated otherwise, it is "<code title>no-cors</code>".

<p>A <span title=concept-request>request</span> has an associated
<dfn>use-CORS-preflight flag</dfn>. Unless stated otherwise, it is unset.

<p>A <span title=concept-request>request</span> has an associated
<dfn title=concept-request-credentials-mode>credentials mode</dfn>, which is
Expand Down Expand Up @@ -1742,8 +1744,7 @@ <h3>Main fetch</h3>

<dd><p>A <span title=concept-network-error>network error</span>.

<dt><var>request</var>'s <span title=concept-request-mode>mode</span> is
"<code title>cors-with-forced-preflight</code>"
<dt><var>request</var>'s <span>use-CORS-preflight flag</span> is set
<dt><var>request</var>'s <span>unsafe-request flag</span> is set and either
<var>request</var>'s <span title=concept-request-method>method</span> is not
a <span>simple method</span> or a <span title=concept-header>header</span> in
Expand Down Expand Up @@ -2115,8 +2116,7 @@ <h3>HTTP fetch</h3>
<var>request</var>'s <span title=concept-request-method>method</span> using
<var>request</var>, and either <var>request</var>'s
<span title=concept-request-method>method</span> is a not <span>simple method</span>
or <var>request</var>'s <span title=concept-request-mode>mode</span> is
"<code title>cors-with-forced-preflight</code>".
or <var>request</var>'s <span>use-CORS-preflight flag</span> is set.

<li>There is at least one <span title=concept-header>header</span> in
<var>request</var>'s <span title=concept-request-header-list>header list</span>
Expand Down Expand Up @@ -2229,8 +2229,7 @@ <h3>HTTP fetch</h3>

<ol>
<li><p>If <var>request</var>'s <span title=concept-request-mode>mode</span> is
either "<code>cors</code>" or "<code>cors-with-forced-preflight</code>",
<var>request</var>'s <span title=concept-request-origin>origin</span> is
"<code>cors</code>", <var>request</var>'s <span title=concept-request-origin>origin</span> is
<em>not</em> <span data-anolis-spec=html>same origin</span> with
<var>locationURL</var>'s
<span data-anolis-spec=url title=concept-url-origin>origin</span>, and
Expand Down Expand Up @@ -2844,15 +2843,13 @@ <h3>CORS-preflight fetch</h3>
return a <span title=concept-network-error>network error</span>.

<li>
<p>If <var>methods</var> is null and <var>request</var>'s
<span title=concept-request-mode>mode</span> is
"<code title>cors-with-forced-preflight</code>", set <var>methods</var> to
<var>request</var>'s <span title=concept-request-method>method</span>.
<p>If <var>methods</var> is null and <var>request</var>'s <span>use-CORS-preflight flag</span>
is set, set <var>methods</var> to <var>request</var>'s
<span title=concept-request-method>method</span>.

<p class="note no-backref">This ensures that a <span>CORS-preflight fetch</span> that
happened due to <var>request</var>'s
<span title=concept-request-mode>mode</span> being
"<code title>cors-with-forced-preflight</code>" is <span title=concept-cache>cached</span>.
happened due to <var>request</var>'s <span>use-CORS-preflight flag</span> being set is
<span title=concept-cache>cached</span>.

<li><p>If <var>request</var>'s <span title=concept-request-method>method</span>
is not in <var>methods</var> and is not a <span>simple method</span>, return a
Expand Down Expand Up @@ -3965,17 +3962,8 @@ <h3>Request class</h3>
getter must return <span title=concept-Request-request>request</span>'s
<span title=concept-Request-referrer-policy>referrer policy</span>.

<p>The <dfn title=dom-Request-mode><code>mode</code></dfn> attribute's getter must
return the value corresponding to the first matching statement, switching on
<span title=concept-Request-request>request</span>'s
<span title=concept-request-mode>mode</span>:

<dl class=switch>
<dt>"<code title>cors-with-forced-preflight</code>"
<dd>"<code title>cors</code>"
<dt>Otherwise
<dd>Value as is.
</dl>
<p>The <dfn title=dom-Request-mode><code>mode</code></dfn> attribute's getter must return
<span title=concept-Request-request>request</span>'s <span title=concept-request-mode>mode</span>.

<p>The <dfn title=dom-Request-credentials><code>credentials</code></dfn> attribute's
getter must return <span title=concept-Request-request>request</span>'s
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -2,7 +2,8 @@ This repository hosts the [Fetch Standard](https://fetch.spec.whatwg.org/).

### Pull requests

See the [whatwg/html README](https://github.com/whatwg/html/blob/master/README.md) for the general guidelines. Note that `source` is `Overview.src.html` and "Acknowledgements" is "Acknowledgments"
See the [whatwg/html README](https://github.com/whatwg/html/blob/master/README.md) for the general
guidelines. Note that `source` is `Overview.src.html` and "Acknowledgements" is "Acknowledgments"
here (I know). Also, the Fetch Standard uses [Anolis](https://wiki.whatwg.org/wiki/Anolis) to
generate `Overview.html`. (Do not worry if using that tool is too complicated, your pull request
does not need to contain the generated HTML.)

0 comments on commit 2ca5730

Please sign in to comment.