- Revision
- 210786
- Author
- [email protected]
- Date
- 2017-01-16 03:49:39 -0800 (Mon, 16 Jan 2017)
Log Message
[SOUP] Accept-language could be set twice in a row for the default context
https://bugs.webkit.org/show_bug.cgi?id=167089
Reviewed by Žan Doberšek.
Source/WebCore:
If NetworkStorageSession doesn't have a SoupNetworkSession yet, we are creating it only to set the
languages. Since we already set the global value, the languages will be set when the SoupNetworkSession is
created later. This is not a big deal for the language property, but it will be for proxies after bug #128674.
Since NetworkStorageSession::soupNetworkSession() it's actually getting or creating the SoupNetworkSession, this
patch renames it as NetworkStorageSession::getOrCreateSoupNetworkSession() and now
NetworkStorageSession::soupNetworkSession() returns a pointer without creating the SoupNetworkSession, so it can
be nullptr. This can now be used to only use the default SoupNetworkSession when it has already been created.
* platform/network/NetworkStorageSession.h:
(WebCore::NetworkStorageSession::soupNetworkSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
* platform/network/soup/DNSSoup.cpp:
(WebCore::DNSResolveQueue::updateIsUsingProxy): Ditto.
(WebCore::DNSResolveQueue::platformResolve): Ditto.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): This is the old soupNetworkSession(), now renamed.
(WebCore::NetworkStorageSession::soupNetworkSession): Return a pointer with the current value of m_session that
now can be nullptr.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::sessionFromContext): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
Source/WebKit2:
* NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
(WebKit::CustomProtocolManager::registerScheme): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
* NetworkProcess/efl/NetworkProcessMainEfl.cpp:
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::userPreferredLanguagesChanged): Only set the languages if NetworkStorageSession has a
SoupNetworkSession.
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::soupSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
* WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
(WebKit::WebCookieManager::setCookiePersistentStorage): Ditto.
* WebProcess/efl/WebProcessMainEfl.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (210785 => 210786)
--- trunk/Source/WebCore/ChangeLog 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebCore/ChangeLog 2017-01-16 11:49:39 UTC (rev 210786)
@@ -1,5 +1,32 @@
2017-01-16 Carlos Garcia Campos <[email protected]>
+ [SOUP] Accept-language could be set twice in a row for the default context
+ https://bugs.webkit.org/show_bug.cgi?id=167089
+
+ Reviewed by Žan Doberšek.
+
+ If NetworkStorageSession doesn't have a SoupNetworkSession yet, we are creating it only to set the
+ languages. Since we already set the global value, the languages will be set when the SoupNetworkSession is
+ created later. This is not a big deal for the language property, but it will be for proxies after bug #128674.
+ Since NetworkStorageSession::soupNetworkSession() it's actually getting or creating the SoupNetworkSession, this
+ patch renames it as NetworkStorageSession::getOrCreateSoupNetworkSession() and now
+ NetworkStorageSession::soupNetworkSession() returns a pointer without creating the SoupNetworkSession, so it can
+ be nullptr. This can now be used to only use the default SoupNetworkSession when it has already been created.
+
+ * platform/network/NetworkStorageSession.h:
+ (WebCore::NetworkStorageSession::soupNetworkSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
+ * platform/network/soup/DNSSoup.cpp:
+ (WebCore::DNSResolveQueue::updateIsUsingProxy): Ditto.
+ (WebCore::DNSResolveQueue::platformResolve): Ditto.
+ * platform/network/soup/NetworkStorageSessionSoup.cpp:
+ (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): This is the old soupNetworkSession(), now renamed.
+ (WebCore::NetworkStorageSession::soupNetworkSession): Return a pointer with the current value of m_session that
+ now can be nullptr.
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::sessionFromContext): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
+
+2017-01-16 Carlos Garcia Campos <[email protected]>
+
[SOUP] Fix handling of accept language property
https://bugs.webkit.org/show_bug.cgi?id=166969
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (210785 => 210786)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-01-16 11:49:39 UTC (rev 210786)
@@ -71,7 +71,8 @@
NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>&&);
~NetworkStorageSession();
- SoupNetworkSession& soupNetworkSession() const;
+ SoupNetworkSession* soupNetworkSession() const { return m_session.get(); };
+ SoupNetworkSession& getOrCreateSoupNetworkSession() const;
SoupCookieJar* cookieStorage() const;
void getCredentialFromPersistentStorage(const ProtectionSpace&, Function<void (Credential&&)> completionHandler);
void saveCredentialToPersistentStorage(const ProtectionSpace&, const Credential&);
Modified: trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp (210785 => 210786)
--- trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -79,7 +79,7 @@
void DNSResolveQueue::updateIsUsingProxy()
{
GRefPtr<GProxyResolver> resolver;
- g_object_get(NetworkStorageSession::defaultStorageSession().soupNetworkSession().soupSession(), "proxy-resolver", &resolver.outPtr(), nullptr);
+ g_object_get(NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().soupSession(), "proxy-resolver", &resolver.outPtr(), nullptr);
ASSERT(resolver);
g_proxy_resolver_lookup_async(resolver.get(), "http://example.com/", nullptr, proxyResolvedForHttpUriCallback, &m_isUsingProxy);
@@ -95,7 +95,7 @@
{
ASSERT(isMainThread());
- soup_session_prefetch_dns(NetworkStorageSession::defaultStorageSession().soupNetworkSession().soupSession(), hostname.utf8().data(), nullptr, resolvedCallback, nullptr);
+ soup_session_prefetch_dns(NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().soupSession(), hostname.utf8().data(), nullptr, resolvedCallback, nullptr);
}
void prefetchDNS(const String& hostname)
Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (210785 => 210786)
--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -86,7 +86,7 @@
defaultSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), std::make_unique<SoupNetworkSession>());
}
-SoupNetworkSession& NetworkStorageSession::soupNetworkSession() const
+SoupNetworkSession& NetworkStorageSession::getOrCreateSoupNetworkSession() const
{
if (!m_session)
m_session = std::make_unique<SoupNetworkSession>(cookieStorage());
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (210785 => 210786)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -80,8 +80,8 @@
static SoupSession* sessionFromContext(NetworkingContext* context)
{
if (!context || !context->isValid())
- return NetworkStorageSession::defaultStorageSession().soupNetworkSession().soupSession();
- return context->storageSession().soupNetworkSession().soupSession();
+ return NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().soupSession();
+ return context->storageSession().getOrCreateSoupNetworkSession().soupSession();
}
ResourceHandle::~ResourceHandle()
Modified: trunk/Source/WebKit2/ChangeLog (210785 => 210786)
--- trunk/Source/WebKit2/ChangeLog 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-16 11:49:39 UTC (rev 210786)
@@ -1,5 +1,24 @@
2017-01-16 Carlos Garcia Campos <[email protected]>
+ [SOUP] Accept-language could be set twice in a row for the default context
+ https://bugs.webkit.org/show_bug.cgi?id=167089
+
+ Reviewed by Žan Doberšek.
+
+ * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
+ (WebKit::CustomProtocolManager::registerScheme): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
+ * NetworkProcess/efl/NetworkProcessMainEfl.cpp:
+ * NetworkProcess/soup/NetworkProcessSoup.cpp:
+ (WebKit::NetworkProcess::userPreferredLanguagesChanged): Only set the languages if NetworkStorageSession has a
+ SoupNetworkSession.
+ * NetworkProcess/soup/NetworkSessionSoup.cpp:
+ (WebKit::NetworkSessionSoup::soupSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
+ * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
+ (WebKit::WebCookieManager::setCookiePersistentStorage): Ditto.
+ * WebProcess/efl/WebProcessMainEfl.cpp:
+
+2017-01-16 Carlos Garcia Campos <[email protected]>
+
[SOUP] Fix handling of accept language property
https://bugs.webkit.org/show_bug.cgi?id=166969
Modified: trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp (210785 => 210786)
--- trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -91,7 +91,7 @@
auto* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_registeredSchemes->pdata));
- soup_session_add_feature_by_type(NetworkStorageSession::defaultStorageSession().soupNetworkSession().soupSession(), WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
+ soup_session_add_feature_by_type(NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().soupSession(), WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
}
void CustomProtocolManager::unregisterScheme(const String&)
Modified: trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp (210785 => 210786)
--- trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -48,7 +48,7 @@
if (!ecore_main_loop_glib_integrate())
return false;
- NetworkStorageSession::defaultStorageSession().soupNetworkSession().setupHTTPProxyFromEnvironment();
+ NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().setupHTTPProxyFromEnvironment();
return true;
}
Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp (210785 => 210786)
--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -97,7 +97,8 @@
auto acceptLanguages = buildAcceptLanguages(languages);
SoupNetworkSession::setInitialAcceptLanguages(acceptLanguages);
NetworkStorageSession::forEach([&acceptLanguages](const WebCore::NetworkStorageSession& session) {
- session.soupNetworkSession().setAcceptLanguages(acceptLanguages);
+ if (auto* soupSession = session.soupNetworkSession())
+ soupSession->setAcceptLanguages(acceptLanguages);
});
}
Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp (210785 => 210786)
--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkSessionSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -45,7 +45,7 @@
SoupSession* NetworkSessionSoup::soupSession() const
{
- return networkStorageSession().soupNetworkSession().soupSession();
+ return networkStorageSession().getOrCreateSoupNetworkSession().soupSession();
}
void NetworkSessionSoup::clearCredentials()
Modified: trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp (210785 => 210786)
--- trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -75,7 +75,7 @@
auto& storageSession = NetworkStorageSession::defaultStorageSession();
soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(storageSession.cookieStorage()));
- storageSession.soupNetworkSession().setCookieJar(jar.get());
+ storageSession.getOrCreateSoupNetworkSession().setCookieJar(jar.get());
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp (210785 => 210786)
--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp 2017-01-16 11:24:23 UTC (rev 210785)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp 2017-01-16 11:49:39 UTC (rev 210786)
@@ -99,7 +99,7 @@
if (!ecore_main_loop_glib_integrate())
return false;
- NetworkStorageSession::defaultStorageSession().soupNetworkSession().setupHTTPProxyFromEnvironment();
+ NetworkStorageSession::defaultStorageSession().getOrCreateSoupNetworkSession().setupHTTPProxyFromEnvironment();
return true;
}