This is a speculative fix for recent reports that web pages are unresponsive to mouse events. In 269366@main, I removed code that explicitly cleared event queues on a process swap because, after 267849@main, we could rely on in-flight completion handlers to be called for terminated web processes. However, if the web process we are navigating away from does not terminate (i.e., if it is hosting another webpage), we rely on it to dequeue the events in the UI process. This change makes it so that we once again clear the event queues on a process swap. If the process we navigated away from has terminated or changed, we do not attempt to dequeue previous events because they have already been cleared. This way, if the source web process is unresponsive for any reason, it does not prevent events from being sent to the new page.
<rdar://problem/127788996>
Pull request: https://github.com/WebKit/WebKit/pull/28322
Committed 278568@main (fe4ddfdad76f): <https://commits.webkit.org/278568@main> Reviewed commits have been landed. Closing PR #28322 and removing active labels.
rdar://127828852
^ ignore rdar://127788996
Committed 272448.1068@safari-7618-branch (5d22b5945943): <https://commits.webkit.org/272448.1068@safari-7618-branch> Reviewed commits have been landed. Closing PR #1318 and removing active labels.