Skip to content

Commit

Permalink
[] (0) Provide a sync version of the fetch algorithm, for XHR to refe…
Browse files Browse the repository at this point in the history
…rence.

git-svn-id: http://svn.whatwg.org/webapps@4742 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 15, 2010
1 parent c26afe7 commit d3147d4
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 37 deletions.
41 changes: 29 additions & 12 deletions complete.html
Expand Up @@ -5201,8 +5201,15 @@ <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>

<p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or
<a href=#url>URL</a>, optionally from an origin <i title="">origin</i>,
the following steps must be run. (When a <em>URL</em> is to be
fetched, the URL identifies a resource to be obtained.)</p>
and optionally with a <i>synchronous flag</i>, the following steps
must be run. (When a <em>URL</em> is to be fetched, the URL
identifies a resource to be obtained.)</p>

<!-- if invoked with the synchronous flag, make sure to release the
storage mutex first -->

<!-- synchronous flag is only used by sync-XHR, for legacy reasons;
don't use it in new features! -->

<ol><li>

Expand Down Expand Up @@ -5238,7 +5245,8 @@ <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>

</li>

<li><p>Perform the remaining steps asynchronously.</li>
<li><p>If the algorithm was not invoked with the <i>synchronous
flag</i>, perform the remaining steps asynchronously.</li>

<li>

Expand All @@ -5260,8 +5268,8 @@ <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>
URLs</span></a>, etc).</p>

<p class=note>The HTTP specification requires that 301, 302, and
307 redirects, when applied to methods other than GET or HEAD, not
be followed without user confirmation.</p>
307 redirects, when applied to methods other than the safe
methods, not be followed without user confirmation. <a href=#refsHTTP>[HTTP]</a></p>

<p>For the purposes of the <code title=http-referer>Referer</code> (sic) header, use the
<i>address of the resource from which Request-URIs are
Expand Down Expand Up @@ -5296,13 +5304,22 @@ <h3 id=fetching-resources><span class=secno>2.6 </span>Fetching resources</h3>

</ol></li>

<li><p>When the resource is available, or if there is an error of
some description, <a href=#queue-a-task>queue a task</a> that uses the resource
as appropriate. If the resource can be processed incrementally, as,
for instance, with a progressively interlaced JPEG or an HTML file,
additional tasks may be queued to process the data as it is
downloaded. The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task
source</a>.</p>
<li>

<p>If the algorithm was not invoked with the <i>synchronous
flag</i>: When the resource is available, or if there is an error
of some description, <a href=#queue-a-task>queue a task</a> that uses the
resource as appropriate. If the resource can be processed
incrementally, as, for instance, with a progressively interlaced
JPEG or an HTML file, additional tasks may be queued to process
the data as it is downloaded. The <a href=#task-source>task source</a> for
these <a href=#concept-task title=concept-task>tasks</a> is the
<a href=#networking-task-source>networking task source</a>.</p>

<p>Otherwise, return the resource or error information to the
calling algorithm.</p>

</li>

</ol><p>If the user agent can determine the actual length of the resource
being <a href=#fetch title=fetch>fetched</a> for an instance of this
Expand Down
41 changes: 29 additions & 12 deletions index
Expand Up @@ -5100,8 +5100,15 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or
<a href=#url>URL</a>, optionally from an origin <i title="">origin</i>,
the following steps must be run. (When a <em>URL</em> is to be
fetched, the URL identifies a resource to be obtained.)</p>
and optionally with a <i>synchronous flag</i>, the following steps
must be run. (When a <em>URL</em> is to be fetched, the URL
identifies a resource to be obtained.)</p>

<!-- if invoked with the synchronous flag, make sure to release the
storage mutex first -->

<!-- synchronous flag is only used by sync-XHR, for legacy reasons;
don't use it in new features! -->

<ol><li>

Expand Down Expand Up @@ -5137,7 +5144,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</li>

<li><p>Perform the remaining steps asynchronously.</li>
<li><p>If the algorithm was not invoked with the <i>synchronous
flag</i>, perform the remaining steps asynchronously.</li>

<li>

Expand All @@ -5159,8 +5167,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
URLs</span></a>, etc).</p>

