Title: [161541] trunk
Revision
161541
Author
[email protected]
Date
2014-01-08 19:56:47 -0800 (Wed, 08 Jan 2014)

Log Message

Unreviewed, rolling out r161532.
http://trac.webkit.org/changeset/161532
https://bugs.webkit.org/show_bug.cgi?id=126677

Caused lots of assertion failures (Requested by ap on
#webkit).

Source/WebCore:

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::abort):
(WebCore::XMLHttpRequest::networkError):
(WebCore::XMLHttpRequest::abortError):
(WebCore::XMLHttpRequest::didSendData):
(WebCore::XMLHttpRequest::didReceiveData):
(WebCore::XMLHttpRequest::didTimeout):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd):
(WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::fired):
(WebCore::XMLHttpRequestProgressEventThrottle::hasEventToDispatch):
(WebCore::XMLHttpRequestProgressEventThrottle::suspend):
* xml/XMLHttpRequestProgressEventThrottle.h:
* xml/XMLHttpRequestUpload.cpp:
(WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
(WebCore::XMLHttpRequestUpload::dispatchEventAndLoadEnd):
* xml/XMLHttpRequestUpload.h:

LayoutTests:

* fast/xmlhttprequest/xmlhttprequest-get-expected.txt:
* http/tests/xmlhttprequest/loadstart-event-init-expected.txt: Removed.
* http/tests/xmlhttprequest/loadstart-event-init.html: Removed.
* http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt: Removed.
* http/tests/xmlhttprequest/onabort-progressevent-attributes.html: Removed.
* http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt: Removed.
* http/tests/xmlhttprequest/onload-progressevent-attributes.html: Removed.
* http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt: Removed.
* http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html: Removed.
* http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt: Removed.
* http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161540 => 161541)


--- trunk/LayoutTests/ChangeLog	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/ChangeLog	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,3 +1,24 @@
+2014-01-08  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r161532.
+        http://trac.webkit.org/changeset/161532
+        https://bugs.webkit.org/show_bug.cgi?id=126677
+
+        Caused lots of assertion failures (Requested by ap on
+        #webkit).
+
+        * fast/xmlhttprequest/xmlhttprequest-get-expected.txt:
+        * http/tests/xmlhttprequest/loadstart-event-init-expected.txt: Removed.
+        * http/tests/xmlhttprequest/loadstart-event-init.html: Removed.
+        * http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt: Removed.
+        * http/tests/xmlhttprequest/onabort-progressevent-attributes.html: Removed.
+        * http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt: Removed.
+        * http/tests/xmlhttprequest/onload-progressevent-attributes.html: Removed.
+        * http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt: Removed.
+        * http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html: Removed.
+        * http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt: Removed.
+        * http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html: Removed.
+
 2014-01-08  Jinwoo Song  <[email protected]>
 
         Unreviewed EFL gardening. Rebaseline after r161521.

Modified: trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt (161540 => 161541)


--- trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -53,9 +53,9 @@
 initEvent : 'function initEvent() {
     [native code]
 }'
-lengthComputable : 'true'
-loaded : '174'
-position : '174'
+lengthComputable : 'false'
+loaded : '0'
+position : '0'
 preventDefault : 'function preventDefault() {
     [native code]
 }'
@@ -68,7 +68,7 @@
     [native code]
 }'
 target : '[object XMLHttpRequest]'
