summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/network
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/platform/network
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/platform/network')
-rw-r--r--WebCore/platform/network/ResourceErrorBase.cpp2
-rw-r--r--WebCore/platform/network/ResourceErrorBase.h2
-rw-r--r--WebCore/platform/network/ResourceLoadTiming.h86
-rw-r--r--WebCore/platform/network/ResourceRequestBase.h7
-rw-r--r--WebCore/platform/network/ResourceResponseBase.cpp30
-rw-r--r--WebCore/platform/network/ResourceResponseBase.h8
-rw-r--r--WebCore/platform/network/android/ResourceHandleAndroid.cpp6
-rw-r--r--WebCore/platform/network/cf/ResourceHandleCFNet.cpp6
-rw-r--r--WebCore/platform/network/curl/ResourceHandleCurl.cpp4
-rw-r--r--WebCore/platform/network/mac/ResourceHandleMac.mm3
-rw-r--r--WebCore/platform/network/qt/ResourceHandleQt.cpp6
-rw-r--r--WebCore/platform/network/soup/ResourceHandleSoup.cpp8
12 files changed, 118 insertions, 50 deletions
diff --git a/WebCore/platform/network/ResourceErrorBase.cpp b/WebCore/platform/network/ResourceErrorBase.cpp
index 97435ba..42bc0de 100644
--- a/WebCore/platform/network/ResourceErrorBase.cpp
+++ b/WebCore/platform/network/ResourceErrorBase.cpp
@@ -29,6 +29,8 @@
namespace WebCore {
+const char* const errorDomainWebKitInternal = "WebKitInternal";
+
ResourceError ResourceErrorBase::copy() const
{
lazyInit();
diff --git a/WebCore/platform/network/ResourceErrorBase.h b/WebCore/platform/network/ResourceErrorBase.h
index 237db9e..a6b7c69 100644
--- a/WebCore/platform/network/ResourceErrorBase.h
+++ b/WebCore/platform/network/ResourceErrorBase.h
@@ -32,6 +32,8 @@ namespace WebCore {
class ResourceError;
+extern const char* const errorDomainWebKitInternal; // Used for errors that won't be exposed to clients.
+
class ResourceErrorBase {
public:
// Makes a deep copy. Useful for when you need to use a ResourceError on another thread.
diff --git a/WebCore/platform/network/ResourceLoadTiming.h b/WebCore/platform/network/ResourceLoadTiming.h
index 55ff181..269fad0 100644
--- a/WebCore/platform/network/ResourceLoadTiming.h
+++ b/WebCore/platform/network/ResourceLoadTiming.h
@@ -34,7 +34,7 @@ namespace WebCore {
class ResourceLoadTiming : public RefCounted<ResourceLoadTiming> {
public:
- PassRefPtr<ResourceLoadTiming> create()
+ static PassRefPtr<ResourceLoadTiming> create()
{
return adoptRef(new ResourceLoadTiming);
}
@@ -42,33 +42,35 @@ public:
PassRefPtr<ResourceLoadTiming> deepCopy()
{
RefPtr<ResourceLoadTiming> timing = create();
- timing->redirectStart = redirectStart;
- timing->redirectEnd = redirectEnd;
- timing->redirectCount = redirectCount;
- timing->domainLookupStart = domainLookupStart;
- timing->domainLookupEnd = domainLookupEnd;
+ timing->requestTime = requestTime;
+ timing->proxyStart = proxyStart;
+ timing->proxyEnd = proxyEnd;
+ timing->dnsStart = dnsStart;
+ timing->dnsEnd = dnsEnd;
timing->connectStart = connectStart;
timing->connectEnd = connectEnd;
- timing->requestStart = requestStart;
- timing->requestEnd = requestEnd;
- timing->responseStart = responseStart;
- timing->responseEnd = responseEnd;
+ timing->sendStart = sendStart;
+ timing->sendEnd = sendEnd;
+ timing->receiveHeadersEnd = receiveHeadersEnd;
+ timing->sslStart = sslStart;
+ timing->sslEnd = sslEnd;
return timing.release();
}
bool operator==(const ResourceLoadTiming& other) const
{
- return redirectStart == other.redirectStart
- && redirectEnd == other.redirectEnd
- && redirectCount == other.redirectCount
- && domainLookupStart == other.domainLookupStart
- && domainLookupEnd == other.domainLookupEnd
+ return requestTime == other.requestTime
+ && proxyStart == other.proxyStart
+ && proxyEnd == other.proxyEnd
+ && dnsStart == other.dnsStart
+ && dnsEnd == other.dnsEnd
&& connectStart == other.connectStart
&& connectEnd == other.connectEnd
- && requestStart == other.requestStart
- && requestEnd == other.requestEnd
- && responseStart == other.responseStart
- && responseEnd == other.responseEnd;
+ && sendStart == other.sendStart
+ && sendEnd == other.sendEnd
+ && receiveHeadersEnd == other.receiveHeadersEnd
+ && sslStart == other.sslStart
+ && sslEnd == other.sslEnd;
}
bool operator!=(const ResourceLoadTiming& other) const
@@ -76,31 +78,33 @@ public:
return !(*this == other);
}
- double redirectStart;
- double redirectEnd;
- unsigned short redirectCount;
- double domainLookupStart;
- double domainLookupEnd;
- double connectStart;
- double connectEnd;
- double requestStart;
- double requestEnd;
- double responseStart;
- double responseEnd;
+ double requestTime;
+ int proxyStart;
+ int proxyEnd;
+ int dnsStart;
+ int dnsEnd;
+ int connectStart;
+ int connectEnd;
+ int sendStart;
+ int sendEnd;
+ int receiveHeadersEnd;
+ int sslStart;
+ int sslEnd;
private:
ResourceLoadTiming()
- : redirectStart(0.0)
- , redirectEnd(0.0)
- , redirectCount(0)
- , domainLookupStart(0.0)
- , domainLookupEnd(0.0)
- , connectStart(0.0)
- , connectEnd(0.0)
- , requestStart(0.0)
- , requestEnd(0.0)
- , responseStart(0.0)
- , responseEnd(0.0)
+ : requestTime(0)
+ , proxyStart(-1)
+ , proxyEnd(-1)
+ , dnsStart(-1)
+ , dnsEnd(-1)
+ , connectStart(-1)
+ , connectEnd(-1)
+ , sendStart(0)
+ , sendEnd(0)
+ , receiveHeadersEnd(0)
+ , sslStart(-1)
+ , sslEnd(-1)
{
}
};
diff --git a/WebCore/platform/network/ResourceRequestBase.h b/WebCore/platform/network/ResourceRequestBase.h
index 2cec4ec..1622cdd 100644
--- a/WebCore/platform/network/ResourceRequestBase.h
+++ b/WebCore/platform/network/ResourceRequestBase.h
@@ -132,6 +132,10 @@ namespace WebCore {
bool reportUploadProgress() const { return m_reportUploadProgress; }
void setReportUploadProgress(bool reportUploadProgress) { m_reportUploadProgress = reportUploadProgress; }
+ // Whether the timing information should be collected for the request.
+ bool reportLoadTiming() const { return m_reportLoadTiming; }
+ void setReportLoadTiming(bool reportLoadTiming) { m_reportLoadTiming = reportLoadTiming; }
+
// What this request is for.
TargetType targetType() const { return m_targetType; }
void setTargetType(TargetType type) { m_targetType = type; }
@@ -142,6 +146,7 @@ namespace WebCore {
: m_resourceRequestUpdated(false)
, m_platformRequestUpdated(true)
, m_reportUploadProgress(false)
+ , m_reportLoadTiming(false)
, m_targetType(TargetIsSubresource)
{
}
@@ -155,6 +160,7 @@ namespace WebCore {
, m_resourceRequestUpdated(true)
, m_platformRequestUpdated(false)
, m_reportUploadProgress(false)
+ , m_reportLoadTiming(false)
, m_targetType(TargetIsSubresource)
{
}
@@ -175,6 +181,7 @@ namespace WebCore {
mutable bool m_resourceRequestUpdated;
mutable bool m_platformRequestUpdated;
bool m_reportUploadProgress;
+ bool m_reportLoadTiming;
TargetType m_targetType;
private:
diff --git a/WebCore/platform/network/ResourceResponseBase.cpp b/WebCore/platform/network/ResourceResponseBase.cpp
index 607cd7f..89d31d7 100644
--- a/WebCore/platform/network/ResourceResponseBase.cpp
+++ b/WebCore/platform/network/ResourceResponseBase.cpp
@@ -43,6 +43,8 @@ ResourceResponseBase::ResourceResponseBase()
: m_expectedContentLength(0)
, m_httpStatusCode(0)
, m_lastModifiedDate(0)
+ , m_wasCached(false)
+ , m_connectionID(0)
, m_isNull(true)
, m_haveParsedCacheControlHeader(false)
, m_haveParsedAgeHeader(false)
@@ -68,6 +70,8 @@ ResourceResponseBase::ResourceResponseBase(const KURL& url, const String& mimeTy
, m_suggestedFilename(filename)
, m_httpStatusCode(0)
, m_lastModifiedDate(0)
+ , m_wasCached(false)
+ , m_connectionID(0)
, m_isNull(false)
, m_haveParsedCacheControlHeader(false)
, m_haveParsedAgeHeader(false)
@@ -455,6 +459,32 @@ time_t ResourceResponseBase::lastModifiedDate() const
return m_lastModifiedDate;
}
+bool ResourceResponseBase::wasCached() const
+{
+ lazyInit();
+
+ return m_wasCached;
+}
+
+void ResourceResponseBase::setWasCached(bool value)
+{
+ m_wasCached = value;
+}
+
+unsigned ResourceResponseBase::connectionID() const
+{
+ lazyInit();
+
+ return m_connectionID;
+}
+
+void ResourceResponseBase::setConnectionID(unsigned connectionID)
+{
+ lazyInit();
+
+ m_connectionID = connectionID;
+}
+
ResourceLoadTiming* ResourceResponseBase::resourceLoadTiming() const
{
lazyInit();
diff --git a/WebCore/platform/network/ResourceResponseBase.h b/WebCore/platform/network/ResourceResponseBase.h
index 697a84c..858a612 100644
--- a/WebCore/platform/network/ResourceResponseBase.h
+++ b/WebCore/platform/network/ResourceResponseBase.h
@@ -97,6 +97,12 @@ public:
double expires() const;
double lastModified() const;
+ unsigned connectionID() const;
+ void setConnectionID(unsigned);
+
+ bool wasCached() const;
+ void setWasCached(bool);
+
ResourceLoadTiming* resourceLoadTiming() const;
void setResourceLoadTiming(PassRefPtr<ResourceLoadTiming>);
@@ -130,6 +136,8 @@ protected:
String m_httpStatusText;
HTTPHeaderMap m_httpHeaderFields;
time_t m_lastModifiedDate;
+ bool m_wasCached;
+ unsigned m_connectionID;
RefPtr<ResourceLoadTiming> m_resourceLoadTiming;
bool m_isNull : 1;
diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
index 81b75b0..60d1eb6 100644
--- a/WebCore/platform/network/android/ResourceHandleAndroid.cpp
+++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp
@@ -156,6 +156,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
Frame* frame)
{
SyncLoader s(error, response, data);
+<<<<<<< HEAD
ResourceHandle h(request, &s, false, false);
// This blocks until the load is finished.
// Use the request owned by the ResourceHandle. This has had the username
@@ -163,6 +164,11 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
// ResourceHandleInternal::ResourceHandleInternal(). This matches the
// behaviour in the asynchronous case.
ResourceLoaderAndroid::start(&h, h.getInternal()->m_request, frame->loader()->client(), false, true);
+=======
+ RefPtr<ResourceHandle> h = adoptRef(new ResourceHandle(request, &s, false, false, false));
+ // This blocks until the load is finished.
+ ResourceLoaderAndroid::start(h.get(), request, frame->loader()->client(), false, true);
+>>>>>>> webkit.org at r63173
}
} // namespace WebCore
diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
index f126d27..1139126 100644
--- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -538,6 +538,12 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
if (challenge != d->m_currentWebChallenge)
return;
+ // FIXME: Support empty credentials. Currently, an empty credential cannot be stored in WebCore credential storage, as that's empty value for its map.
+ if (credential.isEmpty()) {
+ receivedRequestToContinueWithoutCredential(challenge);
+ return;
+ }
+
if (credential.persistence() == CredentialPersistenceForSession) {
// Manage per-session credentials internally, because once NSURLCredentialPersistencePerSession is used, there is no way
// to ignore it for a particular request (short of removing it altogether).
diff --git a/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
index 1fbafbd..a4c1f8e 100644
--- a/WebCore/platform/network/curl/ResourceHandleCurl.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
@@ -190,11 +190,11 @@ bool ResourceHandle::loadsBlocked()
void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame*)
{
WebCoreSynchronousLoader syncLoader;
- ResourceHandle handle(request, &syncLoader, true, false);
+ RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
ResourceHandleManager* manager = ResourceHandleManager::sharedInstance();
- manager->dispatchSynchronousJob(&handle);
+ manager->dispatchSynchronousJob(handle.get());
error = syncLoader.resourceError();
data = syncLoader.data();
diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm
index f14c108..9f64d4e 100644
--- a/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -583,7 +583,8 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
ASSERT(!challenge.isNull());
if (challenge != d->m_currentWebChallenge)
return;
-
+
+ // FIXME: Support empty credentials. Currently, an empty credential cannot be stored in WebCore credential storage, as that's empty value for its map.
if (credential.isEmpty()) {
receivedRequestToContinueWithoutCredential(challenge);
return;
diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp
index b35df6b..ff75a94 100644
--- a/WebCore/platform/network/qt/ResourceHandleQt.cpp
+++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp
@@ -189,9 +189,9 @@ PassRefPtr<SharedBuffer> ResourceHandle::bufferedData()
void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
{
WebCoreSynchronousLoader syncLoader;
- ResourceHandle handle(request, &syncLoader, true, false);
+ RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
- ResourceHandleInternal *d = handle.getInternal();
+ ResourceHandleInternal* d = handle->getInternal();
if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
// If credentials were specified for this request, add them to the url,
// so that they will be passed to QNetworkRequest.
@@ -201,7 +201,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
d->m_request.setURL(urlWithCredentials);
}
d->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
- d->m_job = new QNetworkReplyHandler(&handle, QNetworkReplyHandler::LoadNormal);
+ d->m_job = new QNetworkReplyHandler(handle.get(), QNetworkReplyHandler::LoadNormal);
syncLoader.waitForCompletion();
error = syncLoader.resourceError();
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 15d914f..e4f2a4b 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -658,9 +658,12 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
{
WebCoreSynchronousLoader syncLoader(error, response, data);
- ResourceHandle handle(request, &syncLoader, true, false);
+ // FIXME: we should use the ResourceHandle::create method here,
+ // but it makes us timeout in a couple of tests. See
+ // https://bugs.webkit.org/show_bug.cgi?id=41823
+ RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
+ handle->start(frame);
- handle.start(frame);
syncLoader.run();
}
@@ -929,4 +932,3 @@ SoupSession* ResourceHandle::defaultSession()
}
}
-