Merge WHATWG change: Refactor request cancellation.
--- a/Overview.html Wed Oct 23 11:07:00 2013 +0900
+++ b/Overview.html Wed Oct 23 11:25:18 2013 +0900
@@ -512,7 +512,7 @@
<dfn id="anonymous-flag">anonymous flag</dfn>. If the <a href="#anonymous-flag">anonymous flag</a> is set,
<a href="#user-credentials">user credentials</a> and the
<a href="#source-origin">source origin</a> are not exposed when
- <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetching</a> resources.
+ <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetching</a> resources.
<p>When the <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#javascript-global-environment">JavaScript global environment</a>
is a <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#document-environment">document environment</a>, the
@@ -587,7 +587,7 @@
<p>If an <code><a href="#xmlhttprequest">XMLHttpRequest</a></code> object is garbage collected while its
connection is still open, the user agent must cancel any instance of the
-<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch">fetch</a> algorithm opened by this object,
+<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch">fetch</a> algorithm opened by this object,
discarding any <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#concept-task" title="concept-task">tasks</a>
<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#queue-a-task" title="queue a task">queued</a> for them, and
discarding any further data received from the network for them.
@@ -726,6 +726,21 @@
<a href="#upload-complete-flag">upload complete flag</a>, and
<a href="#upload-events-flag">upload events flag</a> must be initially unset.
+<hr>
+
+<p>To <dfn id="cancel-the-request">cancel the request</dfn> run these steps:
+
+<ol>
+ <li><p>Set the <a href="#error-flag">error flag</a>.
+
+ <li><p>Cancel any instance of the <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch">fetch</a> algorithm
+ opened by this object.
+
+ <li><p>If there are any <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#concept-task" title="concept-task">tasks</a> from
+ the object's <a href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task source</a> in one of the
+ <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#task-queue" title="task queue">task queues</a>, then remove them.
+</ol>
+
<h4 id="the-open()-method"><span class="secno">4.6.1 </span>The <code title="">open()</code> method</h4>
@@ -863,18 +878,9 @@
"<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#invalidaccesserror">InvalidAccessError</a></code>" exception.
<li>
- <p>Set the <a href="#error-flag">error flag</a>.
-
- <p class="note">This is meaningless unless the
- <code title="dom-XMLHttpRequest-send"><a href="#dom-xmlhttprequest-send">send()</a></code> algorithm is running.
-
- <li><p>The user agent should cancel any network activity for which the object is
- responsible.
- <!-- we can hardly require it... -->
-
- <li><p>If there are any <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#concept-task" title="concept-task">tasks</a> from
- the object's <a href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task source</a> in one of the
- <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#task-queue" title="task queue">task queues</a>, then remove them.
+ <p><a href="#cancel-the-request">Cancel the request</a>.
+
+ <p class="note">After all, a request can be ongoing at this point.
<li>
<p>Set variables associated with the object as follows:</p>
@@ -1035,7 +1041,7 @@
<dt><code><var title="">client</var> . <a href="#dom-xmlhttprequest-timeout" title="dom-XMLHttpRequest-timeout">timeout</a></code>
<dd>
<p>Can be set to a time in milliseconds. When set to a non-zero value
- will cause <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetching</a> to
+ will cause <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetching</a> to
terminate after the given time has passed. When the time has passed, if
the <a href="#synchronous-flag">synchronous flag</a> is unset, a
<code title="event-xhr-timeout"><a href="#event-xhr-timeout">timeout</a></code> event will then be
@@ -1071,9 +1077,9 @@
<p class="note">This implies that the
<code title="dom-XMLHttpRequest-timeout"><a href="#dom-xmlhttprequest-timeout">timeout</a></code> attribute can be
- set while <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetching</a> is in
+ set while <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetching</a> is in
progress. If that occurs it will still be measured relative to the start
- of <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetching</a>.
+ of <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetching</a>.
<h4 id="the-withcredentials-attribute"><span class="secno">4.6.4 </span>The <code title="">withCredentials</code> attribute</h4>
@@ -1138,7 +1144,7 @@
<p class="note">The
<code title="dom-XMLHttpRequest-withCredentials"><a href="#dom-xmlhttprequest-withcredentials">withCredentials</a></code>
attribute has no effect when
- <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetching</a>
+ <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetching</a>
<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#same-origin" title="same origin">same-origin</a>
resources.</p>
@@ -1346,7 +1352,7 @@
<dd>
<p>These are the <dfn id="same-origin-request-steps">same-origin request steps</dfn>.</p>
- <p><a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch">Fetch</a> the
+ <p><a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch">Fetch</a> the
<a href="#request-url">request URL</a> from <i title="">origin</i>
<a href="#source-origin">source origin</a>, using
<a href="#referrer-source">referrer source</a> as
@@ -1723,16 +1729,7 @@
steps:</p>
<ol>
- <li><p>The user agent should cancel any network
- activity for which the object is responsible.</li>
-
- <li><p>If there are any
- <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#concept-task" title="concept-task">tasks</a> from the
- object's <a href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task source</a> in one of
- the <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#task-queue" title="task queue">task queues</a>,
- then remove them.
-
- <li><p>Set the the <a href="#error-flag">error flag</a>.
+ <li><p><a href="#cancel-the-request">Cancel the request</a>.
<li><p>Change the state to <a href="#dom-xmlhttprequest-done" title="dom-XMLHttpRequest-DONE">DONE</a>.</li>
@@ -1872,16 +1869,7 @@
these steps (unless otherwise noted):
<ol>
- <li><p>Set the <a href="#error-flag">error flag</a>.
-
- <li><p>The user agent should cancel any network
- activity for which the object is responsible.</li>
-
- <li><p>If there are any
- <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#concept-task" title="concept-task">tasks</a> from the
- object's <a href="#xmlhttprequest-task-source"><code>XMLHttpRequest</code> task source</a> in one of
- the <a class="external" href="http://www.w3.org/html/wg/drafts/html/master/webappapis.html#task-queue" title="task queue">task queues</a>,
- then remove them.
+ <li><p><a href="#cancel-the-request">Cancel the request</a>.
<li>
<p>If the state is <a href="#dom-xmlhttprequest-unsent" title="dom-XMLHttpRequest-UNSENT">UNSENT</a>,
@@ -2724,7 +2712,7 @@
<p>When a
<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#data-protocol" title="data-protocol"><code>data:</code> URL</a> is
-<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/urls.html#fetch" title="fetch">fetched</a> using the HTTP method
+<a class="external" href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#fetch" title="fetch">fetched</a> using the HTTP method
<code>GET</code>, determine the response as follows:
<ul>
--- a/Overview.src.html Wed Oct 23 11:07:00 2013 +0900
+++ b/Overview.src.html Wed Oct 23 11:25:18 2013 +0900
@@ -735,6 +735,21 @@
<span>upload complete flag</span>, and
<span>upload events flag</span> must be initially unset.
+<hr>
+
+<p>To <dfn>cancel the request</dfn> run these steps:
+
+<ol>
+ <li><p>Set the <span>error flag</span>.
+
+ <li><p>Cancel any instance of the <span data-anolis-spec=html>fetch</span> algorithm
+ opened by this object.
+
+ <li><p>If there are any <span data-anolis-spec=html title=concept-task>tasks</span> from
+ the object's <span><code>XMLHttpRequest</code> task source</span> in one of the
+ <span data-anolis-spec=html title="task queue">task queues</span>, then remove them.
+</ol>
+
<h4>The <code title>open()</code> method</h4>
@@ -872,18 +887,9 @@
"<code data-anolis-spec=dom>InvalidAccessError</code>" exception.
<li>
- <p>Set the <span>error flag</span>.
-
- <p class=note>This is meaningless unless the
- <code title=dom-XMLHttpRequest-send>send()</code> algorithm is running.
-
- <li><p>The user agent should cancel any network activity for which the object is
- responsible.
- <!-- we can hardly require it... -->
-
- <li><p>If there are any <span data-anolis-spec=html title=concept-task>tasks</span> from
- the object's <span><code>XMLHttpRequest</code> task source</span> in one of the
- <span data-anolis-spec=html title="task queue">task queues</span>, then remove them.
+ <p><span>Cancel the request</span>.
+
+ <p class=note>After all, a request can be ongoing at this point.
<li>
<p>Set variables associated with the object as follows:</p>
@@ -1732,16 +1738,7 @@
steps:</p>
<ol>
- <li><p>The user agent should cancel any network
- activity for which the object is responsible.</p></li>
-
- <li><p>If there are any
- <span data-anolis-spec=html title=concept-task>tasks</span> from the
- object's <span><code>XMLHttpRequest</code> task source</span> in one of
- the <span data-anolis-spec=html title="task queue">task queues</span>,
- then remove them.
-
- <li><p>Set the the <span>error flag</span>.
+ <li><p><span>Cancel the request</span>.
<li><p>Change the state to <span title="dom-XMLHttpRequest-DONE">DONE</span>.</p></li>
@@ -1881,16 +1878,7 @@
these steps (unless otherwise noted):
<ol>
- <li><p>Set the <span>error flag</span>.
-
- <li><p>The user agent should cancel any network
- activity for which the object is responsible.</p></li>
-
- <li><p>If there are any
- <span data-anolis-spec=html title=concept-task>tasks</span> from the
- object's <span><code>XMLHttpRequest</code> task source</span> in one of
- the <span data-anolis-spec=html title="task queue">task queues</span>,
- then remove them.
+ <li><p><span>Cancel the request</span>.
<li>
<p>If the state is <span title="dom-XMLHttpRequest-UNSENT">UNSENT</span>,
--- a/data/xrefs/dom/html-generated.json Wed Oct 23 11:07:00 2013 +0900
+++ b/data/xrefs/dom/html-generated.json Wed Oct 23 11:25:18 2013 +0900
@@ -364,7 +364,7 @@
"eventhandler": "webappapis.html#eventhandler",
"eventsource": "comms.html#eventsource",
"exposed to javascript": "infrastructure.html#exposed-to-javascript",
- "fetch": "urls.html#fetch",
+ "fetch": "infrastructure.html#fetch",
"fieldset": "forms.html#the-fieldset-element",
"figcaption": "grouping-content.html#the-figcaption-element",
"figure": "grouping-content.html#the-figure-element",
--- a/data/xrefs/dom/xhr.json Wed Oct 23 11:07:00 2013 +0900
+++ b/data/xrefs/dom/xhr.json Wed Oct 23 11:25:18 2013 +0900
@@ -5,6 +5,7 @@
"arraybuffer response entity body": "arraybuffer-response-entity-body",
"author request headers": "author-request-headers",
"blob response entity body": "blob-response-entity-body",
+ "cancel the request": "cancel-the-request",
"concept-response-header": "concept-response-header",
"concept-xmlhttprequest-document": "concept-xmlhttprequest-document",
"cross-origin request event rules": "cross-origin-request-event-rules",