-total : '174'
-totalSize : '174'
+total : '0'
+totalSize : '0'
 type : 'load'
 

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init-expected.txt (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,3 +0,0 @@
-
-PASS XMLHttpRequest: ensure loadstart event progress members are correctly initialized 
-

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init.html (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init.html	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/loadstart-event-init.html	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>XMLHttpRequest: ensure loadstart event progress members are correctly initialized</title>
-    <script src=""
-    <script src=""
-</head>
-
-<body>
-    <div id="log"></div>
-
-    <script type="text/_javascript_">
-        var test = async_test()
-        test.step(function() {
-            var count = 0;
-            var xhr = new XMLHttpRequest();
-
-            xhr._onloadstart_ = test.step_func(function(e)
-            {
-                assert_equals(e.loaded, 0, "loaded member of xhr.loadstart event should be 0")
-                if (count == 1) {
-                    test.done();
-                }
-            })
-
-            xhr.upload._onloadstart_ = test.step_func(function(e)
-            {
-                assert_equals(e.loaded, 0, "loaded member of xhr.upload.loadstart event should be 0");
-            })
-
-            xhr._onloadend_ = function(e)
-            {
-                if (count++ < 1) {
-                    xhr.open("POST", "./resources/content.php", true);
-                    xhr.send("test");
-                }                    
-            }
-
-            xhr.open("POST", "./resources/content.php", true);
-            xhr.send("test");
-        });
-    </script>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,6 +0,0 @@
-Test case for bug 120828: Correctly set XHR loadend attributes (loaded and total).
-
-Verify that abort and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.
-
-PASS
-

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes.html (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes.html	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/onabort-progressevent-attributes.html	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,77 +0,0 @@
-<html>
-<head>
-<title>Test case for bug 120828 (abort case)</title>
-</head>
-<body>
-<p>Test case for <a href="" bug 120828</a>: Correctly set XHR loadend attributes (loaded and total).</p>
-<p>Verify that abort and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.</p>
-<p id=console></p>
-<script type="text/_javascript_">
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var status = "PASS";
-var total = 0;
-var loaded = 0;
-
-function onProgressEvent(e)
-{
-    if (total != e.total || loaded != e.loaded)
-        fail("Event " + e.type + "total/loaded values not matching: " 
-            + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")");
-}
-
-function onUnexpectedProgressEvent(e)
-{
-    fail("unexpected ProgressEvent: " + e.type);
-}
-
-function fail(msg)
-{
-    status = "FAILED: " + msg;
-    completeTest();
-    status = "";
-}
-
-function completeTest()
-{
-    log(status);
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function test() 
-{
-    var iteration = 2;
-    var delay = "1000";
-
-    var req = new XMLHttpRequest();
-    req._onprogress_ = function(e){
-        total = e.total;
-        loaded = e.loaded;
-        req.abort();
-    };
-    req._onerror_ = onUnexpectedProgressEvent;
-    req._onabort_ = onProgressEvent;
-    req._onloadend_ = function(e) {
-        onProgressEvent(e);
-        completeTest();
-    }
-    req.open("GET", "resources/download-with-delay.php?iteration=" + iteration + "&delay=" + delay, true);
-    req.send(null);
-
-}
-
-function log(message)
-{
-    var consoleElt = document.getElementById("console");
-    consoleElt.innerHTML += message + "<br/>";
-}
-
-test(); 
-
-</script>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,6 +0,0 @@
-Test case for bug 120828: Correctly set XHR loadend attributes (loaded and total).
-
-Verify that load and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.
-
-PASS
-

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes.html (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes.html	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/onload-progressevent-attributes.html	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,78 +0,0 @@
-<html>
-<head>
-<title>Test case for bug 120828</title>
-</head>
-<body>
-<p> Test case for <a href="" bug 120828</a>: Correctly set XHR loadend attributes (loaded and total).</p>
-<p> Verify that load and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.</p>
-<p id=console></p>
-<script type="text/_javascript_">
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var status = "PASS";
-var total = 0;
-var loaded = 0;
-
-function onProgressEvent(e)
-{
-    if (total != e.total || loaded != e.loaded)
-        fail("Event " + e.type + " total/loaded values not matching: " 
-            + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")");
-}
-
-function onUnexpectedProgressEvent(e)
-{
-    fail("unexpected ProgressEvent: " + e.type);
-}
-
-function fail(msg)
-{
-    status = "FAILED: " + msg;
-    completeTest();
-    status = "";
-}
-
-function completeTest()
-{
-    log(status);
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function test() 
-{
-    var req = new XMLHttpRequest();
-    req._onreadystatechange_ = function(e) {
-        if (req.readyState == req.DONE) {
-            if (this.status == 200)
-                total = loaded = req.responseText.length;
-            else
-                fail("unexpected status: " + status);
-        }
-    }
-    req._onabort_ = onUnexpectedProgressEvent;
-    req._onerror_ = onUnexpectedProgressEvent;
-    req._onload_ = onProgressEvent;
-    req._onloadend_ = function(e) {
-        onProgressEvent(e);
-        completeTest();
-    }
-
-    req.open("GET", "resources/get.txt", true); 
-    req.send();
-}
-
-function log(message)
-{
-    var consoleElt = document.getElementById("console");
-    consoleElt.innerHTML += message + "<br/>";
-}
-
-test(); 
-
-</script>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,6 +0,0 @@
-Test case for bug 120828: Correctly set XHR loadend attributes (loaded and total).
-
-Upload case: verify that abort and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.
-
-PASS
-

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onabort-progressevent-attributes.html	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,78 +0,0 @@
-<html>
-<head>
-<title>Test case for bug 120828 (abort case)</title>
-</head>
-<body>
-<p>Test case for <a href="" bug 120828</a>: Correctly set XHR loadend attributes (loaded and total).</p>
-<p>Upload case: verify that abort and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.</p>
-<p id=console></p>
-<script type="text/_javascript_">
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var status = "PASS";
-var total = 1;
-var loaded = 1;
-var uploadedData = "d";
-
-function onProgressEvent(e)
-{
-    if (!e.lengthComputable)
-        fail("Event " + e.type + " lengthComputable is false");
-    if (e.total != total || e.loaded != loaded)
-        fail("Event " + e.type + " total/loaded values not matching: " 
-            + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")");
-}
-
-function onUnexpectedProgressEvent(e)
-{
-    fail("unexpected ProgressEvent: " + e.type);
-}
-
-function fail(msg)
-{
-    status = "FAILED: " + msg;
-    completeTest();
-    status = "";
-}
-
-function completeTest()
-{
-    log(status);
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function test()
-{
-    var req = new XMLHttpRequest();
-    req.upload._onerror_ = onUnexpectedProgressEvent;
-    req.upload._onload_ = onUnexpectedProgressEvent;
-    req.upload._onabort_ = onProgressEvent;
-    req.upload._onprogress_ = function(e) {
-        onProgressEvent(e);
-        req.abort();
-    }
-    req.upload._onloadend_ = function(e) {
-        onProgressEvent(e);
-        completeTest();
-    }
-
-    req.open("POST", "resources/post-echo.cgi", true);
-    req.send(uploadedData);
-}
-
-
-function log(message)
-{
-    var consoleElt = document.getElementById("console");
-    consoleElt.innerHTML += message + "<br/>";
-}
-
-test(); 
-
-</script>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes-expected.txt	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,6 +0,0 @@
-Test case for bug 120828: Correctly set XHR loadend attributes (loaded and total).
-
-Upload case: verify that load and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.
-
-PASS
-

Deleted: trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html (161540 => 161541)


--- trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/upload-onload-progressevent-attributes.html	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,74 +0,0 @@
-<html>
-<head>
-<title>Test case for bug 120828</title>
-</head>
-<body>
-<p> Test case for <a href="" bug 120828</a>: Correctly set XHR loadend attributes (loaded and total).</p>
-<p> Upload case: verify that load and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.</p>
-<p id=console></p>
-<script type="text/_javascript_">
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var status = "PASS";
-var total = 1;
-var loaded = 1;
-var uploadedData = "d";
-
-function onProgressEvent(e)
-{
-    if (!e.lengthComputable)
-        fail("Event " + e.type + "event lengthComputable = false");
-    if (e.total != total || e.loaded != loaded)
-        fail("Event " + e.type + "total/loaded values not matching: "
-            + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")");
-}
-
-function onUnexpectedProgressEvent(e)
-{
-    fail("unexpected ProgressEvent: " + e.type);
-}
-
-function fail(msg)
-{
-    status = "FAILED: " + msg;
-    completeTest();
-    status = "";
-}
-
-function completeTest()
-{
-    log(status);
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function test()
-{
-    var req = new XMLHttpRequest();
-    req.upload._onabort_ = onUnexpectedProgressEvent;
-    req.upload._onerror_ = onUnexpectedProgressEvent;
-    req.upload._onprogress_ = onProgressEvent;
-    req.upload._onload_ = onProgressEvent;
-    req.upload._onloadend_ = function(e) {
-        onProgressEvent(e);
-        completeTest();
-    }
-
-    req.open("POST", "resources/post-echo.cgi", true);
-    req.send(uploadedData);
-}
-
-function log(message)
-{
-    var consoleElt = document.getElementById("console");
-    consoleElt.innerHTML += message + "<br/>";
-}
-
-test(); 
-
-</script>
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (161540 => 161541)


--- trunk/Source/WebCore/ChangeLog	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/ChangeLog	2014-01-09 03:56:47 UTC (rev 161541)
@@ -1,3 +1,36 @@
+2014-01-08  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r161532.
+        http://trac.webkit.org/changeset/161532
+        https://bugs.webkit.org/show_bug.cgi?id=126677
+
+        Caused lots of assertion failures (Requested by ap on
+        #webkit).
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+        (WebCore::XMLHttpRequest::createRequest):
+        (WebCore::XMLHttpRequest::abort):
+        (WebCore::XMLHttpRequest::networkError):
+        (WebCore::XMLHttpRequest::abortError):
+        (WebCore::XMLHttpRequest::didSendData):
+        (WebCore::XMLHttpRequest::didReceiveData):
+        (WebCore::XMLHttpRequest::didTimeout):
+        * xml/XMLHttpRequest.h:
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchProgressEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd):
+        (WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::fired):
+        (WebCore::XMLHttpRequestProgressEventThrottle::hasEventToDispatch):
+        (WebCore::XMLHttpRequestProgressEventThrottle::suspend):
+        * xml/XMLHttpRequestProgressEventThrottle.h:
+        * xml/XMLHttpRequestUpload.cpp:
+        (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
+        (WebCore::XMLHttpRequestUpload::dispatchEventAndLoadEnd):
+        * xml/XMLHttpRequestUpload.h:
+
 2014-01-08  Brian Burg  <[email protected]>
 
         Clean up confusing names and calculations in image-dragging functions

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2014-01-09 03:56:47 UTC (rev 161541)
@@ -430,14 +430,14 @@
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(scriptExecutionContext(), this);
 
     if (m_async || (m_state <= OPENED || m_state == DONE))
-        m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(eventNames().readystatechangeEvent, false, false), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
+        m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 
     InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie);
     if (m_state == DONE && !m_error) {
         InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), this);
-        m_progressEventThrottle.dispatchProgressEvent(eventNames().loadEvent);
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
         InspectorInstrumentation::didDispatchXHRLoadEvent(cookie);
-        m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
     }
 }
 
@@ -765,10 +765,10 @@
     // Also, only async requests support upload progress events.
     bool uploadEvents = false;
     if (m_async) {
-        m_progressEventThrottle.dispatchProgressEvent(eventNames().loadstartEvent);
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
         if (m_requestEntityBody && m_upload) {
             uploadEvents = m_upload->hasEventListeners();
-            m_upload->dispatchProgressEvent(eventNames().loadstartEvent);
+            m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
         }
     }
 
@@ -862,7 +862,12 @@
         m_state = UNSENT;
     }
 
-    dispatchErrorEvents(eventNames().abortEvent);
+    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
+    if (!m_uploadComplete) {
+        m_uploadComplete = true;
+        if (m_upload && m_uploadEventsAllowed)
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
+    }
 }
 
 void XMLHttpRequest::internalAbort()
@@ -923,14 +928,24 @@
 void XMLHttpRequest::networkError()
 {
     genericError();
-    dispatchErrorEvents(eventNames().errorEvent);
+    if (!m_uploadComplete) {
+        m_uploadComplete = true;
+        if (m_upload && m_uploadEventsAllowed)
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
+    }
+    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().errorEvent));
     internalAbort();
 }
 
 void XMLHttpRequest::abortError()
 {
     genericError();
-    dispatchErrorEvents(eventNames().abortEvent);
+    if (!m_uploadComplete) {
+        m_uploadComplete = true;
+        if (m_upload && m_uploadEventsAllowed)
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
+    }
+    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
 }
 
 void XMLHttpRequest::dropProtection()
@@ -1164,13 +1179,12 @@
         return;
 
     if (m_uploadEventsAllowed)
-        m_upload->dispatchThrottledProgressEvent(true, bytesSent, totalBytesToBeSent);
+        m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, bytesSent, totalBytesToBeSent));
+
     if (bytesSent == totalBytesToBeSent && !m_uploadComplete) {
         m_uploadComplete = true;
-        if (m_uploadEventsAllowed) {
-            m_upload->dispatchProgressEvent(eventNames().loadEvent);
-            m_upload->dispatchProgressEvent(eventNames().loadendEvent);
-        }
+        if (m_uploadEventsAllowed)
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
     }
 }
 
@@ -1228,13 +1242,13 @@
     }
 
     if (!m_error) {
+        long long expectedLength = m_response.expectedContentLength();
         m_receivedLength += len;
 
         if (m_async) {
-            long long expectedLength = m_response.expectedContentLength();
             bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength;
             unsigned long long total = lengthComputable ? expectedLength : 0;
-            m_progressEventThrottle.dispatchThrottledProgressEvent(lengthComputable, m_receivedLength, total);
+            m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total);
         }
 
         if (m_state != LOADING)
@@ -1245,19 +1259,6 @@
     }
 }
 
-void XMLHttpRequest::dispatchErrorEvents(const AtomicString& type)
-{
-    if (!m_uploadComplete) {
-        m_uploadComplete = true;
-        if (m_upload && m_uploadEventsAllowed) {
-            m_upload->dispatchProgressEvent(type);
-            m_upload->dispatchProgressEvent(eventNames().loadendEvent);
-        }
-    }
-    m_progressEventThrottle.dispatchProgressEvent(type);
-    m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);
-}
-
 #if ENABLE(XHR_TIMEOUT)
 void XMLHttpRequest::didTimeout()
 {
@@ -1279,7 +1280,12 @@
 
     changeState(DONE);
 
-    dispatchErrorEvents(eventNames().timeoutEvent);
+    if (!m_uploadComplete) {
+        m_uploadComplete = true;
+        if (m_upload && m_uploadEventsAllowed)
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().timeoutEvent));
+    }
+    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().timeoutEvent));
 }
 #endif
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2014-01-09 03:56:47 UTC (rev 161541)
@@ -208,8 +208,6 @@
 
     bool shouldDecodeResponse() const { return m_responseTypeCode < FirstBinaryResponseType; }
 
