Skip to content

Commit

Permalink
[] (0) Make the 'navigate' step resolve URLs. Make the 'navigate' alg…
Browse files Browse the repository at this point in the history
…orithm more precise and correct and consistent, in particular regarding fragment identifiers. Fix some xrefs in the 'navigate' algorithm. More URLing. Add a placeholder for defining the term 'fetching'.

git-svn-id: http://svn.whatwg.org/webapps@1799 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 25, 2008
1 parent c864520 commit de32c16
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 113 deletions.
156 changes: 90 additions & 66 deletions index
Expand Up @@ -309,25 +309,28 @@
strings</a>
</ul>

<li><a href="#content-type-sniffing"><span class=secno>2.6
<li><a href="#fetching"><span class=secno>2.6 </span>Fetching
resources</a>

<li><a href="#content-type-sniffing"><span class=secno>2.7
</span>Determining the type of a resource</a>
<ul class=toc>
<li><a href="#content-type"><span class=secno>2.6.1
<li><a href="#content-type"><span class=secno>2.7.1
</span>Content-Type metadata</a>

<li><a href="#content-type0"><span class=secno>2.6.2
<li><a href="#content-type0"><span class=secno>2.7.2
</span>Content-Type sniffing: Web pages</a>

<li><a href="#content-type1"><span class=secno>2.6.3
<li><a href="#content-type1"><span class=secno>2.7.3
</span>Content-Type sniffing: text or binary</a>

<li><a href="#content-type2"><span class=secno>2.6.4
<li><a href="#content-type2"><span class=secno>2.7.4
</span>Content-Type sniffing: unknown type</a>

<li><a href="#content-type3"><span class=secno>2.6.5
<li><a href="#content-type3"><span class=secno>2.7.5
</span>Content-Type sniffing: image</a>

<li><a href="#content-type4"><span class=secno>2.6.6
<li><a href="#content-type4"><span class=secno>2.7.6
</span>Content-Type sniffing: feed or HTML</a>
</ul>
</ul>
Expand Down Expand Up @@ -5559,7 +5562,19 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
"<code>5.0</code>" also supports "<code title="">HTML</code>"
"<code>2.0</code>".

<h3 id=content-type-sniffing><span class=secno>2.6 </span>Determining the
<h3 id=fetching><span class=secno>2.6 </span>Fetching resources</h3>

<p class=big-issue>replace all instances of the word 'fetch' or 'download'
with a reference to this section, and put something here that talks about
caching, that redirects to the offline storage stuff when appropriate,
that defines that before fetching a URL you have to resolve the URL, so
that every case of fetching doesn't have to independently say to resolve
the URL, etc; "once fetched, a resource might have to have its type
determined", pointing to the next section but also explicitly saying that
it's up to the part of the spec doing the fetching to determine how the
type is established

<h3 id=content-type-sniffing><span class=secno>2.7 </span>Determining the
type of a resource</h3>

<p class=warning>It is imperative that the rules in this section be
Expand All @@ -5571,7 +5586,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
the end user can be exposed to malicious content, making the user
vulnerable to cookie theft attacks and other cross-site scripting attacks.

<h4 id=content-type><span class=secno>2.6.1 </span>Content-Type metadata</h4>
<h4 id=content-type><span class=secno>2.7.1 </span>Content-Type metadata</h4>

