Pass certificate info as part of ResourceResponse
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2014 08:19:16 +0000 (08:19 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2014 08:19:16 +0000 (08:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136611

Reviewed by Darin Adler.

Source/WebCore:

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):

Source/WebKit2:

* 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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173423 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebCore/platform/network/cf/CertificateInfo.h [moved from Source/WebCore/platform/network/mac/CertificateInfo.h with 86% similarity]
Source/WebCore/platform/network/cf/ResourceResponse.h
Source/WebCore/platform/network/mac/CertificateInfoMac.mm
Source/WebCore/platform/network/mac/ResourceResponseMac.mm
Source/WebCore/platform/network/soup/ResourceResponse.h
Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.h
Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp
Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h
Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp
Source/WebKit2/WebProcess/Network/WebResourceLoader.h
Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index 732cb4c..bed9438 100644 (file)
@@ -1,3 +1,48 @@
+2014-09-08  Antti Koivisto  <antti@apple.com>
+
+        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  <mihnea@adobe.com>
 
         [CSSRegions] Use C++11 range-based loops in FlowThreadController
index a991117..7262e73 100644 (file)
@@ -491,9 +491,6 @@ __ZN7WebCore15BackForwardList8backItemEv
 __ZN7WebCore15BackForwardList8capacityEv
 __ZN7WebCore15BackForwardList9goForwardEv
 __ZN7WebCore15BackForwardListC1EPNS_4PageE
-__ZN7WebCore15CertificateInfoC1EPK9__CFArray
-__ZN7WebCore15CertificateInfoC1ERKNS_16ResourceResponseE
-__ZN7WebCore15CertificateInfoC1Ev
 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv
 __ZN7WebCore15DOMWrapperWorldD1Ev
 __ZN7WebCore15DatabaseManager10initializeERKN3WTF6StringE
@@ -716,7 +713,6 @@ __ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestE
 __ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_13FrameLoadTypeEb
 __ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_14NavigationTypeE
 __ZN7WebCore16NavigationActionC1Ev
-__ZN7WebCore16ResourceResponse19setCertificateChainEPK9__CFArray
 __ZN7WebCore16ScriptController10initScriptERNS_15DOMWrapperWorldE
 __ZN7WebCore16ScriptController11createWorldEv
 __ZN7WebCore16ScriptController13executeScriptERKN3WTF6StringEb
@@ -1781,7 +1777,6 @@ __ZNK7WebCore16HTMLInputElement20isDateTimeLocalFieldEv
 __ZNK7WebCore16HTMLInputElement6isTextEv
 __ZNK7WebCore16IconDatabaseBase12databasePathEv
 __ZNK7WebCore16ResourceResponse13nsURLResponseEv
-__ZNK7WebCore16ResourceResponse16certificateChainEv
 __ZNK7WebCore16VisibleSelection17isContentEditableEv
 __ZNK7WebCore16VisibleSelection17isInPasswordFieldEv
 __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
@@ -1830,11 +1825,13 @@ __ZNK7WebCore20ResourceResponseBase12isAttachmentEv
 __ZNK7WebCore20ResourceResponseBase12lastModifiedEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
+__ZNK7WebCore20ResourceResponseBase15certificateInfoEv
 __ZNK7WebCore20ResourceResponseBase15httpHeaderFieldENS_14HTTPHeaderNameE
 __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
 __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
 __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
 __ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv
+__ZNK7WebCore20ResourceResponseBase22includeCertificateInfoEv
 __ZNK7WebCore20ResourceResponseBase3urlEv
 __ZNK7WebCore20ResourceResponseBase6isHTTPEv
 __ZNK7WebCore20ResourceResponseBase8lazyInitENS0_9InitLevelE
index 03b07c7..f367f5f 100644 (file)
     <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" />
index fa35365..5be3d37 100644 (file)
                                514C76420CE9234E007EF3CD /* AuthenticationMac.h */,
                                514C76430CE9234E007EF3CD /* AuthenticationMac.mm */,
                                E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */,
-                               5F2DBBE8178E336900141486 /* CertificateInfo.h */,
                                5F2DBBE7178E332D00141486 /* CertificateInfoMac.mm */,
                                E1424C8F164B460B00F32D40 /* CookieJarMac.mm */,
                                E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */,
                                7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */,
                                7EE6844D12D26E3800E79415 /* AuthenticationCF.h */,
                                7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */,
+                               5F2DBBE8178E336900141486 /* CertificateInfo.h */,
                                7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */,
                                7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */,
                                7EE6845212D26E3800E79415 /* CredentialStorageCFNet.cpp */,
index d20aafc..6e40afb 100644 (file)
@@ -46,6 +46,7 @@ inline const ResourceResponse& ResourceResponseBase::asResourceResponse() const
 
 ResourceResponseBase::ResourceResponseBase()  
     : m_expectedContentLength(0)
+    , m_includesCertificateInfo(false)
     , m_httpStatusCode(0)
     , m_connectionID(0)
     , m_cacheControlMaxAge(0)
@@ -72,6 +73,7 @@ ResourceResponseBase::ResourceResponseBase(const URL& url, const String& mimeTyp
     , 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 @@ void ResourceResponseBase::setTextEncodingName(const String& encodingName)
     // 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();
index 72a243e..d7e6d85 100644 (file)
@@ -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 @@ public:
 
     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 @@ protected:
 
     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 @@ protected:
     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 @@ void ResourceResponseBase::encode(Encoder& encoder) const
     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 @@ bool ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& respon
         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;
 #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);
+    CertificateInfo() { }
+    CertificateInfo(RetainPtr<CFArrayRef> certificateChain)
+        : m_certificateChain(certificateChain)
+    { }
 
     void setCertificateChain(CFArrayRef certificateChain) { m_certificateChain = certificateChain; }
     CFArrayRef certificateChain() const { return m_certificateChain.get(); }
@@ -48,6 +48,6 @@ private:
     RetainPtr<CFArrayRef> m_certificateChain;
 };
 
-} // namespace WebKit
+}
 
