Skip to content

Commit

Permalink
Refactor to not require a set
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr committed Feb 24, 2022
1 parent 00cc32a commit 4b8e51a
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -33666,12 +33666,10 @@ interface <dfn interface>HTMLMediaElement</dfn> : <span>HTMLElement</span> {

</p>

<p>A <span>media resource</span> has an associated <dfn>media resource origin set</dfn>, which is
a <span>set</span> of Null or <span>origin</span>, initially empty.

<p class="note">The purpose of the <span>media resource origin set</span> is to make sure data
fetched from <span>CORS-cross-origin</span> <span data-x="concept-response">responses</span>
doesn't leak across origins when fetched via range requests.</p>
<p>A <span>media resource</span> has an associated
<dfn data-x="media-resource-origin">origin</dfn>, which is either "<code data-x="">none</code>",
"<code data-x="">multiple</code>", "<code data-x="">rewritten</code>", or an
<span>origin</span>.</p> It is initially set to "<code data-x="">none</code>".

<p>A <span>media resource</span> can have multiple audio and video tracks. For the purposes of a
<span>media element</span>, the video data of the <span>media resource</span> is only that of the
Expand Down Expand Up @@ -34487,8 +34485,8 @@ interface <dfn interface>MediaError</dfn> {
</ol>

<p>To <dfn>verify a media response</dfn> given a <span data-x="concept-response">response</span>
<var>response</var>, a <span>set</span> of Null or <span data-x="origin">origin</span>
<var>originSet</var> and a Null or (number, Null or number) <var>optionalByteRange</var>:</p>
<var>response</var>, a <span>media resource</span> <var>resource</var> and a Null or
(number, Null or number) <var>optionalByteRange</var>:</p>

<ol>
<li><p>If <var>response</var> is a <span>network error</span>, return false.</p></li>
Expand All @@ -34501,25 +34499,35 @@ interface <dfn interface>MediaError</dfn> {
<li><p>If <var>internalResponse</var>'s <span data-x="concept-response-status">status</span> is
not 206, return false.</p></li>

<li><p>Let <var>origin</var> be "<code data-x="">rewritten</code>" if
<var>internalResponse</var>'s <span data-x="concept-response-url">URL</span> is null; otherwise
<var>internalResponse</var>'s <span data-x="concept-response-url">URL</span>'s
<span data-x="concept-url-origin">origin</span>.</p></li>

<li><p>Let <var>previousOrigin</var> be <var>resource</var>'s
<span data-x="media-resource-origin">origin</span>.</p></li>

<li>
<p>Let <var>origin</var> be null if <var>internalResponse</var>'s
<span data-x="concept-response-url">URL</span> is null and to <var>internalResponse</var>'s
<span data-x="concept-response-url">URL</span>'s <span data-x="concept-url-origin">origin</span>
otherwise.</p>
<p>If any of the following conditions are true:</p>
<ul>
<li><var>previousOrigin</var> is "<code data-x="">none</code></li>

<p class="note"><var>internalResponse</var>'s <span data-x="concept-response-url">URL</span>
would be null in the case where the response is created programatically in a service worker.</p>
</li>
<li><var>origin</var> and <var>previousOrigin</var> are "<code data-x="">rewritten</code>"</li>

<li><p><span data-x="set append">Append</span> <var>origin</var> to
<var>originSet</var>.</p></li>
<li><var>origin</var> and <var>previousOrigin</var> are <span data-x="origin">origins</span>,
and <var>origin</var> is <span>same origin</span> with <var>previousOrigin</var></li>
</ul>

<li>
<p>If <var>originSet</var>'s <span data-x="list size">size</span> is greater than 1 and
<var>response</var> is <span>CORS-cross-origin</span>, return false.</p>
<p>then set <var>resource</var>'s <span data-x="media-resource-origin">origin</span> to
<var>origin</var>.</p>

<p>Otherwise: if <var>response</var> is <span>CORS-cross-origin</span>, return false.</p>

<p>Otherwise set <var>resource</var>'s <span data-x="media-resource-origin">origin</span> to
"<code data-x="">multiple</code>".</p>

<p class="note">This ensures that only a single origin contributes to opaque range responses for
the same <span>media resource</span>, to avoid leaking information across origins.</p>
<p class="note">This ensures that opaque responses with range headers do not leak information
by being patched together with other responses from different origins.</p>
</li>

<li><p>Let (<var>start</var>, <var>end</var>) be the result of
Expand Down Expand Up @@ -34631,8 +34639,7 @@ interface <dfn interface>MediaError</dfn> {

<ol>
<li><p>If the result of <span data-x="verify a media response">verifying</span>
<var>response</var> given the <var>current media resource</var>'s
<span data-x="media resource origin set">origin set</span> and
<var>response</var> given the <var>current media resource</var> and
<var>optionalByteRange</var> is false, then set <var>response</var> to a new
<span>network error</span>.</p></li>

Expand Down

0 comments on commit 4b8e51a

Please sign in to comment.