Title: [109765] releases/WebKitGTK/webkit-1.8

Diff

Modified: releases/WebKitGTK/webkit-1.8/ChangeLog (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/ChangeLog	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/ChangeLog	2012-03-05 18:26:26 UTC (rev 109765)
@@ -1,3 +1,12 @@
+2012-03-05  Martin Robinson  <mrobin...@igalia.com>
+
+        [soup] Crash while loading http://www.jusco.cn
+        https://bugs.webkit.org/show_bug.cgi?id=68238
+
+        Reviewed by Philippe Normand.
+
+        * configure.ac: Bumped the libsoup dependency to 2.37.90.
+
 2012-02-22  Martin Robinson  <mrobin...@igalia.com>
 
         Update the version information in preparation for the 1.7.90 release.

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-03-05 18:26:26 UTC (rev 109765)
@@ -1,5 +1,15 @@
 2012-03-05  Martin Robinson  <mrobin...@igalia.com>
 
+        [soup] Crash while loading http://www.jusco.cn
+        https://bugs.webkit.org/show_bug.cgi?id=68238
+
+        Reviewed by Philippe Normand.
+
+        * http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers-expected.txt: Added.
+        * http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html: Added.
+
+2012-03-05  Martin Robinson  <mrobin...@igalia.com>
+
         [GTK] REGRESSION: r108278 broke some tests that expect focus
         https://bugs.webkit.org/show_bug.cgi?id=79084
 

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers-expected.txt (0 => 109765)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers-expected.txt	2012-03-05 18:26:26 UTC (rev 109765)
@@ -0,0 +1,4 @@
+Test for: bug 68238: [soup] Crash while loading http://www.jusco.cn This test verifies that WebCore timers do not fire during synchronous XMLHttpRequests.
+
+PASS
+
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html (0 => 109765)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html	2012-03-05 18:26:26 UTC (rev 109765)
@@ -0,0 +1,32 @@
+<html><body>
+
+<p> Test for: <a href="" 68238<a>: [soup] Crash while loading http://www.jusco.cn</a> This test verifies that WebCore timers do not fire during synchronous XMLHttpRequests.
+<pre id=log></pre>
+
+<script type="text/_javascript_">
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function log(message)
+{
+    document.getElementById("log").innerHTML += message + "\n";
+}
+
+var timerEverFired = false;
+var intervalId = setInterval(function() {
+    timerEverFired = true;
+}, 10);
+
+try {
+    var req = new XMLHttpRequest();
+    req.open("GET", "resources/download-with-delay.php?iteration=5&delay=50", false);
+    req.send(null);
+} catch (ex) {
+    log(ex);
+}
+
+clearInterval(intervalId);
+log(timerEverFired ? "FAIL" : "PASS");
+</script>
+
+</body></html>
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html
___________________________________________________________________

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-03-05 18:26:26 UTC (rev 109765)
@@ -1,3 +1,29 @@
+2012-03-05  Martin Robinson  <mrobin...@igalia.com>
+
+        [soup] Crash while loading http://www.jusco.cn
+        https://bugs.webkit.org/show_bug.cgi?id=68238
+
+        Reviewed by Philippe Normand.
+
+        Test: http/tests/xmlhttprequest/xmlhttprequest-sync-no-timers.html
+
+        When running synchronous XMLHttpRequests, push a new inner thread default
+        context, so that other sources from timers and network activity do not run.
+        This will make synchronous requests truly synchronous with the rest of
+        WebCore.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCoreSynchronousLoader): Clean up the method definitions a bit by writing them inline.
+        (WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader): Push a new thread default
+        context to prevent other sources from running.
+        (WebCore::WebCoreSynchronousLoader::~WebCoreSynchronousLoader): Pop the inner thread default context.
+        (WebCore::closeCallback): If the client is synchronous call didFinishLoading now.
+        (WebCore::readCallback): Only call didFinishLoading if the client isn't synchronous.
+        (WebCore::ResourceHandle::defaultSession): Activate use-thread-context so that the soup session
+        respects the inner thread context.
+        (ResourceHandleClient):
+        (WebCore::ResourceHandleClient::isSynchronousClient): Added this virtual method.
+
 2012-03-05  Mario Sanchez Prada  <msanc...@igalia.com>
 
         [GTK] Add GMainLoop and GMainContext to be handled by GRefPtr

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/ResourceHandleClient.h (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/ResourceHandleClient.h	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/ResourceHandleClient.h	2012-03-05 18:26:26 UTC (rev 109765)
@@ -109,6 +109,9 @@
 #if ENABLE(BLOB)
         virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*) { return 0; }
 #endif