-#endif // CertificateInfo_h
+#endif
index 10d09ea..65284bd 100644 (file)
@@ -92,11 +92,6 @@ public:
     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 @@ private:
 
     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 @@ private:
 #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 {
index 203c9cc..3fc4de3 100644 (file)
 
 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
 {
index 896baee..53f7f00 100644 (file)
@@ -172,6 +172,12 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
     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 @@ bool ResourceResponse::platformCompare(const ResourceResponse& a, const Resource
 
 #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
 
index a8e58f6..de35d2a 100644 (file)
@@ -89,6 +89,7 @@ private:
 
     void doUpdateResourceResponse() { }
     String platformSuggestedFilename() const;
+    CertificateInfo platformCertificateInfo() const;
 
     PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; }
     void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { }
index ee485b6..14d46b6 100644 (file)
@@ -101,6 +101,11 @@ void ResourceResponse::updateFromSoupMessageHeaders(const SoupMessageHeaders* me
     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));
index 434295e..28dc470 100644 (file)
@@ -1,3 +1,31 @@
+2014-09-08  Antti Koivisto  <antti@apple.com>
+
+        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  <shiva.jm@samsung.com>
 
         [WebKit2] Fix build error in WebKit2/WebProcess module
index 2e756e2..1bfb6b7 100644 (file)
@@ -97,6 +97,7 @@ NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters
     , 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 @@ void NetworkResourceLoader::didReceiveResponseAsync(ResourceHandle* handle, cons
 {
     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)
index bc2e3ea..a50f896 100644 (file)
@@ -193,6 +193,7 @@ private:
     bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;
     bool m_isLoadingMainResource;
     bool m_defersLoading;
+    bool m_needsCertificateInfo;
     const std::chrono::milliseconds m_maximumBufferingTime;
 
     WebCore::Timer<NetworkResourceLoader> m_bufferingTimer;
index 01d2796..5b39052 100644 (file)
@@ -47,6 +47,7 @@ NetworkResourceLoadParameters::NetworkResourceLoadParameters()
     , shouldClearReferrerOnHTTPSToHTTPRedirect(true)
     , isMainResource(false)
     , defersLoading(false)
+    , needsCertificateInfo(false)
     , maximumBufferingTime(0_ms)
 {
 }
@@ -95,6 +96,7 @@ void NetworkResourceLoadParameters::encode(IPC::ArgumentEncoder& encoder) const
     encoder << shouldClearReferrerOnHTTPSToHTTPRedirect;
     encoder << isMainResource;
     encoder << defersLoading;
+    encoder << needsCertificateInfo;
     encoder << maximumBufferingTime;
 }
 
@@ -146,6 +148,8 @@ bool NetworkResourceLoadParameters::decode(IPC::ArgumentDecoder& decoder, Networ
         return false;
     if (!decoder.decode(result.defersLoading))
         return false;
+    if (!decoder.decode(result.needsCertificateInfo))
+        return false;
     if (!decoder.decode(result.maximumBufferingTime))
         return false;
 
index cf2bcc7..2e5467a 100644 (file)
@@ -63,6 +63,7 @@ public:
     bool shouldClearReferrerOnHTTPSToHTTPRedirect;
     bool isMainResource;
     bool defersLoading;
+    bool needsCertificateInfo;
     std::chrono::milliseconds maximumBufferingTime;
 };
 
index 2a3a6e0..c55802f 100644 (file)
@@ -173,6 +173,7 @@ void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, Cach
     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);
index c106e81..47045a8 100644 (file)
@@ -102,33 +102,23 @@ void WebResourceLoader::didSendData(uint64_t bytesSent, uint64_t totalBytesToBeS
     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)
index cbe583d..dc9aa0f 100644 (file)
@@ -80,7 +80,7 @@ private:
 
     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&);
index 86166de..d99ecf3 100644 (file)
@@ -26,10 +26,9 @@ messages -> WebResourceLoader LegacyReceiver {
 
     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)
index 3111d70..123be94 100644 (file)
@@ -455,7 +455,7 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
 
     // 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);
 }
 
index a04e1eb..20599d7 100644 (file)
@@ -417,7 +417,7 @@ WebCore::CertificateInfo WebFrame::certificateInfo() const
     if (!documentLoader)
         return CertificateInfo();
 
-    return CertificateInfo(documentLoader->response());
+    return documentLoader->response().certificateInfo();
 }
 
 String WebFrame::innerText() const