https://bugs.webkit.org/show_bug.cgi?id=102034
Patch by Joe Mason <jmason@rim.com> 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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134364
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-11-12 Joe Mason <jmason@rim.com>
+
+ [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 <ktf.kim@samsung.com>
[EFL] Turn on error on warnings for "switch"
--- /dev/null
+<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>
+2012-11-12 Joe Mason <jmason@rim.com>
+
+ [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 <abarth@webkit.org>
[V8] V8DOMWrapper::instantiateV8Object shouldn't use deprecatedDocument
, m_needsRetryAsFTPDirectory(false)
, m_isOverrideContentType(false)
, m_newJobWithCredentialsStarted(false)
+ , m_isHeadMethod(false)
, m_extendedStatusCode(0)
, m_redirectCount(0)
, m_deferredData(*this)
int deferLoadingCount,
int redirectCount)
{
+ BLACKBERRY_ASSERT(handle);
+
m_playerId = playerId;
m_pageGroupName = pageGroupName;
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()) {
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()
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.