Changeset 63680 in webkit
- Timestamp:
- Jul 19, 2010 11:46:08 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r63679 r63680 1 2010-07-19 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Darin Adler. 4 5 https://bugs.webkit.org/show_bug.cgi?id=40996 6 Progress event should not be fired during synchronous XMLHttpRequest 7 8 https://bugs.webkit.org/show_bug.cgi?id=17502 9 Assertion failure when trying to restart a sync XMLHttpRequest as an async one from onreadystatechange 10 11 * fast/xmlhttprequest/xmlhttprequest-recursive-sync-event-expected.txt: There is one less 12 event dispatched now. 13 14 * http/tests/xmlhttprequest/infoOnProgressEvent-expected.txt: 15 * http/tests/xmlhttprequest/infoOnProgressEvent.html: 16 * http/tests/xmlhttprequest/xmlhttprequest-no-content-length-onProgress.html: 17 Changed to use async requests, since sync ones no longer cause progress event dispatch. 18 19 * http/tests/xmlhttprequest/resources/access-control-basic-post-fail-non-simple.cgi: Added. 20 A script that only allows simple cross-origin requests. 21 22 * http/tests/xmlhttprequest/xmlhttprequest-addEventListener-onProgress-expected.txt: 23 * http/tests/xmlhttprequest/xmlhttprequest-addEventListener-onProgress.html: 24 Removed synchronous case (incorrectly called asynchronous in test comments). 25 26 * http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events-expected.txt: Added. 27 * http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events.html: Added. 28 Added a test that logs progress and readystatechange events. 29 30 * http/tests/xmlhttprequest/xmlhttprequest-sync-vs-async-assertion-failure-expected.txt: Added. 31 * http/tests/xmlhttprequest/xmlhttprequest-sync-vs-async-assertion-failure.html: Added. 32 Aded a test for assertion failure. The problem no longer occurs since we don't fire events 33 in intermediate states. 34 1 35 2010-07-19 Csaba Osztrogonác <ossy@webkit.org> 2 36 -
trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-recursive-sync-event-expected.txt
r60392 r63680 1 CONSOLE MESSAGE: line 0:2 1 CONSOLE MESSAGE: line 0: 3 2 CONSOLE MESSAGE: line 0: -
trunk/LayoutTests/http/tests/xmlhttprequest/infoOnProgressEvent-expected.txt
r48701 r63680 1 1 Test case for bug 13596: Implement .onprogress handler on XMLHttpRequest objects to support progressive download content length information 2 2 3 You should see type, bubble, cancelable, eventPhase, target and current target for synchronous and asynchronous cases3 You should see type, bubble, cancelable, eventPhase, target and current target. 4 4 5 Synchronous case:6 5 Type: progress 7 6 Bubble: false … … 11 10 Current target: [object XMLHttpRequest] 12 11 13 Asynchronous case:14 Type: progress15 Bubble: false16 Cancelable: true17 EventPhase: 218 Target: [object XMLHttpRequest]19 Current target: [object XMLHttpRequest]20 -
trunk/LayoutTests/http/tests/xmlhttprequest/infoOnProgressEvent.html
r32318 r63680 3 3 <body> 4 4 <p> Test case for bug 13596: Implement .onprogress handler on XMLHttpRequest objects to support progressive download content length information </p> 5 <p> You should see type, bubble, cancelable, eventPhase, target and current target for synchronous and asynchronous cases</p>5 <p> You should see type, bubble, cancelable, eventPhase, target and current target.</p> 6 6 <script type="text/javascript"> 7 7 function log (msg) … … 24 24 log("Current target: " + e.currentTarget); 25 25 e.currentTarget.onprogress = null; 26 if ( shouldNotify &&window.layoutTestController)26 if (window.layoutTestController) 27 27 layoutTestController.notifyDone(); 28 28 } … … 39 39 } 40 40 41 log("Synchronous case:");42 43 // Test synchronous44 41 var req = new XMLHttpRequest(); 45 42 req.onprogress = onProgress; 46 req.open("GET", "resources/1251.html", false);43 req.open("GET", "resources/1251.html", true); 47 44 req.send(null); 48 49 insertNewLine();50 log("Asynchronous case:");51 52 // Test asynchronous53 var req2 = new XMLHttpRequest();54 req2.onprogress = onProgress;55 req2.open("GET", "resources/1251.html", true);56 shouldNotify = true;57 req2.send(null);58 45 </script> 59 46 </body> -
trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-addEventListener-onProgress-expected.txt
r34320 r63680 3 3 This test verify that addEventListener("progress", XXX, XXX) works as expected. 4 4 5 You should see PASSED 4times.5 You should see PASSED 2 times. 6 6 7 7 PASSED (1) 8 8 PASSED (2) 9 PASSED (3)10 PASSED (4)11 9 -
trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-addEventListener-onProgress.html
r34320 r63680 6 6 <p> Test case for Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=18655">18655</a>: [XHR] OnProgress needs more test case </p> 7 7 <p> This test verify that addEventListener("progress", XXX, XXX) works as expected. </p> 8 <p> You should see PASSED 4times. </p>8 <p> You should see PASSED 2 times. </p> 9 9 <script type="text/javascript"> 10 10 var count = 1; … … 18 18 function onProgress(e) { 19 19 log("PASSED (" + count + ")"); 20 if (++count > 4&& window.layoutTestController)20 if (++count > 2 && window.layoutTestController) 21 21 layoutTestController.notifyDone(); 22 22 } … … 26 26 layoutTestController.dumpAsText(); 27 27 } 28 29 // Asynchronous case30 31 // Test for capture phase32 var req = new XMLHttpRequest();33 req.addEventListener("progress", onProgress, true);34 req.open("GET", "resources/1251.html", false);35 req.send(null);36 37 // Test for bubble phase38 var req2 = new XMLHttpRequest();39 req2.addEventListener("progress", onProgress, false);40 req2.open("GET", "resources/1251.html", false);41 req2.send(null);42 43 // Synchronous case44 28 45 29 // Test for capture phase -
trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-no-content-length-onProgress.html
r34320 r63680 11 11 <p id="shouldNotBeCalled"> PASSED </p> 12 12 <script type="text/javascript"> 13 if (window.layoutTestController) { 14 layoutTestController.dumpAsText(); 15 layoutTestController.waitUntilDone(); 16 } 17 18 var count = 0; 19 function checkDone() { 20 if (++count == 2 && window.layoutTestController) 21 layoutTestController.notifyDone(); 22 } 23 13 24 function onProgressPassed(e) { 14 25 document.getElementById("shouldBeCalled").innerHTML = "PASSED"; … … 19 30 } 20 31 21 if (window.layoutTestController) {22 layoutTestController.dumpAsText();23 layoutTestController.waitUntilDone();24 }25 26 32 var req = new XMLHttpRequest(); 27 33 req.onprogress = onProgressPassed; 34 req.onload = checkDone; 28 35 // Test that onProgress is called on a normal file 29 req.open("GET", "resource/1251.html", false);36 req.open("GET", "resource/1251.html", true); 30 37 req.send(null); 31 38 32 39 // If content length is not given, it should not be called 33 req.onprogress = onProgressFailed; 34 req.open("GET", "resources/noContentLength.asis", false); 35 req.send(null); 36 37 if (window.layoutTestController) 38 layoutTestController.notifyDone(); 40 var req2 = new XMLHttpRequest(); 41 req2.onprogress = onProgressFailed; 42 req2.onload = checkDone; 43 req2.open("GET", "resources/noContentLength.asis", true); 44 req2.send(null); 39 45 40 46 </script> -
trunk/WebCore/ChangeLog
r63672 r63680 1 2010-07-19 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Darin Adler. 4 5 https://bugs.webkit.org/show_bug.cgi?id=40996 6 Progress event should not be fired during synchronous XMLHttpRequest 7 8 https://bugs.webkit.org/show_bug.cgi?id=17502 9 Assertion failure when trying to restart a sync XMLHttpRequest as an async one from onreadystatechange 10 11 Tests: http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events.html 12 http/tests/xmlhttprequest/xmlhttprequest-sync-vs-async-assertion-failure.html 13 14 * xml/XMLHttpRequest.cpp: 15 (WebCore::XMLHttpRequest::callReadyStateChangeListener): We now only dispatch readystatechange 16 event for synchronous requests in states UNSENT, OPENED and DONE. I'm not sure what exactly 17 the spec draft says about readystatechange for sync requests, but this seems to be the most 18 logical and backwards compatible behavior. 19 (WebCore::XMLHttpRequest::didReceiveData): Don't dispatch progress events for sync requests. 20 Note that we already don't dispatch upload progress events for those. 21 1 22 2010-07-19 Dan Bernstein <mitz@apple.com> 2 23 -
trunk/WebCore/xml/XMLHttpRequest.cpp
r62828 r63680 284 284 #endif 285 285 286 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent); 286 if (m_async || (m_state <= OPENED || m_state == DONE)) 287 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent); 287 288 288 289 #if ENABLE(INSPECTOR) … … 979 980 m_receivedLength += len; 980 981 981 bool lengthComputable = expectedLength && m_receivedLength <= expectedLength; 982 m_progressEventThrottle.dispatchProgressEvent(lengthComputable, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); 982 if (m_async) { 983 bool lengthComputable = expectedLength && m_receivedLength <= expectedLength; 984 m_progressEventThrottle.dispatchProgressEvent(lengthComputable, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); 985 } 983 986 984 987 if (m_state != LOADING)
Note: See TracChangeset
for help on using the changeset viewer.