Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace sniffed MIME type with computed MIME type
Fix https://www.w3.org/Bugs/Public/show_bug.cgi?id=28100.

As in whatwg/mimesniff@ced82b8, sniffed MIME type has been renamed to computed MIME type for clarity.

PR: #614
  • Loading branch information
Ritsyy authored and domenic committed Feb 9, 2016
1 parent 1cae7e9 commit 2f58d1e
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions source
Expand Up @@ -6625,7 +6625,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
spec=MIMESNIFF></p>

<p>The <dfn data-x="Content-Type sniffing"
data-x-href="https://mimesniff.spec.whatwg.org/#computed-mime-type">sniffed type of a
data-x-href="https://mimesniff.spec.whatwg.org/#computed-mime-type">computed type of a
resource</dfn> must be found in a manner consistent with the requirements given in the MIME
Sniffing specification for finding the <i>sniffed media type</i> of the relevant sequence of
octets. <ref spec=MIMESNIFF></p>
Expand Down Expand Up @@ -11785,7 +11785,8 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p>
Otherwise, if the resource is expected to be an image, user agents may apply the <span
data-x="Content-Type sniffing: image">image sniffing rules</span>, with the <var>official
type</var> being the type determined from the resource's <span data-x="Content-Type">Content-Type
metadata</span>, and use the resulting sniffed type of the resource as if it was the actual type.
metadata</span>, and use the resulting <span data-x="Content-Type sniffing">computed type of the
resource</span> as if it was the actual type.
Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image
sniffing rules, then the user agent must use the resource's <span
data-x="Content-Type">Content-Type metadata</span> to determine the type of the resource. If there
Expand Down Expand Up @@ -27841,7 +27842,7 @@ attribute, set the <span>browsing context name</span> of the element's <span>nes
specified in that <code data-x="attr-object-type">type</code> attribute.</p>

<p>Otherwise, let <var>tentative type</var> be the <span data-x="content-type
sniffing">sniffed type of the resource</span>.</p>
sniffing">computed type of the resource</span>.</p>

</li>