+#if USE(SOUP)
+        virtual bool isSynchronousClient() { return false; }
+#endif
     };
 
 }

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-03-05 18:26:26 UTC (rev 109765)
@@ -72,16 +72,60 @@
 class WebCoreSynchronousLoader : public ResourceHandleClient {
     WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader);
 public:
-    WebCoreSynchronousLoader(ResourceError&, ResourceResponse &, Vector<char>&);
-    ~WebCoreSynchronousLoader();
 
-    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
-    virtual void didReceiveData(ResourceHandle*, const char*, int, int encodedDataLength);
-    virtual void didFinishLoading(ResourceHandle*, double /*finishTime*/);
-    virtual void didFail(ResourceHandle*, const ResourceError&);
+    WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, Vector<char>& data)
+        : m_error(error)
+        , m_response(response)
+        , m_data(data)
+        , m_finished(false)
+    {
+        // 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
+        // will only process GSources associated with this inner context.
+        GRefPtr<GMainContext> innerMainContext = adoptGRef(g_main_context_new());
+        g_main_context_push_thread_default(innerMainContext.get());
+        m_mainLoop = g_main_loop_new(innerMainContext.get(), false);
+    }
 
-    void run();
+    ~WebCoreSynchronousLoader()
+    {
+        g_main_context_pop_thread_default(g_main_context_get_thread_default());
+    }
 
+    virtual bool isSynchronousClient()
+    {
+        return true;
+    }
+
+    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+    {
+        m_response = response;
+    }
+
+    virtual void didReceiveData(ResourceHandle*, const char* data, int length, int)
+    {
+        m_data.append(data, length);
+    }
+
+    virtual void didFinishLoading(ResourceHandle*, double)
+    {
+        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)
+    {
+        m_error = error;
+        didFinishLoading(handle, 0);
+    }
+
+    void run()
+    {
+        if (!m_finished)
+            g_main_loop_run(m_mainLoop.get());
+    }
+
 private:
     ResourceError& m_error;
     ResourceResponse& m_response;
@@ -90,47 +134,6 @@
     GRefPtr<GMainLoop> m_mainLoop;
 };
 
-WebCoreSynchronousLoader::WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, Vector<char>& data)
-    : m_error(error)
-    , m_response(response)
-    , m_data(data)
-    , m_finished(false)
-{
-    m_mainLoop = adoptGRef(g_main_loop_new(0, false));
-}
-
-WebCoreSynchronousLoader::~WebCoreSynchronousLoader()
-{
-}
-
-void WebCoreSynchronousLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
-{
-    m_response = response;
-}
-
-void WebCoreSynchronousLoader::didReceiveData(ResourceHandle*, const char* data, int length, int)
-{
-    m_data.append(data, length);
-}
-
-void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*, double)
-{
-    g_main_loop_quit(m_mainLoop.get());
-    m_finished = true;
-}
-
-void WebCoreSynchronousLoader::didFail(ResourceHandle* handle, const ResourceError& error)
-{
-    m_error = error;
-    didFinishLoading(handle, 0);
-}
-
-void WebCoreSynchronousLoader::run()
-{
-    if (!m_finished)
-        g_main_loop_run(m_mainLoop.get());
-}
-
 static void cleanupSoupRequestOperation(ResourceHandle*, bool isDestroying);
 static void sendRequestCallback(GObject*, GAsyncResult*, gpointer);
 static void readCallback(GObject*, GAsyncResult*, gpointer);
@@ -637,6 +640,9 @@
     ResourceHandleInternal* d = handle->getInternal();
     g_input_stream_close_finish(d->m_inputStream.get(), res, 0);
     cleanupSoupRequestOperation(handle.get());
+
+    if (handle->client()->isSynchronousClient())
+        handle->client()->didFinishLoading(handle.get(), 0);
 }
 
 static void readCallback(GObject* source, GAsyncResult* asyncResult, gpointer data)
