Changeset 117246 in webkit
- Timestamp:
- May 16, 2012 2:46:18 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117245 r117246 1 2012-05-16 Jason Liu <jason.liu@torchmobile.com.cn> 2 3 [BlackBerry] xhr request to non existent file response is 0 and not 404. 4 https://bugs.webkit.org/show_bug.cgi?id=86344 5 6 Reviewed by George Staikos. 7 8 * http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html: 9 1 10 2012-05-15 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 11 -
trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-get-readystate-for-404-without-body.html
r117245 r117246 1 1 <html> 2 <body> 3 <p>This tests the readyState of a XMLHttpRequset which is sent with a "HEAD" method to a not exist resource.</p> 4 <pre id="result">FAIL</pre> 2 <head> 5 3 <script type="text/javascript"> 4 function loadXMLDoc() { 6 5 7 6 if (window.layoutTestController) { … … 15 14 if (xmlhttp.readyState) { 16 15 res = res + xmlhttp.readyState; 17 if(res == "124" ){16 if(res == "124" && xmlhttp.status == 404) { 18 17 document.getElementById('result').innerText = "PASS"; 19 18 … … 24 23 } 25 24 26 xmlhttp.open(" HEAD","notExist.html",true);25 xmlhttp.open("GET", "resources/status-404-without-body.php", true); 27 26 xmlhttp.send(); 27 } 28 28 </script> 29 </head> 30 <body onload="loadXMLDoc()"> 31 <p>This tests the readyState of a XMLHttpRequset which is sended with a "GET" method. And the response's status is 404 without body.</p> 32 <p id="result">FAIL</p> 29 33 </body> 30 34 </html> -
trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html
r114235 r117246 15 15 if (xmlhttp.readyState) { 16 16 res = res + xmlhttp.readyState; 17 if(res == "124" ){17 if(res == "124" && xmlhttp.status == 404) { 18 18 document.getElementById('result').innerText = "PASS"; 19 19 -
trunk/Source/WebCore/ChangeLog
r117242 r117246 1 2012-05-16 Jason Liu <jason.liu@torchmobile.com.cn> 2 3 [BlackBerry] xhr request to non existent file response is 0 and not 404. 4 https://bugs.webkit.org/show_bug.cgi?id=86344 5 6 Reviewed by George Staikos. 7 8 NetworkJob receives 404 for a XMLHttpRequest which calls open("HEAD", "notExist.html", true). 9 There are no data received because its method is HEAD. 10 This case should not be treated as a failure. 11 12 Add shouldNotifyClientFailed() to treat XMLHttpRequest as a special case. 13 XMLHttpRequest will fail when status code is smaller than zero. 14 15 If we use "GET" and receive 404 without body, NetworkJob won't go through failing code path, too. 16 So add http/tests/xmlhttprequest/xmlhttprequest-check-get-readystate-for-404-without-body.html 17 to check this case. 18 19 Test: http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html 20 http/tests/xmlhttprequest/xmlhttprequest-check-get-readystate-for-404-without-body.html 21 * platform/network/blackberry/NetworkJob.cpp: 22 (WebCore::NetworkJob::sendResponseIfNeeded): 23 1 24 2012-05-16 MORITA Hajime <morrita@google.com> 2 25 -
trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
r116591 r117246 450 450 purgeCredentials(); 451 451 452 if (should NotifyClientFinished()) {452 if (shouldReleaseClientResource()) { 453 453 if (isRedirect(m_extendedStatusCode) && (m_redirectCount >= s_redirectMaximum)) 454 454 m_extendedStatusCode = BlackBerry::Platform::FilterStream::StatusTooManyRedirects; … … 458 458 459 459 RecursionGuard guard(m_callingClient); 460 if ( isError(m_extendedStatusCode) && !m_dataReceived && m_handle->firstRequest().httpMethod() != "HEAD") {460 if (shouldNotifyClientFailed()) { 461 461 String domain = m_extendedStatusCode < 0 ? ResourceError::platformErrorDomain : ResourceError::httpErrorDomain; 462 462 ResourceError error(domain, m_extendedStatusCode, m_response.url().string(), m_response.httpStatusText()); … … 477 477 } 478 478 479 bool NetworkJob::should NotifyClientFinished()479 bool NetworkJob::shouldReleaseClientResource() 480 480 { 481 481 if (m_redirectCount >= s_redirectMaximum) … … 489 489 490 490 return true; 491 } 492 493 bool NetworkJob::shouldNotifyClientFailed() const 494 { 495 if (m_handle->firstRequest().targetType() == ResourceRequest::TargetIsXHR) 496 return m_extendedStatusCode < 0; 497 return isError(m_extendedStatusCode) && !m_dataReceived; 491 498 } 492 499 … … 575 582 m_responseSent = true; 576 583 577 if ( isError(m_extendedStatusCode) && !m_dataReceived)584 if (shouldNotifyClientFailed()) 578 585 return; 579 586 -
trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h
r116591 r117246 96 96 bool shouldSendClientData() const; 97 97 98 bool shouldNotifyClientFinished(); 98 bool shouldReleaseClientResource(); 99 bool shouldNotifyClientFailed() const; 99 100 100 101 bool shouldDeferLoading() const … … 134 135 void purgeCredentials(); 135 136 136 bool isError(int statusCode) 137 bool isError(int statusCode) const 137 138 { 138 139 return statusCode < 0 || (400 <= statusCode && statusCode < 600);
Note: See TracChangeset
for help on using the changeset viewer.