Title: [134364] trunk
- Revision
- 134364
- Author
- [email protected]
- Date
- 2012-11-12 22:28:49 -0800 (Mon, 12 Nov 2012)
Log Message
[BlackBerry] NetworkJob should not check if data is received with HEAD
https://bugs.webkit.org/show_bug.cgi?id=102034
Patch by Joe Mason <[email protected]> on 2012-11-12
Reviewed by George Staikos.
Internal PR: 241391
.:
Add test that HEAD XMLHttpRequests return status 404 instead of calling onerror.
* ManualTests/blackberry/head-xhr-nonexistant-file.html: Added.
Source/WebCore:
Make HEAD requests call didFinish instead of didFail on a 404 response, even though they
have no data.
Tests: ManualTests/blackberry/head-xhr-nonexistant-file.html
* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::NetworkJob):
(WebCore::NetworkJob::initialize):
(WebCore::NetworkJob::shouldNotifyClientFailed):
* platform/network/blackberry/NetworkJob.h:
(NetworkJob):
Modified Paths
Added Paths
Diff
Modified: trunk/ChangeLog (134363 => 134364)
--- trunk/ChangeLog 2012-11-13 06:12:55 UTC (rev 134363)
+++ trunk/ChangeLog 2012-11-13 06:28:49 UTC (rev 134364)
@@ -1,3 +1,16 @@
+2012-11-12 Joe Mason <[email protected]>
+
+ [BlackBerry] NetworkJob should not check if data is received with HEAD
+ https://bugs.webkit.org/show_bug.cgi?id=102034
+
+ Reviewed by George Staikos.
+
+ Internal PR: 241391
+
+ Add test that HEAD XMLHttpRequests return status 404 instead of calling onerror.
+
+ * ManualTests/blackberry/head-xhr-nonexistant-file.html: Added.
+
2012-11-12 KyungTae Kim <[email protected]>
[EFL] Turn on error on warnings for "switch"
Added: trunk/ManualTests/blackberry/head-xhr-nonexistant-file.html (0 => 134364)
--- trunk/ManualTests/blackberry/head-xhr-nonexistant-file.html (rev 0)
+++ trunk/ManualTests/blackberry/head-xhr-nonexistant-file.html 2012-11-13 06:28:49 UTC (rev 134364)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<script>
+var xhr = new XMLHttpRequest();
+xhr.open("HEAD", "nothing.txt", true);
+xhr._onreadystatechange_ = function() {
+ if (xhr.readyState != 4) {
+ return;
+ }
+ if (xhr.status == 404) {
+ alert("PASSED: onreadystatechange fired with status 404");
+ } else {
+ alert("FAILED: onreadystatechange fired with status " + xhr.status);
+ }
+
+}
+xhr._onerror_ = function() {
+ alert("FAILED: onerror fired");
+}
+xhr.send();
+</script>
+</head>
+<body>
+<p>This test must be hosted on a web server, not run from a file url, because XMLHttpRequest from file url causes a security error.</p>
+<p>You should see an alert box saying whether the test was passed or failed. If there is no alert box, the test was FAILED.</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (134363 => 134364)
--- trunk/Source/WebCore/ChangeLog 2012-11-13 06:12:55 UTC (rev 134363)
+++ trunk/Source/WebCore/ChangeLog 2012-11-13 06:28:49 UTC (rev 134364)
@@ -1,3 +1,24 @@
+2012-11-12 Joe Mason <[email protected]>
+
+ [BlackBerry] NetworkJob should not check if data is received with HEAD
+ https://bugs.webkit.org/show_bug.cgi?id=102034
+
+ Reviewed by George Staikos.
+
+ Internal PR: 241391
+
+ Make HEAD requests call didFinish instead of didFail on a 404 response, even though they
+ have no data.
+
+ Tests: ManualTests/blackberry/head-xhr-nonexistant-file.html
+
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::NetworkJob):
+ (WebCore::NetworkJob::initialize):
+ (WebCore::NetworkJob::shouldNotifyClientFailed):
+ * platform/network/blackberry/NetworkJob.h:
+ (NetworkJob):
+
2012-11-12 Adam Barth <[email protected]>
[V8] V8DOMWrapper::instantiateV8Object shouldn't use deprecatedDocument
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (134363 => 134364)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-11-13 06:12:55 UTC (rev 134363)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-11-13 06:28:49 UTC (rev 134364)
@@ -81,6 +81,7 @@
, m_needsRetryAsFTPDirectory(false)
, m_isOverrideContentType(false)
, m_newJobWithCredentialsStarted(false)
+ , m_isHeadMethod(false)
, m_extendedStatusCode(0)
, m_redirectCount(0)
, m_deferredData(*this)
@@ -106,6 +107,8 @@
int deferLoadingCount,
int redirectCount)
{
+ BLACKBERRY_ASSERT(handle);
+
m_playerId = playerId;
m_pageGroupName = pageGroupName;
@@ -128,6 +131,8 @@
m_redirectCount = redirectCount;
m_deferLoadingCount = deferLoadingCount;
+ m_isHeadMethod = m_handle->firstRequest().httpMethod().upper() == "HEAD";
+
// We don't need to explicitly call notifyHeaderReceived, as the Content-Type
// will ultimately get parsed when sendResponseIfNeeded gets called.
if (!request.getOverrideContentType().empty()) {
@@ -539,7 +544,7 @@
bool NetworkJob::shouldNotifyClientFailed() const
{
- return m_extendedStatusCode < 0 || (isError(m_extendedStatusCode) && !m_dataReceived);
+ return m_extendedStatusCode < 0 || (isError(m_extendedStatusCode) && !m_dataReceived && !m_isHeadMethod);
}
bool NetworkJob::retryAsFTPDirectory()
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h (134363 => 134364)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-11-13 06:12:55 UTC (rev 134363)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-11-13 06:28:49 UTC (rev 134364)
@@ -164,6 +164,7 @@
bool m_needsRetryAsFTPDirectory;
bool m_isOverrideContentType;
bool m_newJobWithCredentialsStarted;
+ bool m_isHeadMethod;
// If an HTTP status code is received, m_extendedStatusCode and m_response.httpStatusCode will both be set to it.
// If a platform error code is received, m_extendedStatusCode will be set to it and m_response.httpStatusCode will be set to 404.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes