Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (184459 => 184460)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog 2015-05-18 11:24:16 UTC (rev 184459)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog 2015-05-18 11:27:48 UTC (rev 184460)
@@ -1,3 +1,35 @@
+2015-03-03 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Synchronous XMLHttpRequests can time out when we reach the max connections limit
+ https://bugs.webkit.org/show_bug.cgi?id=141508
+
+ Reviewed by Sergio Villar Senin.
+
+ Use SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS flag when loading a
+ synchronous message instead of increasing the maximum number of
+ connections allowed if the soup version is recent enough.
+ The current solution of increasing/decreasing the limits doesn't
+ always work, because connections are not marked as IDLE in libsoup
+ until the message is unqueued, but we don't wait for the message
+ to be unqueued to finish our loads in WebKit, we finish them as
+ soon as we have finished reading the stream. This causes that
+ synchronous loads keep blocked in the nested main loop until the
+ timeout of 10 seconds is fired and the load fails.
+ Also marked WebCoreSynchronousLoader class as final, the virtual
+ methods as override and removed the unsused method isSynchronousClient.
+
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::createSoupMessageForHandleAndRequest):
+ (WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader):
+ (WebCore::WebCoreSynchronousLoader::isSynchronousClient): Deleted.
+ (WebCore::WebCoreSynchronousLoader::didReceiveResponse):
+ (WebCore::WebCoreSynchronousLoader::didReceiveData):
+ (WebCore::WebCoreSynchronousLoader::didReceiveBuffer):
+ (WebCore::WebCoreSynchronousLoader::didFinishLoading):
+ (WebCore::WebCoreSynchronousLoader::didFail):
+ (WebCore::WebCoreSynchronousLoader::didReceiveAuthenticationChallenge):
+ (WebCore::WebCoreSynchronousLoader::shouldUseCredentialStorage):
+
2015-03-19 Carlos Garcia Campos <[email protected]>
[GTK] Scrollbars look bad with GTK+ 3.16
Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (184459 => 184460)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2015-05-18 11:24:16 UTC (rev 184459)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2015-05-18 11:27:48 UTC (rev 184460)
@@ -74,7 +74,7 @@
static bool loadingSynchronousRequest = false;
static const size_t gDefaultReadBufferSize = 8192;
-class WebCoreSynchronousLoader : public ResourceHandleClient {
+class WebCoreSynchronousLoader final : public ResourceHandleClient {
WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader);
public:
@@ -85,7 +85,6 @@
, m_data(data)
, m_finished(false)
, m_storedCredentials(storedCredentials)
-
{
// We don't want any timers to fire while we are doing our synchronous load
// so we replace the thread default main context. The main loop iterations
@@ -95,12 +94,16 @@
g_main_context_push_thread_default(innerMainContext.get());
m_mainLoop = adoptGRef(g_main_loop_new(innerMainContext.get(), false));
+#if !SOUP_CHECK_VERSION(2, 49, 91)
adjustMaxConnections(1);
+#endif
}
~WebCoreSynchronousLoader()
{
+#if !SOUP_CHECK_VERSION(2, 49, 91)
adjustMaxConnections(-1);
+#endif
GMainContext* context = g_main_context_get_thread_default();
while (g_main_context_pending(context))
@@ -110,6 +113,7 @@
loadingSynchronousRequest = false;
}
+#if !SOUP_CHECK_VERSION(2, 49, 91)
void adjustMaxConnections(int adjustment)
{
int maxConnections, maxConnectionsPerHost;
@@ -125,23 +129,19 @@
NULL);
}
+#endif // SOUP_CHECK_VERSION(2, 49, 91)
- virtual bool isSynchronousClient()
+ virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse& response) override
{
- return true;
- }
-
- virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
- {
m_response = response;
}
- virtual void didReceiveData(ResourceHandle*, const char* /* data */, unsigned /* length */, int)
+ virtual void didReceiveData(ResourceHandle*, const char* /* data */, unsigned /* length */, int) override
{
ASSERT_NOT_REACHED();
}
- virtual void didReceiveBuffer(ResourceHandle*, PassRefPtr<SharedBuffer> buffer, int /* encodedLength */)
+ virtual void didReceiveBuffer(ResourceHandle*, PassRefPtr<SharedBuffer> buffer, int /* encodedLength */) override
{
// This pattern is suggested by SharedBuffer.h.
const char* segment;
@@ -152,26 +152,26 @@
}
}
- virtual void didFinishLoading(ResourceHandle*, double)
+ virtual void didFinishLoading(ResourceHandle*, double) override
{
if (g_main_loop_is_running(m_mainLoop.get()))
g_main_loop_quit(m_mainLoop.get());
m_finished = true;
}
- virtual void didFail(ResourceHandle* handle, const ResourceError& error)
+ virtual void didFail(ResourceHandle* handle, const ResourceError& error) override
{
m_error = error;
didFinishLoading(handle, 0);
}
- virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge)
+ virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) override
{
// We do not handle authentication for synchronous XMLHttpRequests.
challenge.authenticationClient()->receivedRequestToContinueWithoutCredential(challenge);
}
- virtual bool shouldUseCredentialStorage(ResourceHandle*)
+ virtual bool shouldUseCredentialStorage(ResourceHandle*) override
{
return m_storedCredentials == AllowStoredCredentials;
}
@@ -974,7 +974,14 @@
g_signal_connect(d->m_soupMessage.get(), "got-headers", G_CALLBACK(gotHeadersCallback), handle);
g_signal_connect(d->m_soupMessage.get(), "wrote-body-data", G_CALLBACK(wroteBodyDataCallback), handle);
- soup_message_set_flags(d->m_soupMessage.get(), static_cast<SoupMessageFlags>(soup_message_get_flags(d->m_soupMessage.get()) | SOUP_MESSAGE_NO_REDIRECT));
+ unsigned flags = SOUP_MESSAGE_NO_REDIRECT;
+#if SOUP_CHECK_VERSION(2, 49, 91)
+ // Ignore the connection limits in synchronous loads to avoid freezing the networking process.
+ // See https://bugs.webkit.org/show_bug.cgi?id=141508.
+ if (loadingSynchronousRequest)
+ flags |= SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS;
+#endif
+ soup_message_set_flags(d->m_soupMessage.get(), static_cast<SoupMessageFlags>(soup_message_get_flags(d->m_soupMessage.get()) | flags));
#if ENABLE(WEB_TIMING)
d->m_response.setResourceLoadTiming(ResourceLoadTiming::create());