Skip to content

Commit

Permalink
Change how module scripts are fetched
Browse files Browse the repository at this point in the history
* Module scripts are always fetched with request credentials mode "same-origin" by default. Only
  worker module scripts can still set that to "omit". Non-worker module scripts cannot, keeping
  them aligned with how the crossorigin attribute works for other platform features.
* The top-level script for module workers is always fetched with request mode "same-origin".
  Cross-origin workers did not quite work due to service workers.

Fixes #2557 and fixes #3109.
  • Loading branch information
annevk committed Oct 8, 2018
1 parent 45ddbd2 commit 46c5ea0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7120,8 +7120,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<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>

Expand Down Expand Up @@ -86649,8 +86647,9 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
empty string, <span data-x="concept-script-fetch-options-parser">parser metadata</span> is "<code
data-x="">not-parser-inserted</code>", <span
data-x="concept-script-fetch-options-credentials">credentials mode</span> is "<code
data-x="">omit</code>", and <span data-x="concept-script-fetch-options-referrer-policy">referrer
policy</span> is the empty string.</p>
data-x="">same-origin</code>", and <span
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span> is the empty
string.</p>

<p>Given a <span data-x="concept-request">request</span> <var>request</var> and a <span>script
fetch options</span> <var>options</var>, we define:</p>
Expand Down Expand Up @@ -87008,6 +87007,11 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
data-x="concept-request-client">client</span> is <var>fetch client settings
object</var>.</p></li>

<li><p>If <var>destination</var> is "<code data-x="">worker</code>" or "<code
data-x="">sharedworker</code>" and the <var>top-level module fetch</var> flag is set, then set
<var>request</var>'s <span data-x="concept-request-mode">mode</span> to "<code
data-x="">same-origin</code>".

<li><p><span>Set up the module script request</span> given <var>request</var> and
<var>options</var>.</p></li>

Expand Down Expand Up @@ -98182,7 +98186,7 @@ interface <dfn>Worker</dfn> : <span>EventTarget</span> {

dictionary <dfn>WorkerOptions</dfn> {
<span>WorkerType</span> type = "classic";
<span>RequestCredentials</span> credentials = "omit"; // credentials is only used if type is "module"
<span>RequestCredentials</span> credentials = "same-origin"; // credentials is only used if type is "module"
DOMString name = "";
};

Expand Down

0 comments on commit 46c5ea0

Please sign in to comment.