<p>What explicit <dfn id=content-type5 title=Content-Type>Content-Type
metadata</dfn> is associated with the resource (the resource's type
Expand Down Expand Up @@ -5654,7 +5669,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p class=note>The above algorithm is a willful violation of the HTTP
specification. <a href="#refsRFC2616">[RFC2616]</a>

<h4 id=content-type0><span class=secno>2.6.2 </span>Content-Type sniffing:
<h4 id=content-type0><span class=secno>2.7.2 </span>Content-Type sniffing:
Web pages</h4>

<p>The <dfn id=sniffed title="Content-Type sniffing">sniffed type of a
Expand Down Expand Up @@ -5755,7 +5770,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p>The sniffed type of the resource is <var title="">official type</var>.
</ol>

<h4 id=content-type1><span class=secno>2.6.3 </span><dfn
<h4 id=content-type1><span class=secno>2.7.3 </span><dfn
id=content-type6>Content-Type sniffing: text or binary</dfn></h4>

<ol>
Expand Down Expand Up @@ -5846,7 +5861,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p>Otherwise, the sniffed type of the resource is "text/plain".
</ol>

<h4 id=content-type2><span class=secno>2.6.4 </span><dfn
<h4 id=content-type2><span class=secno>2.7.4 </span><dfn
id=content-type7>Content-Type sniffing: unknown type</dfn></h4>

<ol>
Expand Down Expand Up @@ -6108,7 +6123,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
determine that content is not HTML and thus safe from XSS attacks, but
then a user agent detects it as HTML anyway and allows script to execute).

<h4 id=content-type3><span class=secno>2.6.5 </span><dfn
<h4 id=content-type3><span class=secno>2.7.5 </span><dfn
id=content-type8>Content-Type sniffing: image</dfn></h4>

<p>If the first bytes of the file match one of the byte sequences in the
Expand Down Expand Up @@ -6180,7 +6195,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<p>Otherwise, the sniffed type of the resource is the same as its <var
title="">official type</var>.

<h4 id=content-type4><span class=secno>2.6.6 </span><dfn
<h4 id=content-type4><span class=secno>2.7.6 </span><dfn
id=content-type9>Content-Type sniffing: feed or HTML</dfn></h4>
<!-- mostly based on:
http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx
Expand Down Expand Up @@ -15370,15 +15385,12 @@ The island of Shalott.&lt;/p></pre>
<p>If the <code title=attr-img-src><a href="#src">src</a></code> attribute
is omitted, the image represents whatever string is given by the element's
<code title=attr-img-alt><a href="#alt">alt</a></code> attribute, if any,
or nothing, if that attribute is empty or absent.</p>
<!-- XXXURL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \(URI\|IRI\|URL\) -->
or nothing, if that attribute is empty or absent.

<p>The <code title=attr-img-src><a href="#src">src</a></code> attribute, on
setting, must cause the user agent to immediately begin to download the
specified resource<!-- XXX xref what fetching means, XXXURL how to
resolve URLs in attributes (including those not in the DOM) -->,
unless the user agent cannot support images, or its support for images has
been disabled.
specified resource<!-- XXX xref what fetching means -->, unless the user
agent cannot support images, or its support for images has been disabled.

<p>The download of the image must <a href="#delays">delay the <code
title=event-load>load</code> event</a>.
Expand Down Expand Up @@ -15601,13 +15613,13 @@ the time Marco had stuck his tongue out...&lt;/p></pre>
<p>The <code><a href="#iframe">iframe</a></code> element introduces a new
nested <a href="#browsing1">browsing context</a>.

<p>The <dfn id=src1 title=attr-iframe-src><code>src</code></dfn> attribute,
if present, must be a <a href="#valid">valid URL</a> of a page that the
nested <a href="#browsing1">browsing context</a> is to contain. When the
browsing context is created, if the attribute is present, the user agent
must <a href="#navigate">navigate</a> this browsing context to the given
URI<!-- XXXURL resolve relative URLs -->, with <a
href="#replacement">replacement enabled</a>, and with the <code><a
<p>The <dfn id=src1 title=attr-iframe-src><code>src</code></dfn> attribute
gives the address of a page that the nested <a href="#browsing1">browsing
context</a> is to contain. The attribute, if present, must be a <a
href="#valid">valid URL</a>. When the browsing context is created, if the
attribute is present, the user agent must <a href="#navigate">navigate</a>
the element's browsing context to the given <a href="#url">URL</a>, with
<a href="#replacement">replacement enabled</a>, and with the <code><a
href="#iframe">iframe</a></code> element's document's <a
href="#browsing1">browsing context</a> as the <a href="#source0">source
browsing context</a>. If the user <a href="#navigate"
Expand All @@ -15619,12 +15631,10 @@ the time Marco had stuck his tongue out...&lt;/p></pre>

