Title: [211012] trunk/Source
- Revision
- 211012
- Author
- [email protected]
- Date
- 2017-01-20 23:40:19 -0800 (Fri, 20 Jan 2017)
Log Message
[SOUP] Custom protocols don't work in private browsing mode
https://bugs.webkit.org/show_bug.cgi?id=167236
Reviewed by Sergio Villar Senin.
Source/WebCore:
Add static method to set the global custom protocols request type and setup method to add the feature to the session.
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::SoupNetworkSession):
(WebCore::SoupNetworkSession::setCustomProtocolRequestType):
(WebCore::SoupNetworkSession::setupCustomProtocols):
* platform/network/soup/SoupNetworkSession.h:
Source/WebKit2:
We only register them in the default session.
* NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
(WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
custom protocols, and setup custom protocols in all existing sessions.
(WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
the class was already created in registerProtocolClass().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (211011 => 211012)
--- trunk/Source/WebCore/ChangeLog 2017-01-21 06:36:25 UTC (rev 211011)
+++ trunk/Source/WebCore/ChangeLog 2017-01-21 07:40:19 UTC (rev 211012)
@@ -1,3 +1,18 @@
+2017-01-20 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Custom protocols don't work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=167236
+
+ Reviewed by Sergio Villar Senin.
+
+ Add static method to set the global custom protocols request type and setup method to add the feature to the session.
+
+ * platform/network/soup/SoupNetworkSession.cpp:
+ (WebCore::SoupNetworkSession::SoupNetworkSession):
+ (WebCore::SoupNetworkSession::setCustomProtocolRequestType):
+ (WebCore::SoupNetworkSession::setupCustomProtocols):
+ * platform/network/soup/SoupNetworkSession.h:
+
2017-01-20 Matt Rajca <[email protected]>
Record whether a media element was prevented from playing without user interaction
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (211011 => 211012)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2017-01-21 06:36:25 UTC (rev 211011)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2017-01-21 07:40:19 UTC (rev 211012)
@@ -48,6 +48,7 @@
static bool gIgnoreTLSErrors;
static CString gInitialAcceptLanguages;
static SoupNetworkProxySettings gProxySettings;
+static GType gCustomProtocolRequestType;
#if !LOG_DISABLED
inline static void soupLogPrinter(SoupLogger*, SoupLoggerLogLevel, char direction, const char* data, gpointer)
@@ -140,6 +141,8 @@
SOUP_SESSION_SSL_STRICT, FALSE,
nullptr);
+ setupCustomProtocols();
+
if (!gInitialAcceptLanguages.isNull())
setAcceptLanguages(gInitialAcceptLanguages);
@@ -289,6 +292,19 @@
g_object_set(m_soupSession.get(), "accept-language", languages.data(), nullptr);
}
+void SoupNetworkSession::setCustomProtocolRequestType(GType requestType)
+{
+ ASSERT(g_type_is_a(requestType, SOUP_TYPE_REQUEST));
+ gCustomProtocolRequestType = requestType;
+}
+
+void SoupNetworkSession::setupCustomProtocols()
+{
+ if (!g_type_is_a(gCustomProtocolRequestType, SOUP_TYPE_REQUEST))
+ return;
+ soup_session_add_feature_by_type(m_soupSession.get(), gCustomProtocolRequestType);
+}
+
void SoupNetworkSession::setShouldIgnoreTLSErrors(bool ignoreTLSErrors)
{
gIgnoreTLSErrors = ignoreTLSErrors;
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h (211011 => 211012)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h 2017-01-21 06:36:25 UTC (rev 211011)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h 2017-01-21 07:40:19 UTC (rev 211012)
@@ -32,6 +32,7 @@
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/WTFString.h>
+typedef size_t GType;
typedef struct _SoupCache SoupCache;
typedef struct _SoupCookieJar SoupCookieJar;
typedef struct _SoupMessage SoupMessage;
@@ -70,6 +71,9 @@
static void checkTLSErrors(SoupRequest*, SoupMessage*, std::function<void (const ResourceError&)>&&);
static void allowSpecificHTTPSCertificateForHost(const CertificateInfo&, const String& host);
+ static void setCustomProtocolRequestType(GType);
+ void setupCustomProtocols();
+
private:
void setupLogger();
Modified: trunk/Source/WebKit2/ChangeLog (211011 => 211012)
--- trunk/Source/WebKit2/ChangeLog 2017-01-21 06:36:25 UTC (rev 211011)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-21 07:40:19 UTC (rev 211012)
@@ -1,3 +1,18 @@
+2017-01-20 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Custom protocols don't work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=167236
+
+ Reviewed by Sergio Villar Senin.
+
+ We only register them in the default session.
+
+ * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
+ (WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
+ custom protocols, and setup custom protocols in all existing sessions.
+ (WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
+ the class was already created in registerProtocolClass().
+
2017-01-20 Brady Eidson <[email protected]>
Require a button press on a gamepad for them to be exposed to the DOM.
Modified: trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp (211011 => 211012)
--- trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp 2017-01-21 06:36:25 UTC (rev 211011)
+++ trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp 2017-01-21 07:40:19 UTC (rev 211012)
@@ -77,6 +77,11 @@
void CustomProtocolManager::registerProtocolClass()
{
static_cast<WebKitSoupRequestGenericClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC))->client = &CustomProtocolRequestClient::singleton();
+ SoupNetworkSession::setCustomProtocolRequestType(WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
+ NetworkStorageSession::forEach([](const WebCore::NetworkStorageSession& session) {
+ if (auto* soupSession = session.soupNetworkSession())
+ soupSession->setupCustomProtocols();
+ });
}
void CustomProtocolManager::registerScheme(const String& scheme)
@@ -89,9 +94,9 @@
g_ptr_array_add(m_registeredSchemes.get(), g_strdup(scheme.utf8().data()));
g_ptr_array_add(m_registeredSchemes.get(), nullptr);
- auto* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
+ auto* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_peek(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
+ ASSERT(genericRequestClass);
genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_registeredSchemes->pdata));
- soup_session_add_feature_by_type(NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().soupSession(), WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
}
void CustomProtocolManager::unregisterScheme(const String&)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes