Diff
Modified: trunk/Source/WebCore/ChangeLog (173422 => 173423)
--- trunk/Source/WebCore/ChangeLog 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/ChangeLog 2014-09-09 08:19:16 UTC (rev 173423)
@@ -1,3 +1,48 @@
+2014-09-08 Antti Koivisto <[email protected]>
+
+ Pass certificate info as part of ResourceResponse
+ https://bugs.webkit.org/show_bug.cgi?id=136611
+
+ Reviewed by Darin Adler.
+
+ The current way of passing certificate info separately from ResourceResponse and then jamming it back
+ is complex and confusing. This patch makes it a true part of the ResourceResponse.
+
+ With this patch we also only create and pass the certificate info object for the main resource. It is
+ a big and complex object and we never look into it for any other resource type.
+
+ * WebCore.exp.in:
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::ResourceResponseBase::ResourceResponseBase):
+
+ Mark initialized for synthetic responses, unitialized for those backed by a platform request.
+
+ (WebCore::ResourceResponseBase::initializeCertificateInfo):
+
+ Calling this pulls the certificate info out from the platform type.
+ It shoud only be used for resources that need it.
+
+ (WebCore::ResourceResponseBase::certificateInfo):
+ * platform/network/ResourceResponseBase.h:
+ (WebCore::ResourceResponseBase::platformCertificateInfo):
+ (WebCore::ResourceResponseBase::platformSuggestedFileName):
+ (WebCore::ResourceResponseBase::encode):
+ (WebCore::ResourceResponseBase::decode):
+
+ Encode and decode certificate info if it is present.
+
+ * platform/network/cf/ResourceResponse.h:
+ * platform/network/mac/CertificateInfo.h:
+ * platform/network/mac/CertificateInfoMac.mm:
+ (WebCore::CertificateInfo::CertificateInfo):
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::platformCertificateInfo):
+ (WebCore::ResourceResponse::setCertificateChain): Deleted.
+ (WebCore::ResourceResponse::certificateChain): Deleted.
+ * platform/network/soup/ResourceResponse.h:
+ * platform/network/soup/ResourceResponseSoup.cpp:
+ (WebCore::ResourceResponse::platformCertificateInfo):
+
2014-09-09 Mihnea Ovidenie <[email protected]>
[CSSRegions] Use C++11 range-based loops in FlowThreadController
Modified: trunk/Source/WebCore/WebCore.exp.in (173422 => 173423)
--- trunk/Source/WebCore/WebCore.exp.in 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-09-09 08:19:16 UTC (rev 173423)
@@ -491,9 +491,6 @@
__ZN7WebCore15BackForwardList8capacityEv
__ZN7WebCore15BackForwardList9goForwardEv
__ZN7WebCore15BackForwardListC1EPNS_4PageE
-__ZN7WebCore15CertificateInfoC1EPK9__CFArray
-__ZN7WebCore15CertificateInfoC1ERKNS_16ResourceResponseE
-__ZN7WebCore15CertificateInfoC1Ev
__ZN7WebCore15DOMWrapperWorld13clearWrappersEv
__ZN7WebCore15DOMWrapperWorldD1Ev
__ZN7WebCore15DatabaseManager10initializeERKN3WTF6StringE
@@ -716,7 +713,6 @@
__ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_13FrameLoadTypeEb
__ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_14NavigationTypeE
__ZN7WebCore16NavigationActionC1Ev
-__ZN7WebCore16ResourceResponse19setCertificateChainEPK9__CFArray
__ZN7WebCore16ScriptController10initScriptERNS_15DOMWrapperWorldE
__ZN7WebCore16ScriptController11createWorldEv
__ZN7WebCore16ScriptController13executeScriptERKN3WTF6StringEb
@@ -1781,7 +1777,6 @@
__ZNK7WebCore16HTMLInputElement6isTextEv
__ZNK7WebCore16IconDatabaseBase12databasePathEv
__ZNK7WebCore16ResourceResponse13nsURLResponseEv
-__ZNK7WebCore16ResourceResponse16certificateChainEv
__ZNK7WebCore16VisibleSelection17isContentEditableEv
__ZNK7WebCore16VisibleSelection17isInPasswordFieldEv
__ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
@@ -1830,11 +1825,13 @@
__ZNK7WebCore20ResourceResponseBase12lastModifiedEv
__ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
__ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
+__ZNK7WebCore20ResourceResponseBase15certificateInfoEv
__ZNK7WebCore20ResourceResponseBase15httpHeaderFieldENS_14HTTPHeaderNameE
__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
__ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
__ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
__ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv
+__ZNK7WebCore20ResourceResponseBase22includeCertificateInfoEv
__ZNK7WebCore20ResourceResponseBase3urlEv
__ZNK7WebCore20ResourceResponseBase6isHTTPEv
__ZNK7WebCore20ResourceResponseBase8lazyInitENS0_9InitLevelE
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (173422 => 173423)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-09-09 08:19:16 UTC (rev 173423)
@@ -19798,6 +19798,7 @@
<ClInclude Include="..\platform\network\SynchronousLoaderClient.h" />
<CustomBuildStep Include="..\platform\network\cf\AuthenticationCF.h" />
<CustomBuildStep Include="..\platform\network\cf\AuthenticationChallenge.h" />
+ <CustomBuildStep Include="..\platform\network\cf\CertificateInfo.h" />
<ClInclude Include="..\platform\network\cf\DownloadBundle.h" />
<CustomBuildStep Include="..\platform\network\cf\FormDataStreamCFNet.h" />
<ClInclude Include="..\platform\network\cf\LoaderRunLoopCF.h" />
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (173422 => 173423)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-09-09 08:19:16 UTC (rev 173423)
@@ -16317,7 +16317,6 @@
514C76420CE9234E007EF3CD /* AuthenticationMac.h */,
514C76430CE9234E007EF3CD /* AuthenticationMac.mm */,
E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */,
- 5F2DBBE8178E336900141486 /* CertificateInfo.h */,
5F2DBBE7178E332D00141486 /* CertificateInfoMac.mm */,
E1424C8F164B460B00F32D40 /* CookieJarMac.mm */,
E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */,
@@ -20569,6 +20568,7 @@
7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */,
7EE6844D12D26E3800E79415 /* AuthenticationCF.h */,
7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */,
+ 5F2DBBE8178E336900141486 /* CertificateInfo.h */,
7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */,
7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */,
7EE6845212D26E3800E79415 /* CredentialStorageCFNet.cpp */,
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (173422 => 173423)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -46,6 +46,7 @@
ResourceResponseBase::ResourceResponseBase()
: m_expectedContentLength(0)
+ , m_includesCertificateInfo(false)
, m_httpStatusCode(0)
, m_connectionID(0)
, m_cacheControlMaxAge(0)
@@ -72,6 +73,7 @@
, m_mimeType(mimeType)
, m_expectedContentLength(expectedLength)
, m_textEncodingName(textEncodingName)
+ , m_includesCertificateInfo(true) // Empty but valid for synthetic responses.
, m_httpStatusCode(0)
, m_connectionID(0)
, m_cacheControlMaxAge(0)
@@ -205,7 +207,20 @@
// FIXME: Should invalidate or update platform response if present.
}
-// FIXME should compute this on the fly
+void ResourceResponseBase::includeCertificateInfo() const
+{
+ if (m_includesCertificateInfo)
+ return;
+ m_certificateInfo = static_cast<const ResourceResponse*>(this)->platformCertificateInfo();
+ m_includesCertificateInfo = true;
+}
+
+CertificateInfo ResourceResponseBase::certificateInfo() const
+{
+ ASSERT(m_includesCertificateInfo);
+ return m_certificateInfo;
+}
+
String ResourceResponseBase::suggestedFilename() const
{
return static_cast<const ResourceResponse*>(this)->platformSuggestedFilename();
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (173422 => 173423)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -27,6 +27,7 @@
#ifndef ResourceResponseBase_h
#define ResourceResponseBase_h
+#include "CertificateInfo.h"
#include "HTTPHeaderMap.h"
#include "URL.h"
#include "ResourceLoadTiming.h"
@@ -91,6 +92,9 @@
WEBCORE_EXPORT bool isAttachment() const;
WEBCORE_EXPORT String suggestedFilename() const;
+
+ void includeCertificateInfo() const;
+ CertificateInfo certificateInfo() const;
// These functions return parsed values of the corresponding response headers.
// NaN means that the header was not present or had invalid value.
@@ -139,11 +143,11 @@
void lazyInit(InitLevel) const;
- // The ResourceResponse subclass may "shadow" this method to lazily initialize platform specific fields
+ // The ResourceResponse subclass should shadow these functions to lazily initialize platform specific fields
void platformLazyInit(InitLevel) { }
- String platformSuggestedFileName() { return String(); }
+ CertificateInfo platformCertificateInfo() const { return CertificateInfo(); };
+ String platformSuggestedFileName() const { return String(); }
- // The ResourceResponse subclass may "shadow" this method to compare platform specific fields
static bool platformCompare(const ResourceResponse&, const ResourceResponse&) { return true; }
URL m_url;
@@ -154,6 +158,9 @@
HTTPHeaderMap m_httpHeaderFields;
mutable ResourceLoadTiming m_resourceLoadTiming;
+ mutable bool m_includesCertificateInfo;
+ mutable CertificateInfo m_certificateInfo;
+
int m_httpStatusCode;
unsigned m_connectionID;
@@ -206,6 +213,9 @@
encoder << m_resourceLoadTiming;
encoder << m_httpStatusCode;
encoder << m_connectionID;
+ encoder << m_includesCertificateInfo;
+ if (m_includesCertificateInfo)
+ encoder << m_certificateInfo;
}
template<class Decoder>
@@ -240,6 +250,12 @@
return false;
if (!decoder.decode(response.m_connectionID))
return false;
+ if (!decoder.decode(response.m_includesCertificateInfo))
+ return false;
+ if (response.m_includesCertificateInfo) {
+ if (!decoder.decode(response.m_certificateInfo))
+ return false;
+ }
response.m_isNull = false;
return true;
Copied: trunk/Source/WebCore/platform/network/cf/CertificateInfo.h (from rev 173372, trunk/Source/WebCore/platform/network/mac/CertificateInfo.h) (0 => 173423)
--- trunk/Source/WebCore/platform/network/cf/CertificateInfo.h (rev 0)
+++ trunk/Source/WebCore/platform/network/cf/CertificateInfo.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CertificateInfo_h
+#define CertificateInfo_h
+
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class CertificateInfo {
+public:
+ CertificateInfo() { }
+ CertificateInfo(RetainPtr<CFArrayRef> certificateChain)
+ : m_certificateChain(certificateChain)
+ { }
+
+ void setCertificateChain(CFArrayRef certificateChain) { m_certificateChain = certificateChain; }
+ CFArrayRef certificateChain() const { return m_certificateChain.get(); }
+
+#ifndef NDEBUG
+ void dump() const;
+#endif
+
+private:
+ RetainPtr<CFArrayRef> m_certificateChain;
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponse.h (173422 => 173423)
--- trunk/Source/WebCore/platform/network/cf/ResourceResponse.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponse.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -92,11 +92,6 @@
WEBCORE_EXPORT NSURLResponse *nsURLResponse() const;
#endif
-#if PLATFORM(COCOA) || USE(CFNETWORK)
- WEBCORE_EXPORT void setCertificateChain(CFArrayRef);
- WEBCORE_EXPORT RetainPtr<CFArrayRef> certificateChain() const;
-#endif
-
bool platformResponseIsUpToDate() const { return m_platformResponseIsUpToDate; }
private:
@@ -104,6 +99,8 @@
void platformLazyInit(InitLevel);
String platformSuggestedFilename() const;
+ CertificateInfo platformCertificateInfo() const;
+
PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; }
void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { }
#if PLATFORM(COCOA)
@@ -121,10 +118,6 @@
#if PLATFORM(COCOA)
mutable RetainPtr<NSURLResponse> m_nsResponse;
#endif
-#if PLATFORM(COCOA) || USE(CFNETWORK)
- // Certificate chain is normally part of NS/CFURLResponse, but there is no way to re-add it to a deserialized response after IPC.
- RetainPtr<CFArrayRef> m_externalCertificateChain;
-#endif
};
struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
Deleted: trunk/Source/WebCore/platform/network/mac/CertificateInfo.h (173422 => 173423)
--- trunk/Source/WebCore/platform/network/mac/CertificateInfo.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/mac/CertificateInfo.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CertificateInfo_h
-#define CertificateInfo_h
-
-#include <WebCore/ResourceResponse.h>
-#include <wtf/RetainPtr.h>
-
-namespace WebCore {
-
-class CertificateInfo {
-public:
- WEBCORE_EXPORT CertificateInfo();
- WEBCORE_EXPORT explicit CertificateInfo(const ResourceResponse&);
- WEBCORE_EXPORT explicit CertificateInfo(CFArrayRef certificateChain);
-
- void setCertificateChain(CFArrayRef certificateChain) { m_certificateChain = certificateChain; }
- CFArrayRef certificateChain() const { return m_certificateChain.get(); }
-
-#ifndef NDEBUG
- void dump() const;
-#endif
-
-private:
- RetainPtr<CFArrayRef> m_certificateChain;
-};
-
-} // namespace WebKit
-
-#endif // CertificateInfo_h
Modified: trunk/Source/WebCore/platform/network/mac/CertificateInfoMac.mm (173422 => 173423)
--- trunk/Source/WebCore/platform/network/mac/CertificateInfoMac.mm 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/mac/CertificateInfoMac.mm 2014-09-09 08:19:16 UTC (rev 173423)
@@ -28,20 +28,6 @@
namespace WebCore {
-CertificateInfo::CertificateInfo()
-{
-}
-
-CertificateInfo::CertificateInfo(const ResourceResponse& response)
- : m_certificateChain(response.certificateChain())
-{
-}
-
-CertificateInfo::CertificateInfo(CFArrayRef certificateChain)
- : m_certificateChain(certificateChain)
-{
-}
-
#ifndef NDEBUG
void CertificateInfo::dump() const
{
Modified: trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm (173422 => 173423)
--- trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm 2014-09-09 08:19:16 UTC (rev 173423)
@@ -172,6 +172,12 @@
m_initLevel = initLevel;
}
+CertificateInfo ResourceResponse::platformCertificateInfo() const
+{
+ ASSERT(m_nsResponse);
+ return CertificateInfo(adoptCF(wkCopyNSURLResponseCertificateChain(m_nsResponse.get())));
+}
+
String ResourceResponse::platformSuggestedFilename() const
{
return [nsURLResponse() suggestedFilename];
@@ -184,23 +190,5 @@
#endif // USE(CFNETWORK)
-#if PLATFORM(COCOA) || USE(CFNETWORK)
-
-void ResourceResponse::setCertificateChain(CFArrayRef certificateChain)
-{
- ASSERT(!m_nsResponse || !wkCopyNSURLResponseCertificateChain(m_nsResponse.get()));
- m_externalCertificateChain = certificateChain;
-}
-
-RetainPtr<CFArrayRef> ResourceResponse::certificateChain() const
-{
- if (m_externalCertificateChain)
- return m_externalCertificateChain;
-
- return adoptCF(wkCopyNSURLResponseCertificateChain(nsURLResponse()));
-}
-
-#endif // PLATFORM(COCOA) || USE(CFNETWORK)
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponse.h (173422 => 173423)
--- trunk/Source/WebCore/platform/network/soup/ResourceResponse.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponse.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -89,6 +89,7 @@
void doUpdateResourceResponse() { }
String platformSuggestedFilename() const;
+ CertificateInfo platformCertificateInfo() const;
PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; }
void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { }
Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp (173422 => 173423)
--- trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -101,6 +101,11 @@
setExpectedContentLength(soup_message_headers_get_content_length(headers));
}
+CertificateInfo ResourceResponse::platformCertificateInfo() const
+{
+ return CertificateInfo(m_certificate.get(), m_tlsErrors);
+}
+
String ResourceResponse::platformSuggestedFilename() const
{
return filenameFromHTTPContentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
Modified: trunk/Source/WebKit2/ChangeLog (173422 => 173423)
--- trunk/Source/WebKit2/ChangeLog 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/ChangeLog 2014-09-09 08:19:16 UTC (rev 173423)
@@ -1,3 +1,31 @@
+2014-09-08 Antti Koivisto <[email protected]>
+
+ Pass certificate info as part of ResourceResponse
+ https://bugs.webkit.org/show_bug.cgi?id=136611
+
+ Reviewed by Darin Adler.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
+
+ Initialize the certificate info only if requested.
+
+ * WebProcess/Network/WebResourceLoader.cpp:
+ (WebKit::WebResourceLoader::didReceiveResponse):
+ (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo): Deleted.
+
+ Rename didReceiveResponseWithCertificateInfo -> didReceiveResponse as it is now part of the response.
+
+ * WebProcess/Network/WebResourceLoader.h:
+ * WebProcess/Network/WebResourceLoader.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+
+ Request certificate info for the main resource only.
+
+ (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::certificateInfo):
+
2014-09-08 Shivakumar JM <[email protected]>
[WebKit2] Fix build error in WebKit2/WebProcess module
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (173422 => 173423)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -97,6 +97,7 @@
, m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)
, m_isLoadingMainResource(parameters.isMainResource)
, m_defersLoading(parameters.defersLoading)
+ , m_needsCertificateInfo(parameters.needsCertificateInfo)
, m_maximumBufferingTime(parameters.maximumBufferingTime)
, m_bufferingTimer(this, &NetworkResourceLoader::bufferingTimerFired)
, m_sandboxExtensionsAreConsumed(false)
@@ -221,10 +222,13 @@
{
ASSERT_UNUSED(handle, handle == m_handle);
+ if (m_needsCertificateInfo)
+ response.includeCertificateInfo();
+
if (isSynchronous())
m_synchronousLoadData->m_response = response;
else
- sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponseWithCertificateInfo(response, CertificateInfo(response), isLoadingMainResource()));
+ sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(response, isLoadingMainResource()));
// m_handle will be null if the request got aborted above.
if (!m_handle)
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (173422 => 173423)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -193,6 +193,7 @@
bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;
bool m_isLoadingMainResource;
bool m_defersLoading;
+ bool m_needsCertificateInfo;
const std::chrono::milliseconds m_maximumBufferingTime;
WebCore::Timer<NetworkResourceLoader> m_bufferingTimer;
Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp (173422 => 173423)
--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -47,6 +47,7 @@
, shouldClearReferrerOnHTTPSToHTTPRedirect(true)
, isMainResource(false)
, defersLoading(false)
+ , needsCertificateInfo(false)
, maximumBufferingTime(0_ms)
{
}
@@ -95,6 +96,7 @@
encoder << shouldClearReferrerOnHTTPSToHTTPRedirect;
encoder << isMainResource;
encoder << defersLoading;
+ encoder << needsCertificateInfo;
encoder << maximumBufferingTime;
}
@@ -146,6 +148,8 @@
return false;
if (!decoder.decode(result.defersLoading))
return false;
+ if (!decoder.decode(result.needsCertificateInfo))
+ return false;
if (!decoder.decode(result.maximumBufferingTime))
return false;
Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h (173422 => 173423)
--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -63,6 +63,7 @@
bool shouldClearReferrerOnHTTPSToHTTPRedirect;
bool isMainResource;
bool defersLoading;
+ bool needsCertificateInfo;
std::chrono::milliseconds maximumBufferingTime;
};
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -173,6 +173,7 @@
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource;
loadParameters.defersLoading = resourceLoader->defersLoading();
+ loadParameters.needsCertificateInfo = loadParameters.isMainResource;
loadParameters.maximumBufferingTime = maximumBufferingTime(resource);
ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -102,33 +102,23 @@
m_coreLoader->didSendData(bytesSent, totalBytesToBeSent);
}
-void WebResourceLoader::didReceiveResponseWithCertificateInfo(const ResourceResponse& response, const CertificateInfo& certificateInfo, bool needsContinueDidReceiveResponseMessage)
+void WebResourceLoader::didReceiveResponse(const ResourceResponse& response, bool needsContinueDidReceiveResponseMessage)
{
LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResponseWithCertificateInfo for '%s'. Status %d.", m_coreLoader->url().string().utf8().data(), response.httpStatusCode());
Ref<WebResourceLoader> protect(*this);
- ResourceResponse responseCopy(response);
-
- // FIXME: This should use CertificateInfo to avoid the platform ifdefs. See https://bugs.webkit.org/show_bug.cgi?id=124724.
-#if PLATFORM(COCOA)
- responseCopy.setCertificateChain(certificateInfo.certificateChain());
-#elif USE(SOUP)
- responseCopy.setSoupMessageCertificate(certificateInfo.certificate());
- responseCopy.setSoupMessageTLSErrors(certificateInfo.tlsErrors());
-#endif
-
- if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), responseCopy))
+ if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), response))
return;
#if USE(QUICK_LOOK)
// Refrain from calling didReceiveResponse if QuickLook will convert this response, since the MIME type of the
// converted resource isn't yet known. WebResourceLoaderQuickLookDelegate will later call didReceiveResponse upon
// receiving the converted data.
- m_coreLoader->documentLoader()->setQuickLookHandle(QuickLookHandle::create(resourceLoader(), responseCopy.nsURLResponse()));
+ m_coreLoader->documentLoader()->setQuickLookHandle(QuickLookHandle::create(resourceLoader(), response.nsURLResponse()));
if (!m_coreLoader->documentLoader()->quickLookHandle())
#endif
- m_coreLoader->didReceiveResponse(responseCopy);
+ m_coreLoader->didReceiveResponse(response);
// If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function().
if (!m_coreLoader)
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h 2014-09-09 08:19:16 UTC (rev 173423)
@@ -80,7 +80,7 @@
void willSendRequest(const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
void didSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent);
- void didReceiveResponseWithCertificateInfo(const WebCore::ResourceResponse&, const WebCore::CertificateInfo&, bool needsContinueDidReceiveResponseMessage);
+ void didReceiveResponse(const WebCore::ResourceResponse&, bool needsContinueDidReceiveResponseMessage);
void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength);
void didFinishResourceLoad(double finishTime);
void didFailResourceLoad(const WebCore::ResourceError&);
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in 2014-09-09 08:19:16 UTC (rev 173423)
@@ -26,10 +26,9 @@
CancelResourceLoader()
- // FIXME (NetworkProcess): We'll need much more granularity for response messages.
WillSendRequest(WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse)
DidSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent)
- DidReceiveResponseWithCertificateInfo(WebCore::ResourceResponse response, WebCore::CertificateInfo certificateInfo, bool needsContinueDidReceiveResponseMessage)
+ DidReceiveResponse(WebCore::ResourceResponse response, bool needsContinueDidReceiveResponseMessage)
DidReceiveData(IPC::DataReference data, int64_t encodedDataLength)
DidFinishResourceLoad(double finishTime)
DidFailResourceLoad(WebCore::ResourceError error)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -455,7 +455,7 @@
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), CertificateInfo(documentLoader.response()), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), documentLoader.response().certificateInfo(), InjectedBundleUserMessageEncoder(userData.get())));
webPage->didCommitLoad(m_frame);
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (173422 => 173423)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2014-09-09 07:57:10 UTC (rev 173422)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2014-09-09 08:19:16 UTC (rev 173423)
@@ -417,7 +417,7 @@
if (!documentLoader)
return CertificateInfo();
- return CertificateInfo(documentLoader->response());
+ return documentLoader->response().certificateInfo();
}
String WebFrame::innerText() const