Don't try to use a null connection()->xpcConnection()
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 00:23:04 +0000 (00:23 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 00:23:04 +0000 (00:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131961

Reviewed by Dan Bernstein.

If running with -WebKit2UseXPCServiceForWebProcess NO, connection()->xpcConnection()
is null and xpc_connection_get_pid() would crash, so null-check the xpcConnection.

* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didFinishLaunching):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp

index 5d22c8554f86d2bd33752c3f1de9a021d889d6d0..14fd00b5afa4cbf94adae54352111174322b374b 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-21  Simon Fraser  <simon.fraser@apple.com>
+
+        Don't try to use a null connection()->xpcConnection()
+        https://bugs.webkit.org/show_bug.cgi?id=131961
+
+        Reviewed by Dan Bernstein.
+        
+        If running with -WebKit2UseXPCServiceForWebProcess NO, connection()->xpcConnection()
+        is null and xpc_connection_get_pid() would crash, so null-check the xpcConnection.
+
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didFinishLaunching):
+
 2014-04-21  Dan Bernstein  <mitz@apple.com>
 
         WebKit part of <rdar://problem/16631323> Page::setDefersLoading doesn’t do anything when using the Network process
index c495fb41ea20fc8e0fffeb276b9ff7a59b2b30a2..9e31da6230b47020bca0e0fa5320f34a9910413b 100644 (file)
@@ -201,7 +201,8 @@ void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Con
 #endif
     
 #if PLATFORM(IOS) && USE(XPC_SERVICES)
-    m_assertion = std::make_unique<ProcessAssertion>(xpc_connection_get_pid(connection()->xpcConnection()), AssertionState::Foreground);
+    if (xpc_connection_t connection = this->connection()->xpcConnection())
+        m_assertion = std::make_unique<ProcessAssertion>(xpc_connection_get_pid(connection), AssertionState::Foreground);
 #endif
 }