Diff
Modified: trunk/Source/WebCore/ChangeLog (138272 => 138273)
--- trunk/Source/WebCore/ChangeLog 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebCore/ChangeLog 2012-12-20 18:42:13 UTC (rev 138273)
@@ -1,3 +1,21 @@
+2012-12-20 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Add API to set a TLS errors policy to WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=104482
+
+ Reviewed by Martin Robinson.
+
+ * platform/network/soup/ResourceError.h:
+ (WebCore::ResourceError::setTLSErrors): Set the TLS error flags.
+ (WebCore::ResourceError::setCertificate): Set the certificate.
+ * platform/network/soup/ResourceErrorSoup.cpp:
+ (WebCore::ResourceError::tlsError): Set the given TLS errors and
+ certificate to the ResourceError.
+ (WebCore::ResourceError::platformCopy): Copy also the TLS errors
+ and the certificate.
+ (WebCore::ResourceError::platformCompare): Compare also the TLS
+ errors.
+
2012-12-20 Antoine Quint <grao...@apple.com>
onload callback for <track> element attached to <video> does not fire
Modified: trunk/Source/WebCore/platform/network/soup/ResourceError.h (138272 => 138273)
--- trunk/Source/WebCore/platform/network/soup/ResourceError.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebCore/platform/network/soup/ResourceError.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -56,9 +56,14 @@
static ResourceError authenticationError(SoupMessage*);
unsigned tlsErrors() const { return m_tlsErrors; }
+ void setTLSErrors(unsigned tlsErrors) { m_tlsErrors = tlsErrors; }
GTlsCertificate* certificate() const { return m_certificate.get(); }
+ void setCertificate(GTlsCertificate* certificate) { m_certificate = certificate; }
private:
+ void platformCopy(ResourceError&) const;
+ static bool platformCompare(const ResourceError& a, const ResourceError& b);
+
unsigned m_tlsErrors;
GRefPtr<GTlsCertificate> m_certificate;
};
Modified: trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp (138272 => 138273)
--- trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -69,10 +69,13 @@
failingURI(request), String::fromUTF8(error->message));
}
-ResourceError ResourceError::tlsError(SoupRequest* request, unsigned /* tlsErrors */, GTlsCertificate*)
+ResourceError ResourceError::tlsError(SoupRequest* request, unsigned tlsErrors, GTlsCertificate* certificate)
{
- return ResourceError(g_quark_to_string(SOUP_HTTP_ERROR), SOUP_STATUS_SSL_FAILED,
+ ResourceError resourceError(g_quark_to_string(SOUP_HTTP_ERROR), SOUP_STATUS_SSL_FAILED,
failingURI(request), unacceptableTLSCertificate());
+ resourceError.setTLSErrors(tlsErrors);
+ resourceError.setCertificate(certificate);
+ return resourceError;
}
ResourceError ResourceError::timeoutError(const String& failingURL)
@@ -88,4 +91,15 @@
return error;
}
+void ResourceError::platformCopy(ResourceError& errorCopy) const
+{
+ errorCopy.m_certificate = m_certificate;
+ errorCopy.m_tlsErrors = m_tlsErrors;
+}
+
+bool ResourceError::platformCompare(const ResourceError& a, const ResourceError& b)
+{
+ return a.tlsErrors() == b.tlsErrors();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebKit2/ChangeLog (138272 => 138273)
--- trunk/Source/WebKit2/ChangeLog 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-20 18:42:13 UTC (rev 138273)
@@ -1,3 +1,79 @@
+2012-12-20 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Add API to set a TLS errors policy to WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=104482
+
+ Reviewed by Martin Robinson.
+
+ Add an emum for TLS errors policy with values IGNORE and FAIL and
+ API to WebKitWebContext to set/get the policy.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode): Encode ignoreTLSErrors.
+ (WebKit::WebProcessCreationParameters::decode): Decode ignoreTLSErrors.
+ * Shared/WebProcessCreationParameters.h:
+ (WebProcessCreationParameters): Add ignoreTLSErrors when building
+ with soup network backend.
+ * Shared/soup/PlatformCertificateInfo.cpp:
+ (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): Add a
+ constructor that receives a ResourceError.
+ * Shared/soup/PlatformCertificateInfo.h:
+ * Shared/soup/WebCoreArgumentCodersSoup.cpp:
+ (CoreIPC::::encodePlatformData): Encode the
+ PlatformCertificateInfo as part for the ResourceError.
+ (CoreIPC::::decodePlatformData): Decode the
+ PlatformCertificateInfo and set certificate and TLS errors in the
+ ResourceError.
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp:
+ (didFailProvisionalLoadWithErrorForFrame): Call
+ webkitWebViewLoadFailedWithTLSErrors() if the load failed due to
+ TLS errors.
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (_WebKitWebContextPrivate): Add tlsErrorsPolicy member.
+ (createDefaultWebContext): Initiales tlsErrorsPolicy.
+ (webkit_web_context_set_tls_errors_policy): Set the TLS errors
+ policy notify WebContext to ignore TLS errors or not.
+ (webkit_web_context_get_tls_errors_policy): Return the current TLS
+ errors policy.
+ * UIProcess/API/gtk/WebKitWebContext.h:
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewLoadFailedWithTLSErrors): Finish the load with an
+ error if the TLS errors policy is FAIL.
+ * UIProcess/API/gtk/WebKitWebViewPrivate.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
+ * UIProcess/API/gtk/tests/TestSSL.cpp:
+ (testTLSErrorsPolicy):
+ (beforeAll):
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::WebContext): Initialize m_ignoreTLSErrors.
+ * UIProcess/WebContext.h:
+ (WebContext): Add m_ignoreTLSErrors member.
+ (WebKit::WebContext::ignoreTLSErrors): Return m_ignoreTLSErrors.
+ * UIProcess/efl/WebContextEfl.cpp:
+ (WebKit::WebContext::platformInitializeWebProcess): Set
+ ignoreTLSErrors parameter.
+ (WebKit::WebContext::setIgnoreTLSErrors): Send SetIgnoreTLSErrors
+ message to the web process.
+ * UIProcess/gtk/WebContextGtk.cpp:
+ (WebKit::WebContext::platformInitializeWebProcess): Set
+ ignoreTLSErrors parameter.
+ (WebKit::WebContext::setIgnoreTLSErrors): Send SetIgnoreTLSErrors
+ message to the web process.
+ (WebKit):
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ * WebProcess/efl/WebProcessMainEfl.cpp:
+ (WebKit::WebProcessMainEfl): Remove the call to
+ ResourceHandle::setIgnoreSSLErrors().
+ * WebProcess/gtk/WebProcessMainGtk.cpp:
+ (WebKit::WebProcessMainGtk): Remove the call to
+ ResourceHandle::setIgnoreSSLErrors().
+ * WebProcess/soup/WebProcessSoup.cpp:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ (WebKit::WebProcess::setIgnoreTLSErrors): Call
+ ResourceHandle::setIgnoreSSLErrors().
+ (WebKit):
+
2012-12-20 Dominik Röttsches <dominik.rottsc...@intel.com>
[EFL] MiniBrowser does not play Infinite Gangnam Style
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (138272 => 138273)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -81,6 +81,7 @@
encoder << cookiePersistentStoragePath;
encoder << cookiePersistentStorageType;
encoder.encodeEnum(cookieAcceptPolicy);
+ encoder << ignoreTLSErrors;
#endif
encoder.encodeEnum(cacheModel);
encoder << shouldTrackVisitedLinks;
@@ -179,8 +180,10 @@
return false;
if (!decoder->decode(parameters.cookiePersistentStorageType))
return false;
- if (!decoder->decode(parameters.cookieAcceptPolicy))
+ if (!decoder->decodeEnum(parameters.cookieAcceptPolicy))
return false;
+ if (!decoder->decode(parameters.ignoreTLSErrors))
+ return false;
#endif
if (!decoder->decodeEnum(parameters.cacheModel))
return false;
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (138272 => 138273)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -84,6 +84,7 @@
String cookiePersistentStoragePath;
uint32_t cookiePersistentStorageType;
HTTPCookieAcceptPolicy cookieAcceptPolicy;
+ bool ignoreTLSErrors;
#endif
CacheModel cacheModel;
Modified: trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp (138272 => 138273)
--- trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -29,6 +29,7 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
#include "DataReference.h"
+#include <WebCore/ResourceError.h>
#include <WebCore/ResourceResponse.h>
#include <libsoup/soup.h>
@@ -47,6 +48,12 @@
{
}
+PlatformCertificateInfo::PlatformCertificateInfo(const ResourceError& resourceError)
+ : m_certificate(resourceError.certificate())
+ , m_tlsErrors(static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()))
+{
+}
+
PlatformCertificateInfo::~PlatformCertificateInfo()
{
}
Modified: trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h (138272 => 138273)
--- trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/Shared/soup/PlatformCertificateInfo.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -36,6 +36,7 @@
}
namespace WebCore {
+class ResourceError;
class ResourceResponse;
}
@@ -45,6 +46,7 @@
public:
PlatformCertificateInfo();
explicit PlatformCertificateInfo(const WebCore::ResourceResponse&);
+ explicit PlatformCertificateInfo(const WebCore::ResourceError&);
~PlatformCertificateInfo();
GTlsCertificate* certificate() const { return m_certificate.get(); }
Modified: trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (138272 => 138273)
--- trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -27,12 +27,14 @@
#include "config.h"
#include "WebCoreArgumentCoders.h"
+#include "PlatformCertificateInfo.h"
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/ResourceResponse.h>
#include <wtf/text/CString.h>
using namespace WebCore;
+using namespace WebKit;
namespace CoreIPC {
@@ -66,12 +68,19 @@
}
-void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder&, const ResourceError&)
+void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError)
{
+ encoder << PlatformCertificateInfo(resourceError);
}
-bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder*, ResourceError&)
+bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError)
{
+ PlatformCertificateInfo certificateInfo;
+ if (!decoder->decode(certificateInfo))
+ return false;
+
+ resourceError.setCertificate(certificateInfo.certificate());
+ resourceError.setTLSErrors(certificateInfo.tlsErrors());
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -57,8 +57,11 @@
GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
resourceError.errorCode(),
resourceError.localizedDescription().utf8().data()));
- webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED,
- resourceError.failingURL().utf8().data(), webError.get());
+ if (resourceError.tlsErrors()) {
+ webkitWebViewLoadFailedWithTLSErrors(WEBKIT_WEB_VIEW(clientInfo), resourceError.failingURL().utf8().data(), webError.get(),
+ static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()), resourceError.certificate());
+ } else
+ webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED, resourceError.failingURL().utf8().data(), webError.get());
}
static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -136,6 +136,7 @@
OwnPtr<WebKitTextChecker> textChecker;
#endif
CString faviconDatabaseDirectory;
+ WebKitTLSErrorsPolicy tlsErrorsPolicy;
};
static guint signals[LAST_SIGNAL] = { 0, };
@@ -171,6 +172,7 @@
priv->context = WebContext::create(String());
priv->requestManager = webContext->priv->context->soupRequestManagerProxy();
priv->context->setCacheModel(CacheModelPrimaryWebBrowser);
+ priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_IGNORE;
attachDownloadClientToContext(webContext.get());
attachRequestManagerClientToContext(webContext.get());
@@ -694,6 +696,41 @@
WebCore::languageDidChange();
}
+/**
+ * webkit_web_context_set_tls_errors_policy:
+ * @context: a #WebKitWebContext
+ * @policy: a #WebKitTLSErrorsPolicy
+ *
+ * Set the TLS errors policy of @context as @policy
+ */
+void webkit_web_context_set_tls_errors_policy(WebKitWebContext* context, WebKitTLSErrorsPolicy policy)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
+
+ if (context->priv->tlsErrorsPolicy == policy)
+ return;
+
+ context->priv->tlsErrorsPolicy = policy;
+ bool ignoreTLSErrors = policy == WEBKIT_TLS_ERRORS_POLICY_IGNORE;
+ if (context->priv->context->ignoreTLSErrors() != ignoreTLSErrors)
+ context->priv->context->setIgnoreTLSErrors(ignoreTLSErrors);
+}
+
+/**
+ * webkit_web_context_get_tls_errors_policy:
+ * @context: a #WebKitWebContext
+ *
+ * Get the TLS errors policy of @context
+ *
+ * Returns: a #WebKitTLSErrorsPolicy
+ */
+WebKitTLSErrorsPolicy webkit_web_context_get_tls_errors_policy(WebKitWebContext* context)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_TLS_ERRORS_POLICY_IGNORE);
+
+ return context->priv->tlsErrorsPolicy;
+}
+
WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy)
{
GRefPtr<WebKitDownload> download = downloadsMap().get(downloadProxy);
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -62,6 +62,18 @@
} WebKitCacheModel;
/**
+ * WebKitTLSErrorsPolicy:
+ * @WEBKIT_TLS_ERRORS_POLICY_IGNORE: Ignore TLS errors.
+ * @WEBKIT_TLS_ERRORS_POLICY_FAIL: TLS errors make the load to finish with an error.
+ *
+ * Enum values used to denote the TLS errors policy.
+ */
+typedef enum {
+ WEBKIT_TLS_ERRORS_POLICY_IGNORE,
+ WEBKIT_TLS_ERRORS_POLICY_FAIL
+} WebKitTLSErrorsPolicy;
+
+/**
* WebKitURISchemeRequestCallback:
* @request: the #WebKitURISchemeRequest
* @user_data: user data passed to the callback
@@ -165,6 +177,13 @@
webkit_web_context_set_preferred_languages (WebKitWebContext *context,
const gchar * const *languages);
+WEBKIT_API void
+webkit_web_context_set_tls_errors_policy (WebKitWebContext *context,
+ WebKitTLSErrorsPolicy policy);
+
+WEBKIT_API WebKitTLSErrorsPolicy
+webkit_web_context_get_tls_errors_policy (WebKitWebContext *context);
+
G_END_DECLS
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -1366,6 +1366,19 @@
g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
}
+void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView* webView, const char* failingURI, GError *error, GTlsCertificateFlags tlsErrors, GTlsCertificate* certificate)
+{
+ webkitWebViewSetIsLoading(webView, false);
+
+ WebKitTLSErrorsPolicy tlsErrorsPolicy = webkit_web_context_get_tls_errors_policy(webView->priv->context);
+ if (tlsErrorsPolicy == WEBKIT_TLS_ERRORS_POLICY_FAIL) {
+ webkitWebViewLoadFailed(webView, WEBKIT_LOAD_STARTED, failingURI, error);
+ return;
+ }
+
+ g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
+}
+
void webkitWebViewSetTitle(WebKitWebView* webView, const CString& title)
{
WebKitWebViewPrivate* priv = webView->priv;
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -32,6 +32,7 @@
void webkitWebViewLoadChanged(WebKitWebView*, WebKitLoadEvent);
void webkitWebViewLoadFailed(WebKitWebView*, WebKitLoadEvent, const char* failingURI, GError*);
+void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView*, const char* failingURI, GError *, GTlsCertificateFlags, GTlsCertificate*);
void webkitWebViewSetEstimatedLoadProgress(WebKitWebView*, double estimatedLoadProgress);
void webkitWebViewSetTitle(WebKitWebView*, const CString&);
void webkitWebViewUpdateURI(WebKitWebView*);
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt 2012-12-20 18:42:13 UTC (rev 138273)
@@ -24,6 +24,7 @@
<TITLE>WebKitWebContext</TITLE>
WebKitWebContext
WebKitCacheModel
+WebKitTLSErrorsPolicy
webkit_web_context_get_default
webkit_web_context_get_cache_model
webkit_web_context_set_cache_model
@@ -42,6 +43,8 @@
webkit_web_context_get_spell_checking_languages
webkit_web_context_set_spell_checking_languages
webkit_web_context_set_preferred_languages
+webkit_web_context_set_tls_errors_policy
+webkit_web_context_get_tls_errors_policy
<SUBSECTION URI Scheme>
WebKitURISchemeRequestCallback
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestSSL.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -38,6 +38,12 @@
{
}
+ virtual void provisionalLoadFailed(const gchar* failingURI, GError* error)
+ {
+ g_assert_error(error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED);
+ LoadTrackingTest::provisionalLoadFailed(failingURI, error);
+ }
+
virtual void loadCommitted()
{
WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView);
@@ -48,6 +54,7 @@
GTlsCertificate* certificate = 0;
webkit_uri_response_get_https_status(response, &certificate, &m_tlsErrors);
m_certificate = certificate;
+ LoadTrackingTest::loadCommitted();
}
void waitUntilLoadFinished()
@@ -113,6 +120,23 @@
g_assert(test->m_insecureContentDisplayed);
}
+static void testTLSErrorsPolicy(SSLTest* test, gconstpointer)
+{
+ WebKitWebContext* context = webkit_web_view_get_context(test->m_webView);
+ // TLS errors are ignored by default.
+ g_assert(webkit_web_context_get_tls_errors_policy(context) == WEBKIT_TLS_ERRORS_POLICY_IGNORE);
+ test->loadURI(kHttpsServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ g_assert(!test->m_loadFailed);
+
+ webkit_web_context_set_tls_errors_policy(context, WEBKIT_TLS_ERRORS_POLICY_FAIL);
+ test->loadURI(kHttpsServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ g_assert(test->m_loadFailed);
+ g_assert(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
+ g_assert(!test->m_loadEvents.contains(LoadTrackingTest::LoadCommitted));
+}
+
static void httpsServerCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
{
if (message->method != SOUP_METHOD_GET) {
@@ -172,6 +196,7 @@
SSLTest::add("WebKitWebView", "ssl", testSSL);
InsecureContentTest::add("WebKitWebView", "insecure-content", testInsecureContent);
+ SSLTest::add("WebKitWebContext", "tls-errors-policy", testTLSErrorsPolicy);
}
void afterAll()
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -142,6 +142,9 @@
#if ENABLE(NETWORK_PROCESS)
, m_usesNetworkProcess(false)
#endif
+#if USE(SOUP)
+ , m_ignoreTLSErrors(true)
+#endif
{
platformInitialize();
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -282,6 +282,11 @@
static void willStartUsingPrivateBrowsing();
static void willStopUsingPrivateBrowsing();
+#if USE(SOUP)
+ void setIgnoreTLSErrors(bool);
+ bool ignoreTLSErrors() const { return m_ignoreTLSErrors; }
+#endif
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
void platformInitialize();
@@ -463,6 +468,10 @@
#if PLATFORM(MAC)
static bool s_applicationIsOccluded;
#endif
+
+#if USE(SOUP)
+ bool m_ignoreTLSErrors;
+#endif
};
template<typename U> inline void WebContext::sendToAllProcesses(const U& message)
Modified: trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -30,6 +30,7 @@
#include "Logging.h"
#include "WebInspectorServer.h"
#include "WebProcessCreationParameters.h"
+#include "WebProcessMessages.h"
#include "WebSoupRequestManagerProxy.h"
#include <Efreet.h>
#include <WebCore/ApplicationCacheStorage.h>
@@ -91,6 +92,7 @@
parameters.urlSchemesRegistered = m_soupRequestManagerProxy->registeredURISchemes();
m_cookieManagerProxy->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
+ parameters.ignoreTLSErrors = m_ignoreTLSErrors;
}
void WebContext::platformInvalidateContext()
@@ -125,4 +127,10 @@
return String();
}
+void WebContext::setIgnoreTLSErrors(bool ignoreTLSErrors)
+{
+ m_ignoreTLSErrors = ignoreTLSErrors;
+ sendToAllProcesses(Messages::WebProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors));
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp (138272 => 138273)
--- trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -32,6 +32,7 @@
#include "WebCookieManagerProxy.h"
#include "WebInspectorServer.h"
#include "WebProcessCreationParameters.h"
+#include "WebProcessMessages.h"
#include "WebSoupRequestManagerProxy.h"
#include <WebCore/FileSystem.h>
#include <WebCore/NotImplemented.h>
@@ -90,6 +91,7 @@
parameters.urlSchemesRegistered = m_soupRequestManagerProxy->registeredURISchemes();
m_cookieManagerProxy->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
+ parameters.ignoreTLSErrors = m_ignoreTLSErrors;
}
void WebContext::platformInvalidateContext()
@@ -126,4 +128,10 @@
return String();
}
+void WebContext::setIgnoreTLSErrors(bool ignoreTLSErrors)
+{
+ m_ignoreTLSErrors = ignoreTLSErrors;
+ sendToAllProcesses(Messages::WebProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors));
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (138272 => 138273)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-20 18:42:13 UTC (rev 138273)
@@ -285,6 +285,10 @@
void garbageCollectJavaScriptObjects();
void setJavaScriptGarbageCollectorTimerEnabled(bool flag);
+#if USE(SOUP)
+ void setIgnoreTLSErrors(bool);
+#endif
+
void postInjectedBundleMessage(const CoreIPC::DataReference& messageData);
#if USE(SECURITY_FRAMEWORK)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (138272 => 138273)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2012-12-20 18:42:13 UTC (rev 138273)
@@ -54,6 +54,9 @@
#if PLATFORM(WIN)
SetShouldPaintNativeControls(bool shouldPaintNativeControls)
#endif
+#if USE(SOUP)
+ SetIgnoreTLSErrors(bool ignoreTLSErrors)
+#endif
// Private browsing session is per process. Individual pages or page groups may use the private session or the default one as appropriate.
EnsurePrivateBrowsingSession()
Modified: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp (138272 => 138273)
--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -111,8 +111,6 @@
soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache));
soup_cache_load(soupCache);
- WebCore::ResourceHandle::setIgnoreSSLErrors(true);
-
int socket = atoi(argv[1]);
WebProcess::shared().initialize(socket, RunLoop::main());
RunLoop::run();
Modified: trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp (138272 => 138273)
--- trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -75,9 +75,6 @@
soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get()));
soup_cache_load(soupCache.get());
- // This is for compatibility, it will be removed when UI process can handle SSL errors.
- WebCore::ResourceHandle::setIgnoreSSLErrors(true);
-
RunLoop::run();
soup_cache_flush(soupCache.get());
Modified: trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp (138272 => 138273)
--- trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp 2012-12-20 18:35:33 UTC (rev 138272)
+++ trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp 2012-12-20 18:42:13 UTC (rev 138273)
@@ -176,6 +176,8 @@
}
WebCookieManager::shared().setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
+ setIgnoreTLSErrors(parameters.ignoreTLSErrors);
+
WebCore::addLanguageChangeObserver(this, languageChanged);
}
@@ -184,4 +186,9 @@
WebCore::removeLanguageChangeObserver(this);
}
+void WebProcess::setIgnoreTLSErrors(bool ignoreTLSErrors)
+{
+ WebCore::ResourceHandle::setIgnoreSSLErrors(ignoreTLSErrors);
+}
+
} // namespace WebKit