-    void dispatchErrorEvents(const AtomicString&);
-
     std::unique_ptr<XMLHttpRequestUpload> m_upload;
 
     URL m_url;

Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2014-01-09 03:56:47 UTC (rev 161541)
@@ -36,8 +36,6 @@
 
 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target)
     : m_target(target)
-    , m_hasThrottledProgressEvent(false)
-    , m_lengthComputable(false)
     , m_loaded(0)
     , m_total(0)
     , m_deferEvents(false)
@@ -50,12 +48,8 @@
 {
 }
 
-void XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
+void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
 {
-    m_lengthComputable = lengthComputable;
-    m_loaded = loaded;
-    m_total = total;
-    
     if (m_deferEvents) {
         // Only store the latest progress event while suspended.
         m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total);
@@ -72,12 +66,13 @@
 
         dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
         startRepeating(minimumProgressEventDispatchingIntervalInSeconds);
-        m_hasThrottledProgressEvent = false;
         return;
     }
 
     // The timer is already active so minimumProgressEventDispatchingIntervalInSeconds is the least frequent event.
-    m_hasThrottledProgressEvent = true;
+    m_lengthComputable = lengthComputable;
+    m_loaded = loaded;
+    m_total = total;
 }
 
 void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
@@ -101,17 +96,12 @@
         m_target->dispatchEvent(event);
 }
 
