Skip to content
Permalink
Browse files
[GTK] Test /webkit2/WebKitWebContext/languages crashes with network p…
…rocess enabled

https://bugs.webkit.org/show_bug.cgi?id=126130

Reviewed by Anders Carlsson.

We need to notify the network process when the user preferred
languages have changed to update the SoupSession accordingly.

* NetworkProcess/NetworkProcess.h: Add
userPreferredLanguagesChanged when using soup network backend.
* NetworkProcess/NetworkProcess.messages.in: Add
UserPreferredLanguagesChanged message when using soup network
backend.
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::userPreferredLanguagesChanged): Update
the SoupSession to use the given languages.
(WebKit::NetworkProcess::platformInitializeNetworkProcess): Call
userPreferredLanguagesChanged() when initialization parameters
contain languages.
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
Remove unnedded WebCore prefix.
(WebKit::NetworkProcess::clearCacheForAllOrigins): Simplify using
a single line.
* Shared/Network/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode): Encode the
languages vector.
(WebKit::NetworkProcessCreationParameters::decode): Decode the
languages vector.
* Shared/Network/NetworkProcessCreationParameters.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::languageChanged): Send a message also to the
network process.
* UIProcess/soup/WebContextSoup.cpp:
(WebKit::WebContext::platformInitializeNetworkProcess): Set
languages initial parameter.

Canonical link: https://commits.webkit.org/144960@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jan 14, 2014
1 parent 9cb164b commit 08e02a796e80c8ff0510c8306d71d8256b6bd8fb
Showing 8 changed files with 60 additions and 2 deletions.
@@ -1,3 +1,41 @@
2014-01-14 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Test /webkit2/WebKitWebContext/languages crashes with network process enabled
https://bugs.webkit.org/show_bug.cgi?id=126130

Reviewed by Anders Carlsson.

We need to notify the network process when the user preferred
languages have changed to update the SoupSession accordingly.

* NetworkProcess/NetworkProcess.h: Add
userPreferredLanguagesChanged when using soup network backend.
* NetworkProcess/NetworkProcess.messages.in: Add
UserPreferredLanguagesChanged message when using soup network
backend.
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::userPreferredLanguagesChanged): Update
the SoupSession to use the given languages.
(WebKit::NetworkProcess::platformInitializeNetworkProcess): Call
userPreferredLanguagesChanged() when initialization parameters
contain languages.
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
Remove unnedded WebCore prefix.
(WebKit::NetworkProcess::clearCacheForAllOrigins): Simplify using
a single line.
* Shared/Network/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode): Encode the
languages vector.
(WebKit::NetworkProcessCreationParameters::decode): Decode the
languages vector.
* Shared/Network/NetworkProcessCreationParameters.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::languageChanged): Send a message also to the
network process.
* UIProcess/soup/WebContextSoup.cpp:
(WebKit::WebContext::platformInitializeNetworkProcess): Set
languages initial parameter.

2014-01-14 Carlos Garcia Campos <cgarcia@igalia.com>

[SOUP] SoupNetworkSession::setAcceptLanguages should receive a const reference
@@ -115,6 +115,7 @@ class NetworkProcess : public ChildProcess, private DownloadManager::Client {

#if USE(SOUP)
void setIgnoreTLSErrors(bool);
void userPreferredLanguagesChanged(const Vector<String>&);
#endif

// Platform Helpers
@@ -31,6 +31,7 @@ messages -> NetworkProcess LegacyReceiver {

#if USE(SOUP)
SetIgnoreTLSErrors(bool ignoreTLSErrors)
UserPreferredLanguagesChanged(Vector<String> languages)
#endif

EnsurePrivateBrowsingSession()
@@ -28,10 +28,10 @@
#if ENABLE(NETWORK_PROCESS)
#include "NetworkProcess.h"

#include "CertificateInfo.h"
#include "NetworkProcessCreationParameters.h"
#include "ResourceCachesToClear.h"
#include "WebCookieManager.h"
#include <WebCore/CertificateInfo.h>
#include <WebCore/FileSystem.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/ResourceHandle.h>
@@ -75,6 +75,11 @@ static uint64_t getMemorySize()
#endif
}

void NetworkProcess::userPreferredLanguagesChanged(const Vector<String>& languages)
{
SoupNetworkSession::defaultSession().setAcceptLanguages(languages);
}

void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
{
ASSERT(!parameters.diskCacheDirectory.isEmpty());
@@ -88,6 +93,9 @@ void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreati
}
supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);

if (!parameters.languages.isEmpty())
userPreferredLanguagesChanged(parameters.languages);

setIgnoreTLSErrors(parameters.ignoreTLSErrors);
}

@@ -121,7 +129,7 @@ void NetworkProcess::setIgnoreTLSErrors(bool ignoreTLSErrors)

void NetworkProcess::allowSpecificHTTPSCertificateForHost(const CertificateInfo& certificateInfo, const String& host)
{
WebCore::ResourceHandle::setClientCertificate(host, certificateInfo.certificate());
ResourceHandle::setClientCertificate(host, certificateInfo.certificate());
}

void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
@@ -59,6 +59,7 @@ void NetworkProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) con
encoder << cookiePersistentStorageType;
encoder.encodeEnum(cookieAcceptPolicy);
encoder << ignoreTLSErrors;
encoder << languages;
#endif
}

@@ -102,6 +103,8 @@ bool NetworkProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, Net
return false;
if (!decoder.decode(result.ignoreTLSErrors))
return false;
if (!decoder.decode(result.languages))
return false;
#endif

return true;
@@ -77,6 +77,7 @@ struct NetworkProcessCreationParameters {
uint32_t cookiePersistentStorageType;
HTTPCookieAcceptPolicy cookieAcceptPolicy;
bool ignoreTLSErrors;
Vector<String> languages;
#endif
};

@@ -323,6 +323,10 @@ void WebContext::languageChanged(void* context)
void WebContext::languageChanged()
{
sendToAllProcesses(Messages::WebProcess::UserPreferredLanguagesChanged(userPreferredLanguages()));
#if USE(SOUP) && ENABLE(NETWORK_PROCESS)
if (m_usesNetworkProcess && m_networkProcess)
m_networkProcess->send(Messages::NetworkProcess::UserPreferredLanguagesChanged(userPreferredLanguages()), 0);
#endif
}

void WebContext::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
@@ -29,6 +29,7 @@

#include "NetworkProcessCreationParameters.h"
#include "WebCookieManagerProxy.h"
#include <WebCore/Language.h>

namespace WebKit {

@@ -37,6 +38,7 @@ void WebContext::platformInitializeNetworkProcess(NetworkProcessCreationParamete
supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
parameters.ignoreTLSErrors = m_ignoreTLSErrors;
parameters.languages = WebCore::userPreferredLanguages();
}

}

0 comments on commit 08e02a7

Please sign in to comment.