Expand Down Expand Up @@ -34616,13 +34617,13 @@ interface <dfn>MediaController</dfn> : <span>EventTarget</span> {

<p>The <span data-x="concept-task">tasks</span> <span data-x="queue a task">queued</span> by the
fetching algorithm on the <span>networking task source</span> to process the data as it is being
fetched must <!--<span data-x="Content-Type sniffing">-->determine the <!--sniffed--> type of
the resource<!--</span>-->. If the <!--sniffed--> type of the resource is not a supported text
fetched must <!--<span data-x="Content-Type sniffing">-->determine the <!--computed--> type of
the resource<!--</span>-->. If the <!--computed--> type of the resource is not a supported text
track format, the load will fail, as described below. Otherwise, the resource's data must be
passed to the appropriate parser (e.g., the <span>WebVTT parser</span><!-- if the file starts
with the "<code data-x="">WEBVTT</code>" signature-->) as it is received, with the <span>text
track list of cues</span> being used for that parser's output. <ref spec=WEBVTT></p><!-- see
also critical block below, and the word "sniffed" in the paragraph after that -->
also critical block below, and the word "computed" in the paragraph after that -->

<p class="note">The appropriate parser will incrementally update the <span>text track list of
cues</span> during these <span>networking task
Expand All @@ -34646,7 +34647,7 @@ interface <dfn>MediaController</dfn> : <span>EventTarget</span> {
data-x="concept-task">task</span> must use the <span>DOM manipulation task source</span>. <!--
can't be the media element one, since there might not be a media element by this point --></p>

<p>If fetching does not fail, but the <!--sniffed--> type of the resource is not a supported
<p>If fetching does not fail, but the <!--computed--> type of the resource is not a supported
text track format, or the file was not successfully processed (e.g., the format in question is
an XML format and the file contained a well-formedness error that the XML specification requires
be detected and reported to the application), then the <span data-x="concept-task">task</span>
Expand Down Expand Up @@ -37410,9 +37411,9 @@ dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {

<li><p>If the <span>nested browsing context</span>'s <span>active document</span> was created by
the <span data-x="navigate-xml">page load processing model for XML files</span> section because
<span>the sniffed type of the resource</span> in the <span>navigate</span> algorithm was
<code>image/svg+xml</code>, then return that <code>Document</code> object and abort these
steps.</p></li>
the <span data-x="Content-Type sniffing">computed type of the resource</span> in the <span>
navigate</span> algorithm was <code>image/svg+xml</code>, then return that
<code>Document</code> object and abort these steps.</p></li>

<li><p>Otherwise, return null.</p></li>

Expand Down Expand Up @@ -80534,7 +80535,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

</li>

<li><p>Let <var>type</var> be <span data-x="Content-Type sniffing">the sniffed type of
<li><p>Let <var>type</var> be the <span data-x="Content-Type sniffing">computed type of
the resource</span>.</p></li>

<li><p>If the user agent has been configured to process resources of the given <var>type</var> using some mechanism other than rendering the content in a <span>browsing
Expand Down Expand Up @@ -80848,7 +80849,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<p class="note">The <span>input byte stream</span> converts bytes into characters for use in the
<span data-x="tokenization">tokenizer</span>. This process relies, in part, on character encoding
information found in the real <span data-x="Content-Type">Content-Type metadata</span> of the
resource; the "sniffed type" is not used for this purpose.</p>
resource; the computed type is not used for this purpose.</p>

<!-- next two paragraphs are nearly identical to the navigate-text section, keep them in sync -->

Expand Down Expand Up @@ -80927,20 +80928,22 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<p>When a plain text document is to be loaded in a <span>browsing context</span>, the user agent
must <span>queue a task</span> to create a <code>Document</code> object, mark it as being an <span
data-x="HTML documents">HTML document</span>, set its <span
data-x="concept-document-content-type">content type</span> to the sniffed MIME type of the
resource (<var>type</var> in the <span>navigate</span> algorithm), <span>initialise the
<code>Document</code> object</span>, create an <span>HTML parser</span>, associate it with the
<code>Document</code>, act as if the tokenizer had emitted a start tag token with the tag name
"pre" followed by a single U+000A LINE FEED (LF) character<!-- to get eaten, so that a leading LF
in the text/plain stream doesn't get eaten itself-->, and switch the <span>HTML parser</span>'s
tokenizer to the <span>PLAINTEXT state</span>. Each <span data-x="concept-task">task</span> that
the <span>networking task source</span> places on the <span>task queue</span> while fetching runs
must then fill the parser's <span>input byte stream</span> with the fetched bytes and cause the
<span>HTML parser</span> to perform the appropriate processing of the input stream.</p>
data-x="concept-document-content-type">content type</span> to the <span
data-x="Content-Type sniffing">computed MIME type</span> of the resource (<var>type</var> in the
<span>navigate</span> algorithm), <span>initialise the <code>Document</code> object</span>,
create an <span>HTML parser</span>, associate it with the <code>Document</code>, act as if the
tokenizer had emitted a start tag token with the tag name "pre" followed by a single U+000A LINE
FEED (LF) character<!-- to get eaten, so that a leading LF in the text/plain stream doesn't get
eaten itself-->, and switch the <span>HTML parser</span>'s tokenizer to the <span>PLAINTEXT
state</span>. Each <span data-x="concept-task">task</span> that the <span>networking task
source</span> places on the <span>task queue</span> while fetching runs must then fill the
parser's <span>input byte stream</span> with the fetched bytes and cause the <span>HTML
parser</span> to perform the appropriate processing of the input stream.</p>

<p>The rules for how to convert the bytes of the plain text document into actual characters, and
the rules for actually rendering the text to the user, are defined by the specifications for the
sniffed MIME type of the resource (<var>type</var> in the <span>navigate</span> algorithm).</p>
<span data-x="Content-Type sniffing">computed MIME type</span> of the resource (<var>type</var>
in the <span>navigate</span> algorithm).</p>

<p>The <span>document's character encoding</span> must be set to the character encoding used to
decode the document.</p>
Expand Down Expand Up @@ -81000,12 +81003,13 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<p>When an image, video, or audio resource is to be loaded in a <span>browsing context</span>, the
user agent should create a <code>Document</code> object, mark it as being an <span data-x="HTML
documents">HTML document</span>, set its <span data-x="concept-document-content-type">content
type</span> to the sniffed MIME type of the resource (<var>type</var> in the
<span>navigate</span> algorithm), <span>initialise the <code>Document</code> object</span>, append
an <code>html</code> element to the <code>Document</code>, append a <code>head</code> element and
a <code>body</code> element to the <code>html</code> element, append an element <var>host element</var> for the media, as described below, to the <code>body</code> element,
and set the appropriate attribute of the element <var>host element</var>, as described
below, to the address of the image, video, or audio resource.</p>
type</span> to the <span data-x="Content-Type sniffing">computed MIME type</span> of the
resource (<var>type</var> in the <span>navigate</span> algorithm), <span>initialise the <code>
Document</code> object</span>, append an <code>html</code> element to the <code>Document</code>,
append a <code>head</code> element and a <code>body</code> element to the <code>html</code>
element, append an element <var>host element</var> for the media, as described below, to the
<code>body</code> element, and set the appropriate attribute of the element <var>host
element</var>, as described below, to the address of the image, video, or audio resource.</p>

<p>The element <var>host element</var> to create for the media is the element given in
the table below in the second cell of the row whose first cell describes the media. The
Expand Down Expand Up @@ -81051,12 +81055,13 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<span>browsing context</span>, the user agent should create a <code>Document</code> object, mark
it as being an <span data-x="HTML documents">HTML document</span> and mark it as being a
<dfn>plugin document</dfn>, set its <span data-x="concept-document-content-type">content
type</span> to the sniffed MIME type of the resource (<var>type</var> in the
<span>navigate</span> algorithm), <span>initialise the <code>Document</code> object</span>, append
an <code>html</code> element to the <code>Document</code>, append a <code>head</code> element and
a <code>body</code> element to the <code>html</code> element, append an <code>embed</code> to the
<code>body</code> element, and set the <code data-x="attr-embed-src">src</code> attribute of the
<code>embed</code> element to the address of the resource.</p>
type</span> to the <span data-x="Content-Type sniffing">computed MIME type</span> of the
resource (<var>type</var> in the <span>navigate</span> algorithm), <span>initialise the
<code>Document</code> object</span>, append an <code>html</code> element to the
<code>Document</code>, append a <code>head</code> element and a <code>body</code> element to the
<code>html</code> element, append an <code>embed</code> to the <code>body</code> element, and
set the <code data-x="attr-embed-src">src</code> attribute of the <code>embed</code> element to
the address of the resource.</p>

<p class="note">The term <span>plugin document</span> is used by
<cite>Content Security Policy</cite> as part of the mechanism that ensures <code>iframe</code>s
Expand Down

0 comments on commit 2f58d1e

Please sign in to comment.