Diff
Modified: trunk/Source/WebCore/ChangeLog (111808 => 111809)
--- trunk/Source/WebCore/ChangeLog 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/ChangeLog 2012-03-23 02:19:50 UTC (rev 111809)
@@ -1,3 +1,34 @@
+2012-03-22 Jason Liu <jason....@torchmobile.com.cn>
+
+ [BlackBerry] Synchronize platform/network/blackberry
+ https://bugs.webkit.org/show_bug.cgi?id=81874
+
+ We changed a lot in these files locally. But the changes are not upstreamed.
+ It is not convenient to do the other upstreaming work based on these differences.
+ So upstream these changes.
+
+ Reviewed by Rob Buis.
+
+ No new tests. Just synchronize codes.
+
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::NetworkJob):
+ (WebCore::NetworkJob::initialize):
+ (WebCore::NetworkJob::handleNotifyHeaderReceived):
+ (WebCore::NetworkJob::handleNotifyDataReceived):
+ (WebCore::NetworkJob::sendResponseIfNeeded):
+ (WebCore::NetworkJob::sendRequestWithCredentials):
+ (WebCore::NetworkJob::handleAbout):
+ * platform/network/blackberry/NetworkJob.h:
+ (WebCore::NetworkJob::isError):
+ (NetworkJob):
+ * platform/network/blackberry/NetworkManager.cpp:
+ (WebCore::NetworkManager::startJob):
+ * platform/network/blackberry/ResourceRequest.h:
+ (WebCore::ResourceRequest::ResourceRequest):
+ * platform/network/blackberry/ResourceRequestBlackBerry.cpp:
+ (WebCore::platformTargetTypeForRequest):
+
2012-03-22 Tom Sepez <tse...@chromium.org>
XSS Auditor bypass via script tag src="" URLS.
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (111808 => 111809)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-03-23 02:19:50 UTC (rev 111809)
@@ -109,7 +109,6 @@
, m_dataReceived(false)
, m_responseSent(false)
, m_callingClient(false)
- , m_isXHR(false)
, m_needsRetryAsFTPDirectory(false)
, m_isOverrideContentType(false)
, m_extendedStatusCode(0)
@@ -170,8 +169,6 @@
return false;
setWrappedStream(wrappedStream);
- m_isXHR = request.getTargetType() == BlackBerry::Platform::NetworkRequest::TargetIsXMLHTTPRequest;
-
return true;
}
@@ -310,7 +307,11 @@
m_contentDisposition = value;
if (lowerKey == "set-cookie") {
- if (m_frame && m_frame->loader() && m_frame->loader()->client()
+ // FIXME: If a tab is closed, sometimes network data will come in after the frame has been detached from its page but before it is deleted.
+ // If this happens, m_frame->page() will return 0, and m_frame->loader()->client() will be in a bad state and calling into it will crash.
+ // For now we check for this explicitly by checking m_frame->page(). But we should find out why the network job hasn't been cancelled when the frame was detached.
+ // See RIM PR 134207
+ if (m_frame && m_frame->page() && m_frame->loader() && m_frame->loader()->client()
&& static_cast<FrameLoaderClientBlackBerry*>(m_frame->loader()->client())->cookiesEnabled())
handleSetCookieHeader(value);
}
@@ -401,7 +402,7 @@
// is on a file system if it has a MIME mappable file extension.
// The file extension is likely to be correct.
if (m_isFile) {
- String urlFilename = m_response.url().lastPathComponent();
+ WTF::String urlFilename = m_response.url().lastPathComponent();
size_t pos = urlFilename.reverseFind('.');
if (pos != WTF::notFound) {
String extension = urlFilename.substring(pos + 1);
@@ -659,8 +660,8 @@
m_response.setSuggestedFilename(suggestedFilename);
}
- // Make sure local files aren't cached, since this just duplicates them.
- if (m_isFile || m_isData || m_isAbout)
+ // Don't cache resources for "about:"
+ if (m_isAbout)
m_response.setHTTPHeaderField("Cache-Control", "no-cache");
if (isClientAvailable()) {
@@ -941,7 +942,7 @@
String result;
bool handled = false;
- if (aboutWhat.isEmpty() || equalIgnoringCase(aboutWhat, "blank")) {
+ if (equalIgnoringCase(aboutWhat, "blank")) {
handled = true;
} else if (equalIgnoringCase(aboutWhat, "credits")) {
result.append(String("<html><head><title>Open Source Credits</title> <style> .about {padding:14px;} </style> <meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>"));
@@ -1012,10 +1013,9 @@
handled = true;
#endif
}
-
if (handled) {
CString resultString = result.utf8();
- notifyStatusReceived(404, 0);
+ notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusSuccess, 0);
notifyStringHeaderReceived("Content-Length", String::number(resultString.length()));
notifyStringHeaderReceived("Content-Type", "text/html");
notifyDataReceivedPlain(resultString.data(), resultString.length());
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h (111808 => 111809)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-03-23 02:19:50 UTC (rev 111809)
@@ -145,7 +145,7 @@
bool isError(int statusCode)
{
- return statusCode < 0 || (!m_isXHR && (400 <= statusCode && statusCode < 600));
+ return statusCode < 0 || (400 <= statusCode && statusCode < 600);
}
private:
@@ -174,7 +174,6 @@
bool m_dataReceived;
bool m_responseSent;
bool m_callingClient;
- bool m_isXHR; // FIXME - After 7.0, remove this. Only the Qt port reports HTTP error statuses as didFails, so we probably shouldn't.
bool m_needsRetryAsFTPDirectory;
bool m_isOverrideContentType;
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp (111808 => 111809)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp 2012-03-23 02:19:50 UTC (rev 111809)
@@ -28,6 +28,10 @@
#include "ResourceHandleInternal.h"
#include "ResourceRequest.h"
+#include <BlackBerryPlatformClient.h>
+#include <BlackBerryPlatformLog.h>
+#include <BuildInformation.h>
+#include <network/FilterStream.h>
#include <network/NetworkRequest.h>
namespace WebCore {
@@ -108,7 +112,7 @@
if (authType != BlackBerry::Platform::NetworkRequest::AuthNone)
platformRequest.setCredentials(username.utf8().data(), password.utf8().data(), authType);
- } else if (url.protocolIsInHTTPFamily()) {
+ } else if (url.protocolInHTTPFamily()) {
// For URLs that match the paths of those previously challenged for HTTP Basic authentication,
// try and reuse the credential preemptively, as allowed by RFC 2617.
Credential credential = CredentialStorage::get(url);
Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h (111808 => 111809)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h 2012-03-23 02:19:50 UTC (rev 111809)
@@ -57,6 +57,7 @@
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
@@ -66,6 +67,7 @@
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
@@ -75,6 +77,7 @@
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
setHTTPReferrer(referrer);
}
@@ -85,6 +88,7 @@
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
@@ -118,8 +122,6 @@
TargetType targetType() const { return m_targetType; }
void setTargetType(TargetType type) { m_targetType = type; }
- static TargetType targetTypeFromMimeType(const String& mimeType);
-
private:
friend class ResourceRequestBase;
Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp (111808 => 111809)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp 2012-03-23 02:13:24 UTC (rev 111808)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp 2012-03-23 02:19:50 UTC (rev 111809)
@@ -23,7 +23,6 @@
#include "CookieManager.h"
#include <BlackBerryPlatformClient.h>
#include <network/NetworkRequest.h>
-#include <wtf/HashMap.h>
#include <wtf/text/CString.h>
using BlackBerry::Platform::NetworkRequest;
@@ -80,53 +79,28 @@
return NetworkRequest::TargetIsWorker;
case ResourceRequest::TargetIsSharedWorker:
return NetworkRequest::TargetIsSharedWorker;
+
+ // FIXME: this need to be updated to the right value, but
+ // we need to coordinate with AIR api change.
+ case ResourceRequest::TargetIsFavicon:
+ return NetworkRequest::TargetIsImage;
+ case ResourceRequest::TargetIsPrefetch:
+ return NetworkRequest::TargetIsSubresource;
+ case ResourceRequest::TargetIsPrerender:
+ return NetworkRequest::TargetIsSubresource;
+ case ResourceRequest::TargetIsXHR:
+ return NetworkRequest::TargetIsSubresource;
+ case ResourceRequest::TargetIsTextTrack:
+ return NetworkRequest::TargetIsSubresource;
+ case ResourceRequest::TargetIsUnspecified:
+ return NetworkRequest::TargetIsSubresource;
+
default:
ASSERT_NOT_REACHED();
return NetworkRequest::TargetIsUnknown;
}
}
-typedef HashMap<String, ResourceRequest::TargetType> MimeTypeResourceRequestTypeMap;
-
-static const MimeTypeResourceRequestTypeMap& mimeTypeRequestTypeMap()
-{
- static MimeTypeResourceRequestTypeMap* map = 0;
- if (!map) {
- map = new MimeTypeResourceRequestTypeMap;
-
- if (map) {
- // The list here should match extensionMap[] in MIMETypeRegistryBlackBerry.cpp
- map->add(String("text/css"), ResourceRequest::TargetIsStyleSheet);
- map->add(String("application/x-_javascript_"), ResourceRequest::TargetIsScript);
- map->add(String("image/bmp"), ResourceRequest::TargetIsImage);
- map->add(String("image/gif"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-icon"), ResourceRequest::TargetIsImage);
- map->add(String("image/jpeg"), ResourceRequest::TargetIsImage);
- map->add(String("image/png"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-portable-bitmap"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-portable-graymap"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-portable-pixmap"), ResourceRequest::TargetIsImage);
- map->add(String("image/svg+xml"), ResourceRequest::TargetIsImage);
- map->add(String("image/tiff"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-xbitmap"), ResourceRequest::TargetIsImage);
- map->add(String("image/x-xpm"), ResourceRequest::TargetIsImage);
- }
- }
-
- return *map;
-}
-
-ResourceRequest::TargetType ResourceRequest::targetTypeFromMimeType(const String& mimeType)
-{
- const MimeTypeResourceRequestTypeMap& map = mimeTypeRequestTypeMap();
-
- MimeTypeResourceRequestTypeMap::const_iterator iter = map.find(mimeType);
- if (iter == map.end())
- return ResourceRequest::TargetIsUnspecified;
-
- return iter->second;
-}
-
void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest, bool cookiesEnabled, bool isInitial, bool isRedirect) const
{
// If this is the initial load, skip the request body and headers.