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.
Patch by Jason Liu <jason.liu@torchmobile.com.cn> on 2012-03-22
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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111809
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-22 Jason Liu <jason.liu@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 <tsepez@chromium.org>
XSS Auditor bypass via script tag src=data:, URLS.
, m_dataReceived(false)
, m_responseSent(false)
, m_callingClient(false)
- , m_isXHR(false)
, m_needsRetryAsFTPDirectory(false)
, m_isOverrideContentType(false)
, m_extendedStatusCode(0)
return false;
setWrappedStream(wrappedStream);
- m_isXHR = request.getTargetType() == BlackBerry::Platform::NetworkRequest::TargetIsXMLHTTPRequest;
-
return true;
}
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);
}
// 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);
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()) {
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>"));
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());
bool isError(int statusCode)
{
- return statusCode < 0 || (!m_isXHR && (400 <= statusCode && statusCode < 600));
+ return statusCode < 0 || (400 <= statusCode && statusCode < 600);
}
private:
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;
#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 {
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);
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
setHTTPReferrer(referrer);
}
, m_mustHandleInternally(false)
, m_isRequestedByPlugin(false)
, m_forceDownload(false)
+ , m_targetType(TargetIsUnspecified)
{
}
TargetType targetType() const { return m_targetType; }
void setTargetType(TargetType type) { m_targetType = type; }
- static TargetType targetTypeFromMimeType(const String& mimeType);
-
private:
friend class ResourceRequestBase;
#include "CookieManager.h"
#include <BlackBerryPlatformClient.h>
#include <network/NetworkRequest.h>
-#include <wtf/HashMap.h>
#include <wtf/text/CString.h>
using BlackBerry::Platform::NetworkRequest;
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.