Changeset 173423 in webkit
- Timestamp:
- Sep 9, 2014, 1:19:16 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r173422 r173423 1 2014-09-08 Antti Koivisto <antti@apple.com> 2 3 Pass certificate info as part of ResourceResponse 4 https://bugs.webkit.org/show_bug.cgi?id=136611 5 6 Reviewed by Darin Adler. 7 8 The current way of passing certificate info separately from ResourceResponse and then jamming it back 9 is complex and confusing. This patch makes it a true part of the ResourceResponse. 10 11 With this patch we also only create and pass the certificate info object for the main resource. It is 12 a big and complex object and we never look into it for any other resource type. 13 14 * WebCore.exp.in: 15 * platform/network/ResourceResponseBase.cpp: 16 (WebCore::ResourceResponseBase::ResourceResponseBase): 17 18 Mark initialized for synthetic responses, unitialized for those backed by a platform request. 19 20 (WebCore::ResourceResponseBase::initializeCertificateInfo): 21 22 Calling this pulls the certificate info out from the platform type. 23 It shoud only be used for resources that need it. 24 25 (WebCore::ResourceResponseBase::certificateInfo): 26 * platform/network/ResourceResponseBase.h: 27 (WebCore::ResourceResponseBase::platformCertificateInfo): 28 (WebCore::ResourceResponseBase::platformSuggestedFileName): 29 (WebCore::ResourceResponseBase::encode): 30 (WebCore::ResourceResponseBase::decode): 31 32 Encode and decode certificate info if it is present. 33 34 * platform/network/cf/ResourceResponse.h: 35 * platform/network/mac/CertificateInfo.h: 36 * platform/network/mac/CertificateInfoMac.mm: 37 (WebCore::CertificateInfo::CertificateInfo): 38 * platform/network/mac/ResourceResponseMac.mm: 39 (WebCore::ResourceResponse::platformCertificateInfo): 40 (WebCore::ResourceResponse::setCertificateChain): Deleted. 41 (WebCore::ResourceResponse::certificateChain): Deleted. 42 * platform/network/soup/ResourceResponse.h: 43 * platform/network/soup/ResourceResponseSoup.cpp: 44 (WebCore::ResourceResponse::platformCertificateInfo): 45 1 46 2014-09-09 Mihnea Ovidenie <mihnea@adobe.com> 2 47 -
TabularUnified trunk/Source/WebCore/WebCore.exp.in ¶
r173356 r173423 492 492 __ZN7WebCore15BackForwardList9goForwardEv 493 493 __ZN7WebCore15BackForwardListC1EPNS_4PageE 494 __ZN7WebCore15CertificateInfoC1EPK9__CFArray495 __ZN7WebCore15CertificateInfoC1ERKNS_16ResourceResponseE496 __ZN7WebCore15CertificateInfoC1Ev497 494 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv 498 495 __ZN7WebCore15DOMWrapperWorldD1Ev … … 717 714 __ZN7WebCore16NavigationActionC1ERKNS_15ResourceRequestENS_14NavigationTypeE 718 715 __ZN7WebCore16NavigationActionC1Ev 719 __ZN7WebCore16ResourceResponse19setCertificateChainEPK9__CFArray720 716 __ZN7WebCore16ScriptController10initScriptERNS_15DOMWrapperWorldE 721 717 __ZN7WebCore16ScriptController11createWorldEv … … 1782 1778 __ZNK7WebCore16IconDatabaseBase12databasePathEv 1783 1779 __ZNK7WebCore16ResourceResponse13nsURLResponseEv 1784 __ZNK7WebCore16ResourceResponse16certificateChainEv1785 1780 __ZNK7WebCore16VisibleSelection17isContentEditableEv 1786 1781 __ZNK7WebCore16VisibleSelection17isInPasswordFieldEv … … 1831 1826 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv 1832 1827 __ZNK7WebCore20ResourceResponseBase14httpStatusTextEv 1828 __ZNK7WebCore20ResourceResponseBase15certificateInfoEv 1833 1829 __ZNK7WebCore20ResourceResponseBase15httpHeaderFieldENS_14HTTPHeaderNameE 1834 1830 __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv … … 1836 1832 __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv 1837 1833 __ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv 1834 __ZNK7WebCore20ResourceResponseBase22includeCertificateInfoEv 1838 1835 __ZNK7WebCore20ResourceResponseBase3urlEv 1839 1836 __ZNK7WebCore20ResourceResponseBase6isHTTPEv -
TabularUnified trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj ¶
r173318 r173423 19799 19799 <CustomBuildStep Include="..\platform\network\cf\AuthenticationCF.h" /> 19800 19800 <CustomBuildStep Include="..\platform\network\cf\AuthenticationChallenge.h" /> 19801 <CustomBuildStep Include="..\platform\network\cf\CertificateInfo.h" /> 19801 19802 <ClInclude Include="..\platform\network\cf\DownloadBundle.h" /> 19802 19803 <CustomBuildStep Include="..\platform\network\cf\FormDataStreamCFNet.h" /> -
TabularUnified trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj ¶
r173364 r173423 16318 16318 514C76430CE9234E007EF3CD /* AuthenticationMac.mm */, 16319 16319 E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */, 16320 5F2DBBE8178E336900141486 /* CertificateInfo.h */,16321 16320 5F2DBBE7178E332D00141486 /* CertificateInfoMac.mm */, 16322 16321 E1424C8F164B460B00F32D40 /* CookieJarMac.mm */, … … 20570 20569 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */, 20571 20570 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */, 20571 5F2DBBE8178E336900141486 /* CertificateInfo.h */, 20572 20572 7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */, 20573 20573 7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */, -
TabularUnified trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp ¶
r173272 r173423 47 47 ResourceResponseBase::ResourceResponseBase() 48 48 : m_expectedContentLength(0) 49 , m_includesCertificateInfo(false) 49 50 , m_httpStatusCode(0) 50 51 , m_connectionID(0) … … 73 74 , m_expectedContentLength(expectedLength) 74 75 , m_textEncodingName(textEncodingName) 76 , m_includesCertificateInfo(true) // Empty but valid for synthetic responses. 75 77 , m_httpStatusCode(0) 76 78 , m_connectionID(0) … … 206 208 } 207 209 208 // FIXME should compute this on the fly 210 void ResourceResponseBase::includeCertificateInfo() const 211 { 212 if (m_includesCertificateInfo) 213 return; 214 m_certificateInfo = static_cast<const ResourceResponse*>(this)->platformCertificateInfo(); 215 m_includesCertificateInfo = true; 216 } 217 218 CertificateInfo ResourceResponseBase::certificateInfo() const 219 { 220 ASSERT(m_includesCertificateInfo); 221 return m_certificateInfo; 222 } 223 209 224 String ResourceResponseBase::suggestedFilename() const 210 225 { -
TabularUnified trunk/Source/WebCore/platform/network/ResourceResponseBase.h ¶
r173356 r173423 28 28 #define ResourceResponseBase_h 29 29 30 #include "CertificateInfo.h" 30 31 #include "HTTPHeaderMap.h" 31 32 #include "URL.h" … … 92 93 WEBCORE_EXPORT bool isAttachment() const; 93 94 WEBCORE_EXPORT String suggestedFilename() const; 95 96 void includeCertificateInfo() const; 97 CertificateInfo certificateInfo() const; 94 98 95 99 // These functions return parsed values of the corresponding response headers. … … 140 144 void lazyInit(InitLevel) const; 141 145 142 // The ResourceResponse subclass may "shadow" this methodto lazily initialize platform specific fields146 // The ResourceResponse subclass should shadow these functions to lazily initialize platform specific fields 143 147 void platformLazyInit(InitLevel) { } 144 String platformSuggestedFileName() { return String(); }145 146 // The ResourceResponse subclass may "shadow" this method to compare platform specific fields 148 CertificateInfo platformCertificateInfo() const { return CertificateInfo(); }; 149 String platformSuggestedFileName() const { return String(); } 150 147 151 static bool platformCompare(const ResourceResponse&, const ResourceResponse&) { return true; } 148 152 … … 154 158 HTTPHeaderMap m_httpHeaderFields; 155 159 mutable ResourceLoadTiming m_resourceLoadTiming; 160 161 mutable bool m_includesCertificateInfo; 162 mutable CertificateInfo m_certificateInfo; 156 163 157 164 int m_httpStatusCode; … … 207 214 encoder << m_httpStatusCode; 208 215 encoder << m_connectionID; 216 encoder << m_includesCertificateInfo; 217 if (m_includesCertificateInfo) 218 encoder << m_certificateInfo; 209 219 } 210 220 … … 241 251 if (!decoder.decode(response.m_connectionID)) 242 252 return false; 253 if (!decoder.decode(response.m_includesCertificateInfo)) 254 return false; 255 if (response.m_includesCertificateInfo) { 256 if (!decoder.decode(response.m_certificateInfo)) 257 return false; 258 } 243 259 response.m_isNull = false; 244 260 -
TabularUnified trunk/Source/WebCore/platform/network/cf/CertificateInfo.h ¶
r173372 r173423 27 27 #define CertificateInfo_h 28 28 29 #include <WebCore/ResourceResponse.h>30 29 #include <wtf/RetainPtr.h> 31 30 … … 34 33 class CertificateInfo { 35 34 public: 36 WEBCORE_EXPORT CertificateInfo(); 37 WEBCORE_EXPORT explicit CertificateInfo(const ResourceResponse&); 38 WEBCORE_EXPORT explicit CertificateInfo(CFArrayRef certificateChain); 35 CertificateInfo() { } 36 CertificateInfo(RetainPtr<CFArrayRef> certificateChain) 37 : m_certificateChain(certificateChain) 38 { } 39 39 40 40 void setCertificateChain(CFArrayRef certificateChain) { m_certificateChain = certificateChain; } … … 49 49 }; 50 50 51 } // namespace WebKit51 } 52 52 53 #endif // CertificateInfo_h53 #endif -
TabularUnified trunk/Source/WebCore/platform/network/cf/ResourceResponse.h ¶
r173272 r173423 93 93 #endif 94 94 95 #if PLATFORM(COCOA) || USE(CFNETWORK)96 WEBCORE_EXPORT void setCertificateChain(CFArrayRef);97 WEBCORE_EXPORT RetainPtr<CFArrayRef> certificateChain() const;98 #endif99 100 95 bool platformResponseIsUpToDate() const { return m_platformResponseIsUpToDate; } 101 96 … … 105 100 void platformLazyInit(InitLevel); 106 101 String platformSuggestedFilename() const; 102 CertificateInfo platformCertificateInfo() const; 103 107 104 PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; } 108 105 void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { } … … 122 119 mutable RetainPtr<NSURLResponse> m_nsResponse; 123 120 #endif 124 #if PLATFORM(COCOA) || USE(CFNETWORK)125 // Certificate chain is normally part of NS/CFURLResponse, but there is no way to re-add it to a deserialized response after IPC.126 RetainPtr<CFArrayRef> m_externalCertificateChain;127 #endif128 121 }; 129 122 -
TabularUnified trunk/Source/WebCore/platform/network/mac/CertificateInfoMac.mm ¶
r160487 r173423 29 29 namespace WebCore { 30 30 31 CertificateInfo::CertificateInfo()32 {33 }34 35 CertificateInfo::CertificateInfo(const ResourceResponse& response)36 : m_certificateChain(response.certificateChain())37 {38 }39 40 CertificateInfo::CertificateInfo(CFArrayRef certificateChain)41 : m_certificateChain(certificateChain)42 {43 }44 45 31 #ifndef NDEBUG 46 32 void CertificateInfo::dump() const -
TabularUnified trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm ¶
r173360 r173423 173 173 } 174 174 175 CertificateInfo ResourceResponse::platformCertificateInfo() const 176 { 177 ASSERT(m_nsResponse); 178 return CertificateInfo(adoptCF(wkCopyNSURLResponseCertificateChain(m_nsResponse.get()))); 179 } 180 175 181 String ResourceResponse::platformSuggestedFilename() const 176 182 { … … 185 191 #endif // USE(CFNETWORK) 186 192 187 #if PLATFORM(COCOA) || USE(CFNETWORK)188 189 void ResourceResponse::setCertificateChain(CFArrayRef certificateChain)190 {191 ASSERT(!m_nsResponse || !wkCopyNSURLResponseCertificateChain(m_nsResponse.get()));192 m_externalCertificateChain = certificateChain;193 }194 195 RetainPtr<CFArrayRef> ResourceResponse::certificateChain() const196 {197 if (m_externalCertificateChain)198 return m_externalCertificateChain;199 200 return adoptCF(wkCopyNSURLResponseCertificateChain(nsURLResponse()));201 }202 203 #endif // PLATFORM(COCOA) || USE(CFNETWORK)204 205 193 } // namespace WebCore 206 194 -
TabularUnified trunk/Source/WebCore/platform/network/soup/ResourceResponse.h ¶
r173356 r173423 90 90 void doUpdateResourceResponse() { } 91 91 String platformSuggestedFilename() const; 92 CertificateInfo platformCertificateInfo() const; 92 93 93 94 PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; } -
TabularUnified trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp ¶
r173331 r173423 102 102 } 103 103 104 CertificateInfo ResourceResponse::platformCertificateInfo() const 105 { 106 return CertificateInfo(m_certificate.get(), m_tlsErrors); 107 } 108 104 109 String ResourceResponse::platformSuggestedFilename() const 105 110 { -
TabularUnified trunk/Source/WebKit2/ChangeLog ¶
r173420 r173423 1 2014-09-08 Antti Koivisto <antti@apple.com> 2 3 Pass certificate info as part of ResourceResponse 4 https://bugs.webkit.org/show_bug.cgi?id=136611 5 6 Reviewed by Darin Adler. 7 8 * NetworkProcess/NetworkResourceLoader.cpp: 9 (WebKit::NetworkResourceLoader::didReceiveResponseAsync): 10 11 Initialize the certificate info only if requested. 12 13 * WebProcess/Network/WebResourceLoader.cpp: 14 (WebKit::WebResourceLoader::didReceiveResponse): 15 (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo): Deleted. 16 17 Rename didReceiveResponseWithCertificateInfo -> didReceiveResponse as it is now part of the response. 18 19 * WebProcess/Network/WebResourceLoader.h: 20 * WebProcess/Network/WebResourceLoader.messages.in: 21 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 22 23 Request certificate info for the main resource only. 24 25 (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): 26 * WebProcess/WebPage/WebFrame.cpp: 27 (WebKit::WebFrame::certificateInfo): 28 1 29 2014-09-08 Shivakumar JM <shiva.jm@samsung.com> 2 30 -
TabularUnified trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp ¶
r173394 r173423 98 98 , m_isLoadingMainResource(parameters.isMainResource) 99 99 , m_defersLoading(parameters.defersLoading) 100 , m_needsCertificateInfo(parameters.needsCertificateInfo) 100 101 , m_maximumBufferingTime(parameters.maximumBufferingTime) 101 102 , m_bufferingTimer(this, &NetworkResourceLoader::bufferingTimerFired) … … 222 223 ASSERT_UNUSED(handle, handle == m_handle); 223 224 225 if (m_needsCertificateInfo) 226 response.includeCertificateInfo(); 227 224 228 if (isSynchronous()) 225 229 m_synchronousLoadData->m_response = response; 226 230 else 227 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse WithCertificateInfo(response, CertificateInfo(response), isLoadingMainResource()));231 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(response, isLoadingMainResource())); 228 232 229 233 // m_handle will be null if the request got aborted above. -
TabularUnified trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h ¶
r173394 r173423 194 194 bool m_isLoadingMainResource; 195 195 bool m_defersLoading; 196 bool m_needsCertificateInfo; 196 197 const std::chrono::milliseconds m_maximumBufferingTime; 197 198 -
TabularUnified trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp ¶
r173394 r173423 48 48 , isMainResource(false) 49 49 , defersLoading(false) 50 , needsCertificateInfo(false) 50 51 , maximumBufferingTime(0_ms) 51 52 { … … 96 97 encoder << isMainResource; 97 98 encoder << defersLoading; 99 encoder << needsCertificateInfo; 98 100 encoder << maximumBufferingTime; 99 101 } … … 147 149 if (!decoder.decode(result.defersLoading)) 148 150 return false; 151 if (!decoder.decode(result.needsCertificateInfo)) 152 return false; 149 153 if (!decoder.decode(result.maximumBufferingTime)) 150 154 return false; -
TabularUnified trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h ¶
r173394 r173423 64 64 bool isMainResource; 65 65 bool defersLoading; 66 bool needsCertificateInfo; 66 67 std::chrono::milliseconds maximumBufferingTime; 67 68 }; -
TabularUnified trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp ¶
r173420 r173423 174 174 loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource; 175 175 loadParameters.defersLoading = resourceLoader->defersLoading(); 176 loadParameters.needsCertificateInfo = loadParameters.isMainResource; 176 177 loadParameters.maximumBufferingTime = maximumBufferingTime(resource); 177 178 -
TabularUnified trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp ¶
r172191 r173423 103 103 } 104 104 105 void WebResourceLoader::didReceiveResponse WithCertificateInfo(const ResourceResponse& response, const CertificateInfo& certificateInfo, bool needsContinueDidReceiveResponseMessage)105 void WebResourceLoader::didReceiveResponse(const ResourceResponse& response, bool needsContinueDidReceiveResponseMessage) 106 106 { 107 107 LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResponseWithCertificateInfo for '%s'. Status %d.", m_coreLoader->url().string().utf8().data(), response.httpStatusCode()); … … 109 109 Ref<WebResourceLoader> protect(*this); 110 110 111 ResourceResponse responseCopy(response); 112 113 // FIXME: This should use CertificateInfo to avoid the platform ifdefs. See https://bugs.webkit.org/show_bug.cgi?id=124724. 114 #if PLATFORM(COCOA) 115 responseCopy.setCertificateChain(certificateInfo.certificateChain()); 116 #elif USE(SOUP) 117 responseCopy.setSoupMessageCertificate(certificateInfo.certificate()); 118 responseCopy.setSoupMessageTLSErrors(certificateInfo.tlsErrors()); 119 #endif 120 121 if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), responseCopy)) 111 if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), response)) 122 112 return; 123 113 … … 126 116 // converted resource isn't yet known. WebResourceLoaderQuickLookDelegate will later call didReceiveResponse upon 127 117 // receiving the converted data. 128 m_coreLoader->documentLoader()->setQuickLookHandle(QuickLookHandle::create(resourceLoader(), response Copy.nsURLResponse()));118 m_coreLoader->documentLoader()->setQuickLookHandle(QuickLookHandle::create(resourceLoader(), response.nsURLResponse())); 129 119 if (!m_coreLoader->documentLoader()->quickLookHandle()) 130 120 #endif 131 m_coreLoader->didReceiveResponse(response Copy);121 m_coreLoader->didReceiveResponse(response); 132 122 133 123 // If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function(). -
TabularUnified trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h ¶
r172191 r173423 81 81 void willSendRequest(const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); 82 82 void didSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent); 83 void didReceiveResponse WithCertificateInfo(const WebCore::ResourceResponse&, const WebCore::CertificateInfo&, bool needsContinueDidReceiveResponseMessage);83 void didReceiveResponse(const WebCore::ResourceResponse&, bool needsContinueDidReceiveResponseMessage); 84 84 void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength); 85 85 void didFinishResourceLoad(double finishTime); -
TabularUnified trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in ¶
r167894 r173423 27 27 CancelResourceLoader() 28 28 29 // FIXME (NetworkProcess): We'll need much more granularity for response messages.30 29 WillSendRequest(WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse) 31 30 DidSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent) 32 DidReceiveResponse WithCertificateInfo(WebCore::ResourceResponse response, WebCore::CertificateInfo certificateInfo, bool needsContinueDidReceiveResponseMessage)31 DidReceiveResponse(WebCore::ResourceResponse response, bool needsContinueDidReceiveResponseMessage) 33 32 DidReceiveData(IPC::DataReference data, int64_t encodedDataLength) 34 33 DidFinishResourceLoad(double finishTime) -
TabularUnified trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp ¶
r171826 r173423 456 456 // Notify the UIProcess. 457 457 458 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())));458 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()))); 459 459 webPage->didCommitLoad(m_frame); 460 460 } -
TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp ¶
r170774 r173423 418 418 return CertificateInfo(); 419 419 420 return CertificateInfo(documentLoader->response());420 return documentLoader->response().certificateInfo(); 421 421 } 422 422
Note:
See TracChangeset
for help on using the changeset viewer.