Skip to content
Permalink
Browse files

Use "credentials mode" instead of "CORS setting" for modules

This is a purely editorial update. We have essentially two types
representing the credentials mode. Previously we used the CORS setting
type up until the last minute, where we converted it into a credentials
mode. This ends up being inconvenient for worker-modules, so instead we
now convert from CORS setting to credentials mode up front and use that
throughout.
  • Loading branch information...
domenic committed Feb 2, 2016
1 parent ccd4d99 commit 7a0ce073a8fbade8f44d0e2d4c709ad7cf3ee312
Showing with 35 additions and 31 deletions.
  1. +35 −31 source
66 source

<dt>"<code data-x="">module</code>"</dt>
<dd>
<p><span>Fetch a module script tree</span> given <var>url</var>, <var>CORS setting</var>,
and <var>settings</var>.</p>
<ol>
<li>
<p>Let <var>credentials mode</var> be determined by switching on <var>CORS
setting</var>:</p>

<dl class="switch">
<dt><span data-x="attr-crossorigin-none">No CORS</span></dt>
<dd>"<code data-x="">omit</code>"</dd>

<dt><span data-x="attr-crossorigin-anonymous">Anonymous</span></dt>
<dd>"<code data-x="">same-origin</code>"</dd>

<dt><span data-x="attr-crossorigin-none">Use Credentials</span></dt>
<dd>"<code data-x="">include</code>"</dd>
</dl>
</li>

<li><p><span>Fetch a module script tree</span> given <var>url</var>, <var>credentials
mode</var>, and <var>settings</var>.</p></li>
</ol>
</dd>
</dl>


</dd>

<dt>A <dfn data-x="concept-module-script-cors-setting">CORS setting</dfn></dt>
<dt>A <dfn data-x="concept-module-script-credentials-mode">credentials mode</dfn></dt>

<dd>

<p>A <span>CORS settings attribute</span> state used to fetch imported modules.</p>
<p>A <span data-x="concept-request-credentials-mode">credentials mode</span> used to fetch
imported modules.</p>

</dd>

<li>Asynchronously complete this algorithm with <var>script</var>.</li>
</ol>

<p>To <dfn>fetch a module script tree</dfn> given a <var>url</var>, a <var>CORS setting</var>,
<p>To <dfn>fetch a module script tree</dfn> given a <var>url</var>, a <var>credentials mode</var>,
and a <var>settings object</var>, run these steps. The algorithm will asynchronously complete
with either null (on failure) or a new <span>module script</span> (on success).</p>

<ol>
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>CORS setting</var>,
and <var>settings object</var>.</p>
<li><p><span>Fetch a single module script</span> given <var>url</var>, <var>credentials
mode</var>, and <var>settings object</var>.</p>

<li><p>Return from this algorithm and run the following steps when <span data-x="fetch a single
module script">fetching a single module script</span> asynchronously completes with
<li>
<p>For each <var>url</var> in <var>urls</var>, <span>fetch a module script tree</span> given
<var>url</var>, <var>module script</var>'s <span
data-x="concept-module-script-cors-setting">CORS setting</span>, and
data-x="concept-module-script-credentials-mode">credentials mode</span>, and
<var>module script</var>'s <span>settings object</span>.</p>

<p>If any of the <span>fetch a module script tree</span> invocations asynchronously complete
</li>
</ol>

<p>To <dfn>fetch a single module script</dfn>, given a <var>url</var>, a <var>CORS setting</var>,
and a <var>settings object</var>, run these steps. The algorithm will asynchronously complete
with either null (on failure) or a new <span>module script</span> (on success).</p>
<p>To <dfn>fetch a single module script</dfn>, given a <var>url</var>, a <var>credentials
mode</var>, and a <var>settings object</var>, run these steps. The algorithm will asynchronously
complete with either null (on failure) or a new <span>module script</span> (on success).</p>

<ol>
<li><p>Let <var>module map</var> be <var>settings</var>'s <span>module map</span>.</p></li>
<li><p>Create an entry in <var>module map</var> with key <var>url</var> and value "<code
data-x="">fetching</code>".</p>

<li>
<p>Let <var>credentials mode</var> be determined by switching on <var>CORS setting</var>:

<dl class="switch">
<dt><span data-x="attr-crossorigin-none">No CORS</span></dt>
<dd>"<code data-x="">omit</code>"</dd>

<dt><span data-x="attr-crossorigin-anonymous">Anonymous</span></dt>
<dd>"<code data-x="">same-origin</code>"</dd>

<dt><span data-x="attr-crossorigin-none">Use Credentials</span></dt>
<dd>"<code data-x="">include</code>"</dd>
</dl>
</li>

<li><p>Let <var>request</var> be a new <span data-x="concept-request">request</span> whose
<span data-x="concept-request-url">url</span> is <var>url</var>, <span
data-x="concept-request-destination">destination</span> is "<code data-x="">subresource</code>",

<li><p>Let <var>module script</var> be the result of <span>creating a module script</span> given
<var>source text</var>, <var>settings object</var>, <var>response</var>'s <span
data-x="concept-response-url">url</span>, and <var>CORS setting</var>.</p></li>
data-x="concept-response-url">url</span>, and <var>credentials mode</var>.</p></li>

<li>
<p>Set the value of the entry in <var>module map</var> whose key is <var>url</var> to
</ol>

<p>To <dfn data-x="creating a module script">create a module script</dfn>, given some script
source, an <span>environment settings object</span>, a script base URL, and a <span>CORS settings
attribute</span> state:</p>
source, an <span>environment settings object</span>, a script base URL, and a credentials
mode:</p>

<ol>

<li><p>Set <var>script</var>'s <span data-x="concept-module-script-base-url">base URL</span> to
the script base URL provided.</p></li>

<li><p>Set <var>script</var>'s <span data-x="concept-module-script-cors-setting">CORS
setting</span> to the <span>CORS settings attribute</span> state provided.</p></li>
<li><p>Set <var>script</var>'s <span data-x="concept-module-script-credentials-mode">credentials
mode</span> to the credentials mode provided.</p></li>

<li><p>Return <var>script</var>.</p></li>

0 comments on commit 7a0ce07

Please sign in to comment.
You can’t perform that action at this time.