REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection:...
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Mar 2018 21:59:54 +0000 (21:59 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Mar 2018 21:59:54 +0000 (21:59 +0000)
commita0ae570d0744f0d3abbfc34378ab060b10ea544e
tree33117016d8ca1b54f2ed263a73fd51431e1ab4d5
parent5f19c5806744599e884c6a48847ed1893507a4f4
REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection::initializeSendSource()
https://bugs.webkit.org/show_bug.cgi?id=184122
<rdar://problem/39003606>

Reviewed by Chris Dumez.

One of the new assertions added in r230035 begin firing while running tests locally. This was happening
because the WebInspector was attempting to open a new connection to a web process that had already
terminated its mach port connection (a dead port).

We should avoid opening new connections when the port we were given is already dead.

* Platform/IPC/Connection.h:
(IPC::Connection::identifierIsValid): Added.
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::platformInitialize): Do not perform initialization on a dead (or null) port.
(IPC::Connection::open): Add some assertions that ports are in a valid state.
(IPC::Connection::sendOutgoingMessage): Assert that the send port is not dead.
(IPC::Connection::receiveSourceEventHandler): Assert that the receive port is valid.
* UIProcess/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::didFinishLaunching): Treat a dead port as a signal that the
child process failed to launch.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didFinishLaunching): Ditto.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching): Ditto.
* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::didFinishLaunching): Ditto.
* WebProcess/Plugins/PluginProcessConnectionManager.cpp:
(WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Ditto.
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::establishConnection): Ditto.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureNetworkProcessConnection): Ditto.
(WebKit::WebProcess::ensureWebToStorageProcessConnection): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/Platform/IPC/Connection.h
Source/WebKit/Platform/IPC/mac/ConnectionMac.mm
Source/WebKit/UIProcess/ChildProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/WebProcess/Plugins/PluginProcessConnectionManager.cpp
Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit/WebProcess/WebProcess.cpp