Crash when starting a download before the network process has been launched
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2014 17:55:39 +0000 (17:55 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2014 17:55:39 +0000 (17:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126258

Reviewed by Anders Carlsson.

We need to ensure there's a network process running before
starting a new download like we do when using the web process.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::download): Use ChildProcessProxy::send()
instead of using the connection to make sure messages are queued
if the process is still launching.
(WebKit::WebContext::createDownloadProxy): Call
ensureNetworkProcess() before creating the download proxy.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161559 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp

index aba21ca..6185176 100644 (file)
@@ -1,5 +1,22 @@
 2014-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        Crash when starting a download before the network process has been launched
+        https://bugs.webkit.org/show_bug.cgi?id=126258
+
+        Reviewed by Anders Carlsson.
+
+        We need to ensure there's a network process running before
+        starting a new download like we do when using the web process.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::download): Use ChildProcessProxy::send()
+        instead of using the connection to make sure messages are queued
+        if the process is still launching.
+        (WebKit::WebContext::createDownloadProxy): Call
+        ensureNetworkProcess() before creating the download proxy.
+
+2014-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [SOUP] Partial file left on disk after a download fails or is cancelled in WebKit2
         https://bugs.webkit.org/show_bug.cgi?id=126686
 
index 4949326..c0bc387 100644 (file)
@@ -763,7 +763,7 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource
 #if ENABLE(NETWORK_PROCESS)
     if (usesNetworkProcess() && networkProcess()) {
         // FIXME (NetworkProcess): Replicate whatever FrameLoader::setOriginalURLForDownloadRequest does with the request here.
-        networkProcess()->connection()->send(Messages::NetworkProcess::DownloadRequest(downloadProxy->downloadID(), request), 0);
+        networkProcess()->send(Messages::NetworkProcess::DownloadRequest(downloadProxy->downloadID(), request), 0);
         return downloadProxy;
     }
 #endif
@@ -938,8 +938,11 @@ void WebContext::addVisitedLinkHash(LinkHash linkHash)
 DownloadProxy* WebContext::createDownloadProxy()
 {
 #if ENABLE(NETWORK_PROCESS)
-    if (usesNetworkProcess())
+    if (usesNetworkProcess()) {
+        ensureNetworkProcess();
+        ASSERT(m_networkProcess);
         return m_networkProcess->createDownloadProxy();
+    }
 #endif
 
     return ensureSharedWebProcess().createDownloadProxy();