Changeset 143341 in webkit
- Timestamp:
- Feb 19, 2013 8:50:36 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r143339 r143341 1 2013-02-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Move the API to get TLS certificate from WebKitURIResponse to WebKitWebView 4 https://bugs.webkit.org/show_bug.cgi?id=110190 5 6 Reviewed by Anders Carlsson. 7 8 Add webkit_web_view_get_tls_info() and remove 9 webkit_uri_response_get_https_status(). This way I can be sure 10 that when called after load has been committed the certificate 11 will be available. It also makes the API easier to use. 12 13 * UIProcess/API/gtk/WebKitURIResponse.cpp: 14 * UIProcess/API/gtk/WebKitURIResponse.h: 15 * UIProcess/API/gtk/WebKitURIResponsePrivate.h: 16 * UIProcess/API/gtk/WebKitWebView.cpp: 17 (webkitWebViewLoadChanged): 18 (mainResourceResponseChangedCallback): 19 (webkit_web_view_get_tls_info): 20 * UIProcess/API/gtk/WebKitWebView.h: 21 * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: 22 * UIProcess/API/gtk/tests/TestSSL.cpp: 23 1 24 2013-02-19 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 25 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
r137469 r143341 21 21 #include "WebKitURIResponse.h" 22 22 23 #include "PlatformCertificateInfo.h"24 #include "WebCertificateInfo.h"25 23 #include "WebKitPrivate.h" 26 24 #include "WebKitURIResponsePrivate.h" … … 219 217 220 218 /** 221 * webkit_uri_response_get_https_status:222 * @response: a #WebKitURIResponse223 * @certificate: (out) (transfer none): return location for a #GTlsCertificate224 * @errors: (out): return location for a #GTlsCertificateFlags the verification status of @certificate225 *226 * Retrieves the #GTlsCertificate associated with the @response connection,227 * and the #GTlsCertificateFlags showing what problems, if any, have been found228 * with that certificate.229 * If the response connection is not HTTPS, this function returns %FALSE.230 *231 * Returns: %TRUE if @response connection uses HTTPS or %FALSE otherwise.232 */233 gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsCertificate** certificate, GTlsCertificateFlags* errors)234 {235 g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), FALSE);236 237 if (certificate)238 *certificate = response->priv->resourceResponse.soupMessageCertificate();239 if (errors)240 *errors = response->priv->resourceResponse.soupMessageTLSErrors();241 242 return !!response->priv->resourceResponse.soupMessageCertificate();243 }244 245 /**246 219 * webkit_uri_response_get_suggested_filename: 247 220 * @response: a #WebKitURIResponse … … 277 250 } 278 251 279 void webkitURIResponseSetCertificateInfo(WebKitURIResponse* response, WebCertificateInfo* certificate)280 {281 const PlatformCertificateInfo& certificateInfo = certificate->platformCertificateInfo();282 response->priv->resourceResponse.setSoupMessageCertificate(certificateInfo.certificate());283 response->priv->resourceResponse.setSoupMessageTLSErrors(certificateInfo.tlsErrors());284 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
r125910 r143341 68 68 webkit_uri_response_get_mime_type (WebKitURIResponse *response); 69 69 70 WEBKIT_API gboolean71 webkit_uri_response_get_https_status (WebKitURIResponse *response,72 GTlsCertificate **certificate,73 GTlsCertificateFlags *errors);74 70 WEBKIT_API const gchar * 75 71 webkit_uri_response_get_suggested_filename (WebKitURIResponse *response); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
r141096 r143341 27 27 #define WebKitURIResponsePrivate_h 28 28 29 #include "WebCertificateInfo.h"30 29 #include "WebKitURIResponse.h" 31 30 #include <WebCore/ResourceResponse.h> … … 33 32 WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse&); 34 33 const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse*); 35 void webkitURIResponseSetCertificateInfo(WebKitURIResponse*, WebKit::WebCertificateInfo*);36 34 37 35 #endif // WebKitURIResponsePrivate_h -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r143302 r143341 22 22 #include "WebKitWebView.h" 23 23 24 #include "PlatformCertificateInfo.h" 25 #include "WebCertificateInfo.h" 24 26 #include "WebContextMenuItem.h" 25 27 #include "WebContextMenuItemData.h" … … 1309 1311 } 1310 1312 1311 static void setCertificateToMainResource(WebKitWebView* webView)1312 {1313 WebKitWebViewPrivate* priv = webView->priv;1314 ASSERT(priv->mainResource.get());1315 1316 webkitURIResponseSetCertificateInfo(webkit_web_resource_get_response(priv->mainResource.get()),1317 webkitWebResourceGetFrame(priv->mainResource.get())->certificateInfo());1318 }1319 1320 1313 static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) 1321 1314 { … … 1368 1361 // load-changed signal until main resource object has been created. 1369 1362 priv->waitingForMainResource = true; 1370 } else 1371 setCertificateToMainResource(webView); 1363 } 1372 1364 } 1373 1365 … … 1528 1520 { 1529 1521 webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView); 1530 setCertificateToMainResource(webView);1531 1522 webkitWebViewEmitDelayedLoadEvents(webView); 1532 1523 } … … 2898 2889 return webView->priv->viewMode; 2899 2890 } 2891 2892 /** 2893 * webkit_web_view_get_tls_info: 2894 * @web_view: a #WebKitWebView 2895 * @certificate: (out) (transfer none): return location for a #GTlsCertificate 2896 * @errors: (out): return location for a #GTlsCertificateFlags the verification status of @certificate 2897 * 2898 * Retrieves the #GTlsCertificate associated with the @web_view connection, 2899 * and the #GTlsCertificateFlags showing what problems, if any, have been found 2900 * with that certificate. 2901 * If the connection is not HTTPS, this function returns %FALSE. 2902 * This function should be called after a response has been received from the 2903 * server, so you can connect to #WebKitWebView::load-changed and call this function 2904 * when it's emitted with %WEBKIT_LOAD_COMMITTED event. 2905 * 2906 * Returns: %TRUE if the @web_view connection uses HTTPS and a response has been received 2907 * from the server, or %FALSE otherwise. 2908 */ 2909 gboolean webkit_web_view_get_tls_info(WebKitWebView* webView, GTlsCertificate** certificate, GTlsCertificateFlags* errors) 2910 { 2911 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 2912 2913 WebFrameProxy* mainFrame = getPage(webView)->mainFrame(); 2914 if (!mainFrame) 2915 return FALSE; 2916 2917 const PlatformCertificateInfo& certificateInfo = mainFrame->certificateInfo()->platformCertificateInfo(); 2918 if (certificate) 2919 *certificate = certificateInfo.certificate(); 2920 if (errors) 2921 *errors = certificateInfo.tlsErrors(); 2922 2923 return !!certificateInfo.certificate(); 2924 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
r143302 r143341 415 415 webkit_web_view_get_view_mode (WebKitWebView *web_view); 416 416 417 WEBKIT_API gboolean 418 webkit_web_view_get_tls_info (WebKitWebView *web_view, 419 GTlsCertificate **certificate, 420 GTlsCertificateFlags *errors); 421 417 422 G_END_DECLS 418 423 -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
r143302 r143341 134 134 webkit_web_view_set_view_mode 135 135 webkit_web_view_get_view_mode 136 webkit_web_view_get_tls_info 136 137 137 138 <SUBSECTION WebKitJavascriptResult> … … 352 353 webkit_uri_response_get_content_length 353 354 webkit_uri_response_get_mime_type 354 webkit_uri_response_get_https_status355 355 webkit_uri_response_get_suggested_filename 356 356 -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp
r138273 r143341 47 47 virtual void loadCommitted() 48 48 { 49 WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView);50 g_assert(resource);51 WebKitURIResponse* response = webkit_web_resource_get_response(resource);52 g_assert(response);53 54 49 GTlsCertificate* certificate = 0; 55 webkit_ uri_response_get_https_status(response, &certificate, &m_tlsErrors);50 webkit_web_view_get_tls_info(m_webView, &certificate, &m_tlsErrors); 56 51 m_certificate = certificate; 57 52 LoadTrackingTest::loadCommitted();
Note: See TracChangeset
for help on using the changeset viewer.