WebContext has '1:N' cross reference with WebProcessProxy. To delete those objects on finalization, it seems WebProcessProxy should notify itself to WebContext as an object could be deleted. However, there seem to be no interface under usual circumstances except forced termination, i.e. timeout and crash.
The loop is broken by WebContext::disconnectProcess().
(In reply to comment #1) > The loop is broken by WebContext::disconnectProcess(). Yes and before it we have 'WebProcessProxy::disconnect'. However, the problem I described is, WebProcessProxy couldn't trigger WebContext::disconnectProcess() on normal exit because it has no interface with it.
WebProcessProxy::disconnect() is executed on a message from WebProcess (ShouldTerminate).
(In reply to comment #3) > WebProcessProxy::disconnect() is executed on a message from WebProcess (ShouldTerminate). Yes and before it there is 'ChildProcess::terminationTimerFired()'. But, it seems not to be triggered on normal exit. It seems we don't have any IPC connection even if it is triggered because UI process already quit connection.
It's possible that it's not called on exit. Why do you want to spend extra time on cleanup during UI process exit?
(In reply to comment #5) > It's possible that it's not called on exit. Why do you want to spend extra time on cleanup during UI process exit? I am interested in cleaning WebContext on exit. What I have described in the bug is that I think we don't have any WK2 interface for it. Therefore, I would like to discuss for this and do fix if you would like it. :-)
That's probably worth discussing on webkit-dev first. We've said "no" to similar efforts before, since that's a lot of work and long-term liability for marginal benefit.