Browser applications can get error code for verification by using WKCertificateInfoGetVerificationError but just displaying error code is inconvinient for users. In this ticket we will add an API to provide error description and make MiniBrowser display error description when it accesses sites which have invalid certs.
Created attachment 393229 [details] Patch
(In reply to Takashi Komori from comment #1) > Created attachment 393229 [details] > Patch Added test only tests the situation the error code is 0 (V509_V_OK). This is because we can't set an arbitrary error code without connecting servers for now. We will improve tests for this patch after establishing a method for testing bad certs in another ticket ( https://bugs.webkit.org/show_bug.cgi?id=208806 ).
Comment on attachment 393229 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393229&action=review > Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:369 > + auto certificateInfo = WKProtectionSpaceCopyCertificateInfo(protectionSpace); Don't remove `adoptWK`. It will leak. > Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:371 > + auto description = WKCertificateInfoCopyVerificationErrorDescription(certificateInfo); Use adoptWK for the return value of *Copy* API. It will leak. > Tools/TestWebKitAPI/Tests/WebKit/curl/Certificates.cpp:93 > + ASSERT_TRUE(WKStringIsEqualToUTF8CString(WKCertificateInfoCopyVerificationErrorDescription(certificateInfo.get()), "ok")); The return value of WKCertificateInfoCopyVerificationErrorDescription leaks.
You added a new WK2 API. Added WK2 owners in CC.
Created attachment 393965 [details] Patch
(In reply to Fujii Hironori from comment #3) > Comment on attachment 393229 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393229&action=review > > > Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:369 > > + auto certificateInfo = WKProtectionSpaceCopyCertificateInfo(protectionSpace); > > Don't remove `adoptWK`. It will leak. Fixed. > > > Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:371 > > + auto description = WKCertificateInfoCopyVerificationErrorDescription(certificateInfo); > > Use adoptWK for the return value of *Copy* API. It will leak. Fixed. > > > Tools/TestWebKitAPI/Tests/WebKit/curl/Certificates.cpp:93 > > + ASSERT_TRUE(WKStringIsEqualToUTF8CString(WKCertificateInfoCopyVerificationErrorDescription(certificateInfo.get()), "ok")); > > The return value of WKCertificateInfoCopyVerificationErrorDescription leaks. Fixed.
New API looks ok to me
Committed r258728: <https://trac.webkit.org/changeset/258728> All reviewed patches have been landed. Closing bug and clearing flags on attachment 393965 [details].
<rdar://problem/60651795>