WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jun 2019 01:07:16 +0000 (01:07 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jun 2019 01:07:16 +0000 (01:07 +0000)
commit0189b11fffdb2678adcb206d90b9e0a11939e709
treea6d32467e87e063d4c1d4d69700a91ed6c8445ea
parent301f4404504b68756d594524eb693d2f7d150dbb
WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier is valid
https://bugs.webkit.org/show_bug.cgi?id=198865
<rdar://problem/51618878>

Reviewed by Brady Eidson.

NetworkProcess currently instructs UIProcess whether a given WebProcess is doing upload.
There is no guarantee though that the WebProcessProxy is still there when the IPC is arriving at UIProcess.
Instead, let WebProcess handles its upload state and notify WebProcessPool about its state.
Make sure WebProcessProxy unregisters itself in case of crash.
In case of NetworkProcess crash, WebProcesses will see all their uploads fail
and will notify automatically UIProcess to update their state.

Since the processID given to WebProcessPool is coming from IPC, we cannot not trust it.
Add early return in case of not finding a WebProcessProxy for WebProcessPool clear/set methods.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkResourceLoadMap.cpp:
(WebKit::NetworkResourceLoadMap::add):
(WebKit::NetworkResourceLoadMap::take):
* NetworkProcess/NetworkResourceLoadMap.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setWebProcessHasUploads):
(WebKit::WebProcessPool::clearWebProcessHasUploads):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
(WebKit::WebLoaderStrategy::remove):
(WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureNetworkProcessConnection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/NetworkProcess/NetworkResourceLoadMap.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoadMap.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
Source/WebKit/WebProcess/WebProcess.cpp