Changeset 122547 in webkit
- Timestamp:
- Jul 13, 2012 12:26:17 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 added
- 1 deleted
- 19 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r122491 r122547 1 2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to get HTTPS status to WebKit2 GTK+ 4 https://bugs.webkit.org/show_bug.cgi?id=91100 5 6 Reviewed by Martin Robinson. 7 8 Add support for GByteArray. 9 10 * wtf/gobject/GRefPtr.cpp: 11 (WTF::refGPtr): 12 (WTF): 13 (WTF::derefGPtr): 14 * wtf/gobject/GRefPtr.h: 15 (WTF): 16 * wtf/gobject/GTypedefs.h: 17 1 18 2012-07-12 Maciej Stachowiak <mjs@apple.com> 2 19 -
trunk/Source/WTF/wtf/gobject/GRefPtr.cpp
r115411 r122547 121 121 } 122 122 123 template <> GByteArray* refGPtr(GByteArray* ptr) 124 { 125 if (ptr) 126 g_byte_array_ref(ptr); 127 return ptr; 128 } 129 130 template <> void derefGPtr(GByteArray* ptr) 131 { 132 if (ptr) 133 g_byte_array_unref(ptr); 134 } 135 123 136 } // namespace WTF 124 137 -
trunk/Source/WTF/wtf/gobject/GRefPtr.h
r115411 r122547 211 211 template <> GPtrArray* refGPtr(GPtrArray*); 212 212 template <> void derefGPtr(GPtrArray*); 213 template <> GByteArray* refGPtr(GByteArray*); 214 template <> void derefGPtr(GByteArray*); 213 215 214 216 template <typename T> inline T* refGPtr(T* ptr) -
trunk/Source/WTF/wtf/gobject/GTypedefs.h
r115411 r122547 65 65 typedef struct _GKeyFile GKeyFile; 66 66 typedef struct _GPtrArray GPtrArray; 67 typedef struct _GByteArray GByteArray; 67 68 68 69 #if USE(CAIRO) -
trunk/Source/WebCore/ChangeLog
r122546 r122547 1 2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to get HTTPS status to WebKit2 GTK+ 4 https://bugs.webkit.org/show_bug.cgi?id=91100 5 6 Reviewed by Martin Robinson. 7 8 * platform/network/soup/ResourceResponse.h: 9 (WebCore::ResourceResponse::soupMessageCertificate): Return the 10 certificate. 11 (WebCore::ResourceResponse::setSoupMessageCertificate): Set a 12 certificate. 13 (WebCore::ResourceResponse::soupMessageTLSErrors): Return the TLS 14 errors. 15 (WebCore::ResourceResponse::setSoupMessageTLSErrors): Set TLS 16 errors. 17 * platform/network/soup/ResourceResponseSoup.cpp: 18 (WebCore::ResourceResponse::toSoupMessage): Set the certificate 19 and TLS errors to the newly created SoupMessage. 20 (WebCore::ResourceResponse::updateFromSoupMessage): Get the 21 certificate and TLS errors from the SoupMessage. 22 1 23 2012-07-13 Ryosuke Niwa <rniwa@webkit.org> 2 24 -
trunk/Source/WebCore/platform/network/soup/ResourceResponse.h
r104948 r122547 30 30 31 31 #include <libsoup/soup.h> 32 #include <wtf/gobject/GRefPtr.h> 32 33 33 34 namespace WebCore { … … 38 39 : ResourceResponseBase() 39 40 , m_soupFlags(static_cast<SoupMessageFlags>(0)) 41 , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) 40 42 { 41 43 } … … 44 46 : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) 45 47 , m_soupFlags(static_cast<SoupMessageFlags>(0)) 48 , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) 46 49 { 47 50 } … … 50 53 : ResourceResponseBase() 51 54 , m_soupFlags(static_cast<SoupMessageFlags>(0)) 55 , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) 52 56 { 53 57 updateFromSoupMessage(soupMessage); … … 63 67 void setSniffedContentType(const String& value) { m_sniffedContentType = value; } 64 68 69 GTlsCertificate* soupMessageCertificate() const { return m_certificate.get(); } 70 void setSoupMessageCertificate(GTlsCertificate* certificate) { m_certificate = certificate; } 71 72 GTlsCertificateFlags soupMessageTLSErrors() const { return m_tlsErrors; } 73 void setSoupMessageTLSErrors(GTlsCertificateFlags tlsErrors) { m_tlsErrors = tlsErrors; } 74 65 75 private: 66 76 friend class ResourceResponseBase; … … 68 78 SoupMessageFlags m_soupFlags; 69 79 String m_sniffedContentType; 80 GRefPtr<GTlsCertificate> m_certificate; 81 GTlsCertificateFlags m_tlsErrors; 70 82 71 83 void doUpdateResourceResponse() { } -
trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
r111354 r122547 52 52 soup_message_set_flags(soupMessage, m_soupFlags); 53 53 54 g_object_set(G_OBJECT(soupMessage), "tls-certificate", m_certificate.get(), "tls-errors", m_tlsErrors, NULL); 55 54 56 // Body data is not in the message. 55 57 return soupMessage; … … 85 87 setHTTPStatusText(soupMessage->reason_phrase); 86 88 setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition"))); 89 90 GTlsCertificate* certificate = 0; 91 soup_message_get_https_status(soupMessage, &certificate, &m_tlsErrors); 92 m_certificate = certificate; 87 93 } 88 94 -
trunk/Source/WebKit2/ChangeLog
r122542 r122547 1 2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to get HTTPS status to WebKit2 GTK+ 4 https://bugs.webkit.org/show_bug.cgi?id=91100 5 6 Reviewed by Martin Robinson. 7 8 Add webkit_uri_response_get_https_status() to return 9 GTlsCertificate and GTlsCertificateFlags with information about 10 the SSL certificate and the possible errors with the certificate. 11 12 * GNUmakefile.list.am: Add new files to compilation. 13 * PlatformEfl.cmake: Ditto. 14 * Shared/efl/PlatformCertificateInfo.h: Removed. 15 * Shared/soup/PlatformCertificateInfo.cpp: Added. 16 (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): 17 (WebKit::PlatformCertificateInfo::~PlatformCertificateInfo): 18 (WebKit::PlatformCertificateInfo::encode): Encode the 19 GTlsCertificate and GTlsCertificateFlags. 20 (WebKit::PlatformCertificateInfo::decode): Decode 21 PlatformCertificateInfo into a GTlsCertificate and GTlsCertificateFlags. 22 * Shared/soup/PlatformCertificateInfo.h: Renamed from Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h. 23 (WebKit::PlatformCertificateInfo::certificate): Return the certificate. 24 (WebKit::PlatformCertificateInfo::tlsErrors): Return the TLS errors 25 * UIProcess/API/gtk/WebKitLoaderClient.cpp: 26 (didCommitLoadForFrame): Set the certificate of the current frame 27 to the response of the main resource. 28 * UIProcess/API/gtk/WebKitURIResponse.cpp: 29 (webkit_uri_response_get_https_status): Return GTlsCertificate and 30 GTlsCertificateFlags. 31 (webkitURIResponseSetCertificateInfo): Update the internal 32 ResourceResponse with the GTlsCertificate and GTlsCertificateFlags 33 of the given PlatformCertificateInfo. 34 * UIProcess/API/gtk/WebKitURIResponse.h: 35 * UIProcess/API/gtk/WebKitURIResponsePrivate.h: 36 * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. 37 * UIProcess/API/gtk/tests/GNUmakefile.am: 38 * UIProcess/API/gtk/tests/TestMain.h: 39 (Test::getResourcesDir): Helper function to get the resources 40 directory of the WebKit2 API tests. 41 * UIProcess/API/gtk/tests/TestSSL.cpp: Added. 42 (testSSL): 43 (serverCallback): 44 (beforeAll): 45 (afterAll): 46 * UIProcess/API/gtk/tests/WebKitTestServer.cpp: 47 (WebKitTestServer::WebKitTestServer): Add support por SSL test 48 servers. 49 * UIProcess/API/gtk/tests/WebKitTestServer.h: 50 (WebKitTestServer): Add ssl parameter to create a HTTPS server. 51 * UIProcess/API/gtk/tests/resources/test-cert.pem: Added. 52 * UIProcess/API/gtk/tests/resources/test-key.pem: Added. 53 1 54 2012-07-12 Christophe Dumez <christophe.dumez@intel.com> 2 55 -
trunk/Source/WebKit2/GNUmakefile.list.am
r122425 r122547 371 371 Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp \ 372 372 Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp \ 373 Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \374 373 Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp \ 375 374 Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp \ … … 428 427 Source/WebKit2/Shared/StatisticsData.h \ 429 428 Source/WebKit2/Shared/StringPairVector.h \ 429 Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp \ 430 Source/WebKit2/Shared/soup/PlatformCertificateInfo.h \ 430 431 Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h \ 431 432 Source/WebKit2/Shared/TextCheckerState.h \ -
trunk/Source/WebKit2/PlatformEfl.cmake
r122512 r122547 27 27 Shared/efl/WebEventFactory.cpp 28 28 Shared/efl/WebCoreArgumentCodersEfl.cpp 29 30 Shared/soup/PlatformCertificateInfo.cpp 29 31 30 32 UIProcess/API/C/efl/WKView.cpp -
trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h
r122546 r122547 28 28 #define PlatformCertificateInfo_h 29 29 30 #include "ArgumentDecoder.h" 31 #include "ArgumentEncoder.h" 32 #include <WebCore/ResourceResponse.h> 30 #include <libsoup/soup.h> 31 #include <wtf/gobject/GRefPtr.h> 32 33 namespace CoreIPC { 34 class ArgumentDecoder; 35 class ArgumentEncoder; 36 } 37 38 namespace WebCore { 39 class ResourceResponse; 40 } 33 41 34 42 namespace WebKit { … … 36 44 class PlatformCertificateInfo { 37 45 public: 38 PlatformCertificateInfo() 39 {40 }46 PlatformCertificateInfo(); 47 explicit PlatformCertificateInfo(const WebCore::ResourceResponse&); 48 ~PlatformCertificateInfo(); 41 49 42 explicit PlatformCertificateInfo(const WebCore::ResourceResponse&) 43 { 44 } 50 GTlsCertificate* certificate() const { return m_certificate.get(); } 51 GTlsCertificateFlags tlsErrors() const { return m_tlsErrors; } 45 52 46 void encode(CoreIPC::ArgumentEncoder*) const 47 { 48 } 53 void encode(CoreIPC::ArgumentEncoder*) const; 54 static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&); 49 55 50 static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&) 51 { 52 return true; 53 } 56 private: 57 GRefPtr<GTlsCertificate> m_certificate; 58 GTlsCertificateFlags m_tlsErrors; 54 59 }; 55 60 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
r120301 r122547 23 23 24 24 #include "WebKitBackForwardListPrivate.h" 25 #include "WebKitURIResponsePrivate.h" 25 26 #include "WebKitWebViewBasePrivate.h" 26 27 #include "WebKitWebViewPrivate.h" … … 65 66 return; 66 67 67 webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED); 68 WebKitWebView* webView = WEBKIT_WEB_VIEW(clientInfo); 69 WebKitURIResponse* response = webkit_web_resource_get_response(webkit_web_view_get_main_resource(webView)); 70 webkitURIResponseSetCertificateInfo(response, WKFrameGetCertificateInfo(frame)); 71 72 webkitWebViewLoadChanged(webView, WEBKIT_LOAD_COMMITTED); 68 73 } 69 74 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
r118786 r122547 21 21 #include "WebKitURIResponse.h" 22 22 23 #include "PlatformCertificateInfo.h" 24 #include "WebCertificateInfo.h" 23 25 #include "WebKitPrivate.h" 24 26 #include "WebKitURIResponsePrivate.h" … … 35 37 }; 36 38 39 using namespace WebKit; 37 40 using namespace WebCore; 38 41 … … 203 206 } 204 207 208 /** 209 * webkit_uri_response_get_https_status: 210 * @response: a #WebKitURIResponse 211 * @certificate: (out) (transfer none): return location for a #GTlsCertificate 212 * @errors: (out): return location for a #GTlsCertificateFlags the verification status of @certificate 213 * 214 * Retrieves the #GTlsCertificate associated with the @response connection, 215 * and the #GTlsCertificateFlags showing what problems, if any, have been found 216 * with that certificate. 217 * If the response connection is not HTTPS, this function returns %FALSE. 218 * 219 * Returns: %TRUE if @response connection uses HTTPS or %FALSE otherwise. 220 */ 221 gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsCertificate** certificate, GTlsCertificateFlags* errors) 222 { 223 g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), FALSE); 224 225 if (certificate) 226 *certificate = response->priv->resourceResponse.soupMessageCertificate(); 227 if (errors) 228 *errors = response->priv->resourceResponse.soupMessageTLSErrors(); 229 230 return !!response->priv->resourceResponse.soupMessageCertificate(); 231 } 232 205 233 WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse) 206 234 { … … 214 242 return uriResponse->priv->resourceResponse; 215 243 } 244 245 void webkitURIResponseSetCertificateInfo(WebKitURIResponse* response, WKCertificateInfoRef wkCertificate) 246 { 247 const PlatformCertificateInfo& certificateInfo = toImpl(wkCertificate)->platformCertificateInfo(); 248 response->priv->resourceResponse.setSoupMessageCertificate(certificateInfo.certificate()); 249 response->priv->resourceResponse.setSoupMessageTLSErrors(certificateInfo.tlsErrors()); 250 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h
r118786 r122547 25 25 #define WebKitURIResponse_h 26 26 27 #include <g lib-object.h>27 #include <gio/gio.h> 28 28 #include <webkit2/WebKitDefines.h> 29 29 … … 57 57 58 58 WEBKIT_API const gchar * 59 webkit_uri_response_get_uri (WebKitURIResponse *response);59 webkit_uri_response_get_uri (WebKitURIResponse *response); 60 60 61 61 WEBKIT_API guint 62 webkit_uri_response_get_status_code (WebKitURIResponse *response);62 webkit_uri_response_get_status_code (WebKitURIResponse *response); 63 63 64 64 WEBKIT_API guint64 65 webkit_uri_response_get_content_length (WebKitURIResponse *response);65 webkit_uri_response_get_content_length (WebKitURIResponse *response); 66 66 67 67 WEBKIT_API const gchar * 68 webkit_uri_response_get_mime_type (WebKitURIResponse *response); 68 webkit_uri_response_get_mime_type (WebKitURIResponse *response); 69 70 WEBKIT_API gboolean 71 webkit_uri_response_get_https_status (WebKitURIResponse *response, 72 GTlsCertificate **certificate, 73 GTlsCertificateFlags *errors); 69 74 70 75 G_END_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
r104850 r122547 32 32 WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse&); 33 33 const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse*); 34 void webkitURIResponseSetCertificateInfo(WebKitURIResponse*, WKCertificateInfoRef); 34 35 35 36 #endif // WebKitURIResponsePrivate_h -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
r122425 r122547 316 316 webkit_uri_response_get_content_length 317 317 webkit_uri_response_get_mime_type 318 webkit_uri_response_get_https_status 318 319 319 320 <SUBSECTION Standard> -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
r121093 r122547 10 10 Programs/WebKit2APITests/TestPrinting \ 11 11 Programs/WebKit2APITests/TestResources \ 12 Programs/WebKit2APITests/TestSSL \ 12 13 Programs/WebKit2APITests/TestWebKitVersion \ 13 14 Programs/WebKit2APITests/TestWebKitFindController \ … … 175 176 Programs_WebKit2APITests_TestContextMenu_LDFLAGS = $(webkit2_tests_ldflags) 176 177 178 Programs_WebKit2APITests_TestSSL_SOURCES = \ 179 Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp 180 Programs_WebKit2APITests_TestSSL_CPPFLAGS = $(webkit2_tests_cppflags) 181 Programs_WebKit2APITests_TestSSL_LDADD = $(webkit2_tests_ldadd) 182 Programs_WebKit2APITests_TestSSL_LDFLAGS = $(webkit2_tests_ldflags) 183 177 184 endif # ENABLE_WEBKIT2 -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h
r121093 r122547 76 76 } 77 77 78 static CString getResourcesDir() 79 { 80 GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit2", "UIProcess", "API", "gtk", "tests", "resources", NULL)); 81 return resourcesDir.get(); 82 } 83 78 84 void addLogFatalFlag(unsigned flag) 79 85 { -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.cpp
r97366 r122547 21 21 #include "WebKitTestServer.h" 22 22 23 #include "TestMain.h" 23 24 #include <wtf/gobject/GOwnPtr.h> 24 25 25 WebKitTestServer::WebKitTestServer() 26 : m_soupServer(adoptGRef(soup_server_new(SOUP_SERVER_PORT, 0, NULL))) 27 , m_baseURI(soup_uri_new("http://127.0.0.1/")) 26 WebKitTestServer::WebKitTestServer(ServerType type) 28 27 { 28 GOwnPtr<char> sslCertificateFile; 29 GOwnPtr<char> sslKeyFile; 30 if (type == ServerHTTPS) { 31 CString resourcesDir = Test::getResourcesDir(); 32 sslCertificateFile.set(g_build_filename(resourcesDir.data(), "test-cert.pem", NULL)); 33 sslKeyFile.set(g_build_filename(resourcesDir.data(), "test-key.pem", NULL)); 34 } 35 36 GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT)); 37 soup_address_resolve_sync(address.get(), 0); 38 39 m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_INTERFACE, address.get(), 40 SOUP_SERVER_SSL_CERT_FILE, sslCertificateFile.get(), 41 SOUP_SERVER_SSL_KEY_FILE, sslKeyFile.get(), NULL)); 42 m_baseURI = type == ServerHTTPS ? soup_uri_new("https://127.0.0.1/") : soup_uri_new("http://127.0.0.1/"); 29 43 soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer.get())); 30 44 } -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebKitTestServer.h
r97366 r122547 28 28 class WebKitTestServer { 29 29 public: 30 WebKitTestServer(); 30 31 enum ServerType { 32 ServerHTTP, 33 ServerHTTPS 34 }; 35 36 WebKitTestServer(ServerType type = ServerHTTP); 31 37 virtual ~WebKitTestServer(); 32 38
Note: See TracChangeset
for help on using the changeset viewer.