Title: [114235] trunk
Revision
114235
Author
commit-qu...@webkit.org
Date
2012-04-16 02:04:39 -0700 (Mon, 16 Apr 2012)

Log Message

[BlackBerry] Missing readyState 2 when a XMLHttpRequest calls xmlhttp.open("HEAD","notExist.html",true).
https://bugs.webkit.org/show_bug.cgi?id=83866

Source/WebCore:

Patch by Jason Liu <jason....@torchmobile.com.cn> on 2012-04-16
Reviewed by George Staikos.

We receive 404 for a XMLHttpRequest which calls open("HEAD", "notExist.html", true).
There are no data received because its method is HEAD.
This case shouldn't be treated as a failure.

Test: http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html

* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::handleNotifyClose):

LayoutTests:

Patch by Jason Liu <jason....@torchmobile.com.cn> on 2012-04-16
Reviewed by George Staikos.

* http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404-expected.txt: Added.
* http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114234 => 114235)


--- trunk/LayoutTests/ChangeLog	2012-04-16 08:56:56 UTC (rev 114234)
+++ trunk/LayoutTests/ChangeLog	2012-04-16 09:04:39 UTC (rev 114235)
@@ -1,3 +1,13 @@
+2012-04-16  Jason Liu  <jason....@torchmobile.com.cn>
+
+        [BlackBerry] Missing readyState 2 when a XMLHttpRequest calls xmlhttp.open("HEAD","notExist.html",true).
+        https://bugs.webkit.org/show_bug.cgi?id=83866
+
+        Reviewed by George Staikos.
+
+        * http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404-expected.txt: Added.
+        * http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html: Added.
+
 2012-04-16  Kent Tamura  <tk...@chromium.org>
 
         [Chromium] Rebaseline for date-appearance.html.

Added: trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404-expected.txt (0 => 114235)


--- trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404-expected.txt	2012-04-16 09:04:39 UTC (rev 114235)
@@ -0,0 +1,3 @@
+This tests the readyState of a XMLHttpRequset which is sent with a "HEAD" method to a not exist resource.
+
+PASS

Added: trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html (0 => 114235)


--- trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html	2012-04-16 09:04:39 UTC (rev 114235)
@@ -0,0 +1,30 @@
+<html>
+<body>
+<p>This tests the readyState of a XMLHttpRequset which is sent with a "HEAD" method to a not exist resource.</p>
+<pre id="result">FAIL</pre>
+<script type="text/_javascript_">
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    var res = "";
+    var xmlhttp = new XMLHttpRequest();
+    xmlhttp._onreadystatechange_ = function() {
+        if (xmlhttp.readyState) {
+            res = res + xmlhttp.readyState;
+            if(res == "124"){
+                document.getElementById('result').innerText = "PASS";
+
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
+        }
+    }
+
+    xmlhttp.open("HEAD","notExist.html",true);
+    xmlhttp.send();
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (114234 => 114235)


--- trunk/Source/WebCore/ChangeLog	2012-04-16 08:56:56 UTC (rev 114234)
+++ trunk/Source/WebCore/ChangeLog	2012-04-16 09:04:39 UTC (rev 114235)
@@ -1,3 +1,19 @@
+2012-04-16  Jason Liu  <jason....@torchmobile.com.cn>
+
+        [BlackBerry] Missing readyState 2 when a XMLHttpRequest calls xmlhttp.open("HEAD","notExist.html",true).
+        https://bugs.webkit.org/show_bug.cgi?id=83866
+
+        Reviewed by George Staikos.
+        
+        We receive 404 for a XMLHttpRequest which calls open("HEAD", "notExist.html", true).
+        There are no data received because its method is HEAD.
+        This case shouldn't be treated as a failure.
+
+        Test: http/tests/xmlhttprequest/xmlhttprequest-check-head-readystate-for-404.html
+
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::handleNotifyClose):
+
 2012-04-16  Jon Lee  <jon...@apple.com>
 
         Build fix.

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (114234 => 114235)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-04-16 08:56:56 UTC (rev 114234)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-04-16 09:04:39 UTC (rev 114235)
@@ -487,7 +487,7 @@
             if (isClientAvailable()) {
 
                 RecursionGuard guard(m_callingClient);
-                if (isError(m_extendedStatusCode) && !m_dataReceived) {
+                if (isError(m_extendedStatusCode) && !m_dataReceived && m_handle->firstRequest().httpMethod() != "HEAD") {
                     String domain = m_extendedStatusCode < 0 ? ResourceError::platformErrorDomain : ResourceError::httpErrorDomain;
                     ResourceError error(domain, m_extendedStatusCode, m_response.url().string(), m_response.httpStatusText());
                     m_handle->client()->didFail(m_handle.get(), error);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to