@@ -666,8 +672,11 @@
 
     if (!bytesRead) {
         // We inform WebCore of load completion now instead of waiting for the input
-        // stream to close because the input stream is closed asynchronously.
-        client->didFinishLoading(handle.get(), 0);
+        // stream to close because the input stream is closed asynchronously. If this
+        // is a synchronous request, we wait until the closeCallback, because we don't
+        // want to halt the internal main loop before the input stream closes.
+        if (!handle->client()->isSynchronousClient())
+            client->didFinishLoading(handle.get(), 0);
         g_input_stream_close_async(d->m_inputStream.get(), G_PRIORITY_DEFAULT, 0, closeCallback, handle.get());
         return;
     }
@@ -739,6 +748,7 @@
                      SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
                      SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
                      SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+                     SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
                      NULL);
     }
 

Modified: releases/WebKitGTK/webkit-1.8/Tools/ChangeLog (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/Tools/ChangeLog	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/Tools/ChangeLog	2012-03-05 18:26:26 UTC (rev 109765)
@@ -1,5 +1,15 @@
 2012-03-05  Martin Robinson  <mrobin...@igalia.com>
 
+        [soup] Crash while loading http://www.jusco.cn
+        https://bugs.webkit.org/show_bug.cgi?id=68238
+
+        Reviewed by Philippe Normand.
+
+        * gtk/jhbuild.modules: Bumped the libsoup and glib dependencies
+        in the jhbuild file.
+
+2012-03-05  Martin Robinson  <mrobin...@igalia.com>
+
         [GTK] Unit tests are noisy when run under jhbuild
         https://bugs.webkit.org/show_bug.cgi?id=80241
 

Modified: releases/WebKitGTK/webkit-1.8/Tools/gtk/jhbuild.modules (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/Tools/gtk/jhbuild.modules	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/Tools/gtk/jhbuild.modules	2012-03-05 18:26:26 UTC (rev 109765)
@@ -120,10 +120,9 @@
     <dependencies>
       <dep package="libffi"/>
     </dependencies>
-    <branch module="/pub/GNOME/sources/glib/2.31/glib-2.31.2.tar.xz" version="2.31.2"
+    <branch module="/pub/GNOME/sources/glib/2.31/glib-2.31.8.tar.xz" version="2.31.8"
             repo="ftp.gnome.org"
-            hash="sha256:19d7921671a487c3c5759a57df7b8508afdbadd7764d62a47a82fff7b399032b"
-            md5sum="1cbdf314d7c87916a0c3dce83ac0285f"/>
+            hash="sha256:1ce3d275189000e1c50e92efcdb6447bc260b1e5c41699b7a1959e3e1928fbaa"/>
   </autotools>
 
   <autotools id="glib-networking">
@@ -152,9 +151,9 @@
     <dependencies>
       <dep package="glib-networking"/>
     </dependencies>
-    <branch module="libsoup" version="2.37.2.1+git"
+    <branch module="libsoup" version="2.37.91+git"
             repo="git.gnome.org"
-            tag="5cbfc48caf76ced2e28ee06c9e40523273601dc6"/>
+            tag="52057510accba49cfc6d1d0e52292368ba2e0c99"/>
   </autotools>
 
   <autotools id="fontconfig" autogen-sh="configure">

Modified: releases/WebKitGTK/webkit-1.8/configure.ac (109764 => 109765)


--- releases/WebKitGTK/webkit-1.8/configure.ac	2012-03-05 18:25:47 UTC (rev 109764)
+++ releases/WebKitGTK/webkit-1.8/configure.ac	2012-03-05 18:26:26 UTC (rev 109765)
@@ -378,7 +378,7 @@
 FONTCONFIG_REQUIRED_VERSION=2.4
 FREETYPE2_REQUIRED_VERSION=9.0
 GLIB_REQUIRED_VERSION=2.31.2
-LIBSOUP_REQUIRED_VERSION=2.37.2.1
+LIBSOUP_REQUIRED_VERSION=2.37.90
 LIBXML_REQUIRED_VERSION=2.6
 PANGO_REQUIRED_VERSION=1.21.0
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to