<p class=note>The HTTP specification requires that 301, 302, and
307 redirects, when applied to methods other than GET or HEAD, not
be followed without user confirmation.</p>
307 redirects, when applied to methods other than the safe
methods, not be followed without user confirmation. <a href=#refsHTTP>[HTTP]</a></p>

<p>For the purposes of the <code title=http-referer>Referer</code> (sic) header, use the
<i>address of the resource from which Request-URIs are
Expand Down Expand Up @@ -5195,13 +5203,22 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</ol></li>

<li><p>When the resource is available, or if there is an error of
some description, <a href=#queue-a-task>queue a task</a> that uses the resource
as appropriate. If the resource can be processed incrementally, as,
for instance, with a progressively interlaced JPEG or an HTML file,
additional tasks may be queued to process the data as it is
downloaded. The <a href=#task-source>task source</a> for these <a href=#concept-task title=concept-task>tasks</a> is the <a href=#networking-task-source>networking task
source</a>.</p>
<li>

<p>If the algorithm was not invoked with the <i>synchronous
flag</i>: When the resource is available, or if there is an error
of some description, <a href=#queue-a-task>queue a task</a> that uses the
resource as appropriate. If the resource can be processed
incrementally, as, for instance, with a progressively interlaced
JPEG or an HTML file, additional tasks may be queued to process
the data as it is downloaded. The <a href=#task-source>task source</a> for
these <a href=#concept-task title=concept-task>tasks</a> is the
<a href=#networking-task-source>networking task source</a>.</p>

<p>Otherwise, return the resource or error information to the
calling algorithm.</p>

</li>

</ol><p>If the user agent can determine the actual length of the resource
being <a href=#fetch title=fetch>fetched</a> for an instance of this
Expand Down
43 changes: 30 additions & 13 deletions source
Expand Up @@ -4716,8 +4716,15 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<p>When a user agent is to <dfn>fetch</dfn> a resource or
<span>URL</span>, optionally from an origin <i title="">origin</i>,
the following steps must be run. (When a <em>URL</em> is to be
fetched, the URL identifies a resource to be obtained.)</p>
and optionally with a <i>synchronous flag</i>, the following steps
must be run. (When a <em>URL</em> is to be fetched, the URL
identifies a resource to be obtained.)</p>

<!-- if invoked with the synchronous flag, make sure to release the
storage mutex first -->

<!-- synchronous flag is only used by sync-XHR, for legacy reasons;
don't use it in new features! -->

<ol>

Expand Down Expand Up @@ -4761,7 +4768,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</li>

<li><p>Perform the remaining steps asynchronously.</p></li>
<li><p>If the algorithm was not invoked with the <i>synchronous
flag</i>, perform the remaining steps asynchronously.</p></li>

<li>

Expand All @@ -4786,8 +4794,9 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
URLs</span></span>, etc).</p>

<p class="note">The HTTP specification requires that 301, 302, and
307 redirects, when applied to methods other than GET or HEAD, not
be followed without user confirmation.</p>
307 redirects, when applied to methods other than the safe
methods, not be followed without user confirmation. <a
href="#refsHTTP">[HTTP]</a></p>

<p>For the purposes of the <code
title="http-referer">Referer</code> (sic) header, use the
Expand Down Expand Up @@ -4832,14 +4841,22 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</li>

<li><p>When the resource is available, or if there is an error of
some description, <span>queue a task</span> that uses the resource
as appropriate. If the resource can be processed incrementally, as,
for instance, with a progressively interlaced JPEG or an HTML file,
additional tasks may be queued to process the data as it is
downloaded. The <span>task source</span> for these <span
title="concept-task">tasks</span> is the <span>networking task
source</span>.</p>
<li>

<p>If the algorithm was not invoked with the <i>synchronous
flag</i>: When the resource is available, or if there is an error
of some description, <span>queue a task</span> that uses the
resource as appropriate. If the resource can be processed
incrementally, as, for instance, with a progressively interlaced
JPEG or an HTML file, additional tasks may be queued to process
the data as it is downloaded. The <span>task source</span> for
these <span title="concept-task">tasks</span> is the
<span>networking task source</span>.</p>

<p>Otherwise, return the resource or error information to the
calling algorithm.</p>

</li>

</ol>

Expand Down

0 comments on commit d3147d4

Please sign in to comment.