<p>Whenever the <code title=attr-iframe-src><a href="#src1">src</a></code>
attribute is set, the nested <a href="#browsing1">browsing context</a>
must be <a href="#navigate" title=navigate>navigated</a> to the given
URI<!-- XXXURL
resolve relative URLs -->, with the <code><a
href="#iframe">iframe</a></code> element's document's <a
href="#browsing1">browsing context</a> as the <a href="#source0">source
browsing context</a>.
must be <a href="#navigate" title=navigate>navigated</a> to the given <a
href="#url">URL</a>, with the <code><a href="#iframe">iframe</a></code>
element's document's <a href="#browsing1">browsing context</a> as the <a
href="#source0">source browsing context</a>.

<p>If the <code title=attr-iframe-src><a href="#src1">src</a></code>
attribute is not set when the element is created, the browsing context
Expand Down Expand Up @@ -16178,7 +16188,8 @@ the time Marco had stuck his tongue out...&lt;/p></pre>

<p>The <dfn id=data title=attr-object-data><code>data</code></dfn>
attribute, if present, specifies the address of the resource. If present,
the attribute must be a <a href="#valid">valid URL</a>.
the attribute must be a <a href="#valid">valid URL</a>.</p>
<!-- XXXURL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \(URI\|IRI\|URL\) -->

<p>The <dfn id=type6 title=attr-object-type><code>type</code></dfn>
attribute, if present, specifies the type of the resource. If present, the
Expand Down Expand Up @@ -34259,9 +34270,9 @@ user reload must be equivalent to .reload()
documents</h4>

<p>Certain actions cause the <a href="#browsing1">browsing context</a> to
<dfn id=navigate>navigate</dfn>. Navigation always involves a <dfn
id=source0>source browsing context</dfn>, which is the browsing context
which was responsible for starting the navigation.
<dfn id=navigate>navigate</dfn> to a new resource. Navigation always
involves <dfn id=source0>source browsing context</dfn>, which is the
browsing context which was responsible for starting the navigation.

<p class=example>For example, <a href="#following0" title="following
hyperlinks">following a hyperlink</a>, <span title="">form
Expand All @@ -34270,11 +34281,12 @@ user reload must be equivalent to .reload()
title=dom-location-assign><a href="#assign">location.assign()</a></code>
methods can all cause a browsing context to navigate.

<p>A user agent may also provide various ways for the user to explicitly
cause a browsing context to navigate.
<p>A user agent may provide various ways for the user to explicitly cause a
browsing context to navigate, in addition to those defined in this
specification.

<p>When a browsing context is navigated, the user agent must run the
following steps:
<p>When a browsing context is navigated to a new resource, the user agent
must run the following steps:

<ol>
<li id=sandboxLinks>
Expand All @@ -34285,14 +34297,13 @@ user reload must be equivalent to .reload()
contexts</a> of the <a href="#browsing1">browsing context</a> being
navigated, and the <a href="#source0">source browsing context</a> has
its <a href="#sandboxed">sandboxed navigation browsing context flag</a>
set, then abort these steps. The user agent may offer to open the
specified resource in a new <a href="#top-level">top-level browsing
context</a> or in the <a href="#top-level">top-level browsing
context</a> of the <a href="#source0">source browsing context</a>, at
the user's option, in which case the user agent must <a
href="#navigate">navigate</a> that designated <a
href="#top-level">top-level browsing context</a> to the specified
resource as if the user had requested it independently.
set, then abort these steps. The user agent may offer to open the new
resource in a new <a href="#top-level">top-level browsing context</a> or
in the <a href="#top-level">top-level browsing context</a> of the <a
href="#source0">source browsing context</a>, at the user's option, in
which case the user agent must <a href="#navigate">navigate</a> that
designated <a href="#top-level">top-level browsing context</a> to the
new resource as if the user had requested it independently.

