<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192361] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192361">192361</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2015-11-12 05:34:01 -0800 (Thu, 12 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>XHR abort() event firing does not match spec
https://bugs.webkit.org/show_bug.cgi?id=98404
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
* web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt:
* web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt:
* web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt:
* web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt:
* web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt:
* web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt:
* web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt:
Source/WebCore:
Introducing explicit sendFlag as in the specification.
Previously, sendFlag was computed using !!m_loader.
But this does not work well for loadstart events since sendFlag should be true but m_loader is still null at that time.
Updated abort event firing test according specification.
For instance, compared to previously, the abort event is not fired in DONE state or if sendFlag is not set.
Covered by rebased tests.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener): Compute whether dispatching the load event before calling XHR readystatechange event callback.
(WebCore::XMLHttpRequest::setWithCredentials): Replacing m_loader by m_sendFlag to align with the spec.
(WebCore::XMLHttpRequest::open): Unsetting m_sendFlag..
(WebCore::XMLHttpRequest::initSend): Replacing m_loader by m_sendFlag to align with the spec.
(WebCore::XMLHttpRequest::createRequest): Setting m_sendFlag.
(WebCore::XMLHttpRequest::abort): Checking m_sendFlag and updating code to follow the specification.
(WebCore::XMLHttpRequest::genericError): Unsetting m_sendFlag.
(WebCore::XMLHttpRequest::setRequestHeader): Replacing m_loader by m_sendFlag to align with the spec.
(WebCore::XMLHttpRequest::didFinishLoading): Ditto.
(WebCore::XMLHttpRequest::didReachTimeout): Ditto.
* xml/XMLHttpRequest.h: Added m_sendFlag.
LayoutTests:
Rebasing test expectations.
* fast/events/event-fire-order-expected.txt:
* fast/events/event-fire-order.html: Updated so that it does not expect any event when aborting just after open().
* http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html: Updated to expect load event and not abort event when XHR state is DONE.
* http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html: Ditto.
* platform/gtk/TestExpectations: Removing timeout expectation for imported/w3c/web-platform-tests/XMLHttpRequest/interfaces.html</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventseventfireorderexpectedtxt">trunk/LayoutTests/fast/events/event-fire-order-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventseventfireorderhtml">trunk/LayoutTests/fast/events/event-fire-order.html</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestonloadendeventaftersyncrequestshtml">trunk/LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestuploadonloadendeventaftersyncrequestshtml">trunk/LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortafterreceiveexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortaftertimeoutexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortduringuploadexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestaborteventabortexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestaborteventorderexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestxmlhttprequesttimeoutabortedexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestxmlhttprequesttimeoutworkerabortedexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequesth">trunk/Source/WebCore/xml/XMLHttpRequest.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/ChangeLog        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-11-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ XHR abort() event firing does not match spec
+ https://bugs.webkit.org/show_bug.cgi?id=98404
+
+ Reviewed by Darin Adler.
+
+ Rebasing test expectations.
+
+ * fast/events/event-fire-order-expected.txt:
+ * fast/events/event-fire-order.html: Updated so that it does not expect any event when aborting just after open().
+ * http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html: Updated to expect load event and not abort event when XHR state is DONE.
+ * http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html: Ditto.
+ * platform/gtk/TestExpectations: Removing timeout expectation for imported/w3c/web-platform-tests/XMLHttpRequest/interfaces.html
+
</ins><span class="cx"> 2015-11-10 Keith Miller <keith_miller@apple.com>
</span><span class="cx">
</span><span class="cx"> Regression(r191815): 5.3% regression on Dromaeo JS Library Benchmark
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventseventfireorderexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/event-fire-order-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/event-fire-order-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/fast/events/event-fire-order-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">
</span><span class="cx"> If the test passes, you'll see a series of PASS messages below.
</span><span class="cx">
</span><del>-PASS: result should be f1,f2 and is.
-PASS: result should be f1,f2 and is.
-PASS: result should be f1,f2 and is.
</del><ins>+PASS: result should be 'f1,f2' and is.
+PASS: result should be 'f1,f2' and is.
+PASS: result should be '' and is.
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventseventfireorderhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/event-fire-order.html (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/event-fire-order.html        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/fast/events/event-fire-order.html        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -49,12 +49,12 @@
</span><span class="cx"> var end = result.length > expected.length ? result.length : expected.length;
</span><span class="cx"> for (var i = 0; i < end; ++i) {
</span><span class="cx"> if (result[i] != expected[i]) {
</span><del>- log("FAIL: " + name + " result[" + i + "] should be " + expected[i] + " but instead is " + result[i] + ".");
</del><ins>+ log("FAIL: " + name + " result[" + i + "] should be '" + expected[i] + "' but instead is '" + result[i] + "'.");
</ins><span class="cx"> passed = false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if (passed)
</span><del>- log("PASS: result should be " + expected + " and is.");
</del><ins>+ log("PASS: result should be '" + expected + "' and is.");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> var tests = [
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> x.open("POST", "resources/does-not-exist");
</span><span class="cx"> x.abort();
</span><span class="cx">
</span><del>- reportResult(arguments.callee.name, [ "f1", "f2" ]);
</del><ins>+ reportResult(arguments.callee.name, []);
</ins><span class="cx"> }
</span><span class="cx"> ];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestonloadendeventaftersyncrequestshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/onloadend-event-after-sync-requests.html        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -81,11 +81,12 @@
</span><span class="cx"> results = "";
</span><span class="cx">
</span><span class="cx"> xhr.onloadstart = logUnexpectedProgressEvent;
</span><del>- xhr.onabort = logProgressEvent;
</del><ins>+ xhr.onabort = logUnexpectedProgressEvent;
</ins><span class="cx"> xhr.onerror = logUnexpectedProgressEvent;
</span><del>- xhr.onload = logUnexpectedProgressEvent;
</del><ins>+ xhr.onload = logProgressEvent;
</ins><span class="cx"> xhr.onloadend = logProgressEvent;
</span><span class="cx"> xhr.onreadystatechange = function(e) {
</span><ins>+ // abort in DONE state should do nothing.
</ins><span class="cx"> if (xhr.readyState == xhr.DONE)
</span><span class="cx"> xhr.abort();
</span><span class="cx"> }
</span><span class="lines">@@ -98,8 +99,7 @@
</span><span class="cx"> if (e.code != e.NETWORK_ERR)
</span><span class="cx"> results += " " + e;
</span><span class="cx"> }
</span><del>-
- completeTest(" abort loadend");
</del><ins>+ completeTest(" load loadend");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> testNormal();
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestuploadonloadendeventaftersyncrequestshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onloadend-event-after-sync-requests.html        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -59,11 +59,12 @@
</span><span class="cx"> results = "";
</span><span class="cx">
</span><span class="cx"> xhr.onloadstart = logUnexpectedProgressEvent;
</span><del>- xhr.onabort = logProgressEvent;
</del><ins>+ xhr.onabort = logUnexpectedProgressEvent;
</ins><span class="cx"> xhr.onerror = logUnexpectedProgressEvent;
</span><del>- xhr.onload = logUnexpectedProgressEvent;
</del><ins>+ xhr.onload = logProgressEvent;
</ins><span class="cx"> xhr.onloadend = logProgressEvent;
</span><span class="cx"> xhr.onreadystatechange = function(e) {
</span><ins>+ // abort in DONE state should do nothing.
</ins><span class="cx"> if (xhr.readyState == xhr.DONE)
</span><span class="cx"> xhr.abort();
</span><span class="cx"> }
</span><span class="lines">@@ -77,7 +78,7 @@
</span><span class="cx"> results += " " + e;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- completeTest(" abort loadend");
</del><ins>+ completeTest(" load loadend");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> testNormal();
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-11-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ XHR abort() event firing does not match spec
+ https://bugs.webkit.org/show_bug.cgi?id=98404
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt:
+ * web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt:
+ * web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt:
+ * web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt:
+ * web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt:
+ * web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt:
+ * web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt:
+
</ins><span class="cx"> 2015-11-10 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> XMLHttpRequestUpload should support ontimeout event handler
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortafterreceiveexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-receive-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL XMLHttpRequest: abort() after successful receive should not fire "abort" event assert_unreached: abort() should not cause the abort event to fire Reached unreachable code
</del><ins>+PASS XMLHttpRequest: abort() after successful receive should not fire "abort" event
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortaftertimeoutexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-after-timeout-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL XMLHttpRequest: abort() after a timeout should not fire "abort" event assert_unreached: abort() should not cause the abort event to fire Reached unreachable code
</del><ins>+PASS XMLHttpRequest: abort() after a timeout should not fire "abort" event
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestabortduringuploadexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-upload-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL XMLHttpRequest: abort() while sending data assert_equals: expected 4 but got 0
</del><ins>+PASS XMLHttpRequest: abort() while sending data
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestaborteventabortexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-abort-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL XMLHttpRequest: The abort() method: do not fire abort event in OPENED state when send() flag is unset. send() throws after abort(). assert_unreached: when abort() is called, state is OPENED with the send() flag being unset, must not fire abort event per spec Reached unreachable code
</del><ins>+PASS XMLHttpRequest: The abort() method: do not fire abort event in OPENED state when send() flag is unset. send() throws after abort().
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestaborteventorderexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-event-order-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL XMLHttpRequest: The abort() method: abort and loadend events assert_array_equals: lengths differ, expected 6 got 5
</del><ins>+PASS XMLHttpRequest: The abort() method: abort and loadend events
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestxmlhttprequesttimeoutabortedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -6,5 +6,4 @@
</span><span class="cx"> PASS Timeout test: No events should fire for an unsent, unaborted request
</span><span class="cx"> PASS Timeout test: time to abort is -1, timeout set at 2000
</span><span class="cx"> PASS Timeout test: time to abort is 5000, timeout set at 2000
</span><del>-PASS Timeout test: time to abort is 5000, timeout set at 2000
</del><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestxmlhttprequesttimeoutworkerabortedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted-expected.txt        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -6,5 +6,4 @@
</span><span class="cx"> PASS Timeout test: No events should fire for an unsent, unaborted request
</span><span class="cx"> PASS Timeout test: time to abort is -1, timeout set at 2000
</span><span class="cx"> PASS Timeout test: time to abort is 5000, timeout set at 2000
</span><del>-PASS Timeout test: time to abort is 5000, timeout set at 2000
</del><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -2518,7 +2518,6 @@
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/status-basic.htm [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/status-error.htm [ Failure ]
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/event-readystatechange-loaded.htm [ Timeout ]
</span><del>-imported/w3c/web-platform-tests/XMLHttpRequest/interfaces.html [ Timeout ]
</del><span class="cx">
</span><span class="cx"> webkit.org/b/148938 accessibility/aria-table-hierarchy.html [ Failure ]
</span><span class="cx"> webkit.org/b/148938 accessibility/aria-table-with-presentational-elements.html [ Failure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/Source/WebCore/ChangeLog        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-11-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ XHR abort() event firing does not match spec
+ https://bugs.webkit.org/show_bug.cgi?id=98404
+
+ Reviewed by Darin Adler.
+
+ Introducing explicit sendFlag as in the specification.
+ Previously, sendFlag was computed using !!m_loader.
+ But this does not work well for loadstart events since sendFlag should be true but m_loader is still null at that time.
+
+ Updated abort event firing test according specification.
+ For instance, compared to previously, the abort event is not fired in DONE state or if sendFlag is not set.
+
+ Covered by rebased tests.
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::callReadyStateChangeListener): Compute whether dispatching the load event before calling XHR readystatechange event callback.
+ (WebCore::XMLHttpRequest::setWithCredentials): Replacing m_loader by m_sendFlag to align with the spec.
+ (WebCore::XMLHttpRequest::open): Unsetting m_sendFlag..
+ (WebCore::XMLHttpRequest::initSend): Replacing m_loader by m_sendFlag to align with the spec.
+ (WebCore::XMLHttpRequest::createRequest): Setting m_sendFlag.
+ (WebCore::XMLHttpRequest::abort): Checking m_sendFlag and updating code to follow the specification.
+ (WebCore::XMLHttpRequest::genericError): Unsetting m_sendFlag.
+ (WebCore::XMLHttpRequest::setRequestHeader): Replacing m_loader by m_sendFlag to align with the spec.
+ (WebCore::XMLHttpRequest::didFinishLoading): Ditto.
+ (WebCore::XMLHttpRequest::didReachTimeout): Ditto.
+ * xml/XMLHttpRequest.h: Added m_sendFlag.
+
</ins><span class="cx"> 2015-11-12 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GStreamer] Use RunLoop::timer in MediaPlayerPrivateGStreamerBase for GL drawing
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -373,10 +373,13 @@
</span><span class="cx"> if (!scriptExecutionContext())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // Check whether sending load and loadend events before sending readystatechange event, as it may change m_error/m_state values.
+ bool shouldSendLoadEvent = (m_state == DONE && !m_error);
+
</ins><span class="cx"> if (m_async || (m_state <= OPENED || m_state == DONE))
</span><span class="cx"> m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(eventNames().readystatechangeEvent, false, false), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
</span><span class="cx">
</span><del>- if (m_state == DONE && !m_error) {
</del><ins>+ if (shouldSendLoadEvent) {
</ins><span class="cx"> m_progressEventThrottle.dispatchProgressEvent(eventNames().loadEvent);
</span><span class="cx"> m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);
</span><span class="cx"> }
</span><span class="lines">@@ -384,7 +387,7 @@
</span><span class="cx">
</span><span class="cx"> void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- if (m_state > OPENED || m_loader) {
</del><ins>+ if (m_state > OPENED || m_sendFlag) {
</ins><span class="cx"> ec = INVALID_STATE_ERR;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -476,6 +479,7 @@
</span><span class="cx"> State previousState = m_state;
</span><span class="cx"> m_state = UNSENT;
</span><span class="cx"> m_error = false;
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> m_uploadComplete = false;
</span><span class="cx">
</span><span class="cx"> // clear stuff from possible previous load
</span><span class="lines">@@ -565,10 +569,11 @@
</span><span class="cx"> if (!scriptExecutionContext())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (m_state != OPENED || m_loader) {
</del><ins>+ if (m_state != OPENED || m_sendFlag) {
</ins><span class="cx"> ec = INVALID_STATE_ERR;
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+ ASSERT(!m_loader);
</ins><span class="cx">
</span><span class="cx"> m_error = false;
</span><span class="cx"> return true;
</span><span class="lines">@@ -716,6 +721,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ m_sendFlag = true;
+
</ins><span class="cx"> // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not
</span><span class="cx"> // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all.
</span><span class="cx"> // Also, only async requests support upload progress events.
</span><span class="lines">@@ -782,6 +789,7 @@
</span><span class="cx"> // and they are referenced by the JavaScript wrapper.
</span><span class="cx"> setPendingActivity(this);
</span><span class="cx"> if (!m_loader) {
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> m_timeoutTimer.stop();
</span><span class="cx"> m_networkErrorTimer.startOneShot(0);
</span><span class="cx"> }
</span><span class="lines">@@ -801,8 +809,6 @@
</span><span class="cx"> // internalAbort() calls dropProtection(), which may release the last reference.
</span><span class="cx"> Ref<XMLHttpRequest> protect(*this);
</span><span class="cx">
</span><del>- bool sendFlag = m_loader;
-
</del><span class="cx"> if (!internalAbort())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -810,16 +816,13 @@
</span><span class="cx">
</span><span class="cx"> // Clear headers as required by the spec
</span><span class="cx"> m_requestHeaders.clear();
</span><del>-
- if ((m_state <= OPENED && !sendFlag) || m_state == DONE)
- m_state = UNSENT;
- else {
</del><ins>+ if ((m_state == OPENED && m_sendFlag) || m_state == HEADERS_RECEIVED || m_state == LOADING) {
</ins><span class="cx"> ASSERT(!m_loader);
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> changeState(DONE);
</span><del>- m_state = UNSENT;
</del><ins>+ dispatchErrorEvents(eventNames().abortEvent);
</ins><span class="cx"> }
</span><del>-
- dispatchErrorEvents(eventNames().abortEvent);
</del><ins>+ m_state = UNSENT;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool XMLHttpRequest::internalAbort()
</span><span class="lines">@@ -881,6 +884,7 @@
</span><span class="cx"> {
</span><span class="cx"> clearResponse();
</span><span class="cx"> clearRequest();
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> m_error = true;
</span><span class="cx">
</span><span class="cx"> changeState(DONE);
</span><span class="lines">@@ -934,7 +938,7 @@
</span><span class="cx">
</span><span class="cx"> void XMLHttpRequest::setRequestHeader(const String& name, const String& value, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- if (m_state != OPENED || m_loader) {
</del><ins>+ if (m_state != OPENED || m_sendFlag) {
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx"> if (usesDashboardBackwardCompatibilityMode())
</span><span class="cx"> return;
</span><span class="lines">@@ -1118,6 +1122,7 @@
</span><span class="cx"> bool hadLoader = m_loader;
</span><span class="cx"> m_loader = nullptr;
</span><span class="cx">
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> changeState(DONE);
</span><span class="cx"> m_responseEncoding = String();
</span><span class="cx"> m_decoder = nullptr;
</span><span class="lines">@@ -1241,6 +1246,7 @@
</span><span class="cx"> clearResponse();
</span><span class="cx"> clearRequest();
</span><span class="cx">
</span><ins>+ m_sendFlag = false;
</ins><span class="cx"> m_error = true;
</span><span class="cx"> m_exceptionCode = XMLHttpRequestException::TIMEOUT_ERR;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (192360 => 192361)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.h        2015-11-12 13:19:30 UTC (rev 192360)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h        2015-11-12 13:34:01 UTC (rev 192361)
</span><span class="lines">@@ -216,6 +216,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<ThreadableLoader> m_loader;
</span><span class="cx"> State m_state;
</span><ins>+ bool m_sendFlag { false };
</ins><span class="cx">
</span><span class="cx"> ResourceResponse m_response;
</span><span class="cx"> String m_responseEncoding;
</span></span></pre>
</div>
</div>
</body>
</html>