-void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(const AtomicString &type)
+void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
 {
-    ASSERT(type == eventNames().loadEvent || type == eventNames().loadstartEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent);
+    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
 
-    if (type == eventNames().loadstartEvent) {
-        m_lengthComputable = false;
-        m_loaded = 0;
-        m_total = 0;
-    }
-
-    dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total));
+    dispatchEvent(event);
+    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
 }
 
 void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
@@ -125,8 +115,10 @@
 
     if (!hasEventToDispatch())
         return;
+
     PassRefPtr<Event> event = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total);
-    m_hasThrottledProgressEvent = false;
+    m_loaded = 0;
+    m_total = 0;
 
     // We stop the timer as this is called when no more events are supposed to occur.
     stop();
@@ -168,12 +160,13 @@
     }
 
     dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
-    m_hasThrottledProgressEvent = false;
+    m_total = 0;
+    m_loaded = 0;
 }
 
 bool XMLHttpRequestProgressEventThrottle::hasEventToDispatch() const
 {
-    return m_hasThrottledProgressEvent && isActive();
+    return (m_total || m_loaded) && isActive();
 }
 
 void XMLHttpRequestProgressEventThrottle::suspend()
@@ -194,7 +187,8 @@
     // just defer it.
     if (hasEventToDispatch()) {
         m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total);