<li id=seamlessLinks>
<p>If the <a href="#source0">source browsing context</a> is the same as
Expand All @@ -34306,13 +34317,24 @@ user reload must be equivalent to .reload()
title=navigate>navigated</a> instead.

<li>
<p>Cancel any preexisting attempt to navigate the browsing context.
<p>Cancel any preexisting attempt to navigate the <a
href="#browsing1">browsing context</a>.

<li>
<p>If the new resource is the same as the current resource, but a
fragment identifier has been specified, changed, or removed, then <a
href="#navigating0" title=navigate-fragid>navigate to that fragment
identifier</a> and abort these steps.
<li><a href="#resolve" title="resolve a url">Resolve</a> the <a
href="#url">URL</a> of the new resource. If that fails, abort these
steps.

<li id=navigate-fragid-step>
<p><i>Fragment identifiers</i>: If the <a href="#absolute">absolute
URL</a> of the new resource is the same as the <span title="the
document's address">address</span><!--XXXDOCURL--> of the <a
href="#active">active document</a> of the <a href="#browsing1">browsing
context</a> being navigated, ignoring any <a href="#ltfragmentgt"
title=url-fragment>&lt;fragment&gt;</a> components of those <a
href="#url" title=URL>URLs</a>, and the new resource is to be fetched
using HTTP GET or equivalent, then <a href="#navigating0"
title=navigate-fragid>navigate to that fragment identifier</a> and abort
these steps.

<li>
<p>If the new resource is to be handled by displaying some sort of inline
Expand Down Expand Up @@ -34345,12 +34367,13 @@ user reload must be equivalent to .reload()
title=concept-appcache-selection>most appropriate application cache</a>
of those that match.</p>
<!-- XXXURL JSURI issue -->
<p>Otherwise, start fetching the specified resource in the appropriate
manner (e.g. performing an HTTP GET or POST operation, or reading the
file from disk, or executing script in the case of a <a
<p>Otherwise, start fetching<!-- XXX xref --> the new resource in the
appropriate manner (e.g. performing an HTTP GET or POST operation, or
reading the file from disk, or executing script in the case of a <a
href="#the-javascript" title="javascript protocol"><code
title="">javascript:</code> URI</a>). If this results in a redirect,
return to step 2 with the new resource.</p>
return to <a href=navigate-fragid-step>the step labeled "fragment
identifiers"</a> with the new resource.</p>

<p class=example>For example, imagine an HTML page with an associated
application cache displaying an image and a form, where the image is
Expand Down Expand Up @@ -34484,11 +34507,11 @@ user reload must be equivalent to .reload()
</dl>

<li id=navigate-non-Document>
<p>If, given <var title="">type</var>, the new resource is to be handled
by displaying some sort of inline content, e.g. a native rendering of
the content, an error message because the specified type is not
supported, or an inline prompt to allow the user to select <a
href="#registercontenthandler"
<p><i>Non-document content</i>: If, given <var title="">type</var>, the
new resource is to be handled by displaying some sort of inline content,
e.g. a native rendering of the content, an error message because the
specified type is not supported, or an inline prompt to allow the user
to select <a href="#registercontenthandler"
title=dom-navigator-registerContentHandler>a registered handler</a> for
the given type, then <a href="#page-load4"
title=navigate-ua-inline>display the inline content</a> and abort these
Expand Down Expand Up @@ -34653,8 +34676,9 @@ user reload must be equivalent to .reload()
dispatch to alternative processing tools, e.g. determining that the
content is actually a syndication feed and passing it to a feed handler.
If such processing is to take place, abort the steps in this section, and
jump to <a href="#navigate-non-Document">step 10</a> in the <a
href="#navigate">navigate</a> steps above.
jump to <a href="#navigate-non-Document">the next step</a> (labeled
"non-document content") in the <a href="#navigate">navigate</a> steps
above.

<p>Otherwise, then, with the newly created <code>Document</code>, the user
agents must <a href="#update2">update the session history with the new
Expand Down

0 comments on commit de32c16

Please sign in to comment.