-        m_hasThrottledProgressEvent = false;
+        m_total = 0;
+        m_loaded = 0;
     }
     stop();
 }

Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h	2014-01-09 03:56:47 UTC (rev 161541)
@@ -30,7 +30,6 @@
 #include "Timer.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/Vector.h"
-#include <wtf/Forward.h>
 
 namespace WebCore {
 
@@ -49,10 +48,10 @@
     explicit XMLHttpRequestProgressEventThrottle(EventTarget*);
     virtual ~XMLHttpRequestProgressEventThrottle();
 
-    void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
+    void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
     void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
     void dispatchEvent(PassRefPtr<Event>);
-    void dispatchProgressEvent(const AtomicString&);
+    void dispatchEventAndLoadEnd(PassRefPtr<Event>);
 
     void suspend();
     void resume();
@@ -69,7 +68,6 @@
     // Weak pointer to our XMLHttpRequest object as it is the one holding us.
     EventTarget* m_target;
 
-    bool m_hasThrottledProgressEvent;
     bool m_lengthComputable;
     unsigned long long m_loaded;
     unsigned long long m_total;

Modified: trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp	2014-01-09 03:56:47 UTC (rev 161541)
@@ -36,33 +36,17 @@
 
 XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest)
     : m_xmlHttpRequest(xmlHttpRequest)
-    , m_lengthComputable(false)
-    , m_loaded(0)
-    , m_total(0)
 {
 }
 
-void XMLHttpRequestUpload::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
+void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
 {
-    m_lengthComputable = lengthComputable;
-    m_loaded = loaded;
-    m_total = total;
+    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
 
-    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
+    dispatchEvent(event);
+    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
 }
 
-void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString &type)
-{
-    ASSERT(type == eventNames().loadEvent || type == eventNames().loadstartEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent);
 
-    if (type == eventNames().loadstartEvent) {
-        m_lengthComputable = false;
-        m_loaded = 0;
-        m_total = 0;
-    }
 
-    dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total));
-}
-
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/xml/XMLHttpRequestUpload.h (161540 => 161541)


--- trunk/Source/WebCore/xml/XMLHttpRequestUpload.h	2014-01-09 03:49:38 UTC (rev 161540)
+++ trunk/Source/WebCore/xml/XMLHttpRequestUpload.h	2014-01-09 03:56:47 UTC (rev 161541)
@@ -55,17 +55,13 @@
         DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
         DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
 
-        void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
-        void dispatchProgressEvent(const AtomicString &type);
+        void dispatchEventAndLoadEnd(PassRefPtr<Event>);
 
     private:
         virtual void refEventTarget() OVERRIDE FINAL { ref(); }
         virtual void derefEventTarget() OVERRIDE FINAL { deref(); }
 
         XMLHttpRequest* m_xmlHttpRequest;
-        bool m_lengthComputable;
-        unsigned long long m_loaded;
-        unsigned long long m_total;
     };
     
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to