REGRESSION (r236512): [ Mac WK2 ] Layout Test editing/undo/undo-smart-delete-word...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 00:32:56 +0000 (00:32 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 00:32:56 +0000 (00:32 +0000)
commit85d33f95f73478c510beb2d557130689983fb1f0
treedf99441589c1c532b05085678ff40381a325fb43
parenta759a9e4fa1802997ebab9d949d5ef9f59f9d59f
REGRESSION (r236512): [ Mac WK2 ] Layout Test editing/undo/undo-smart-delete-word.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=190375
<rdar://problem/45177807>

Reviewed by Ryosuke Niwa.

The test is doing the following:
> document.execCommand("Delete"); document.execCommand("Undo");

Both operation are synchronous and rely on synchronous IPC from the WebProcess to the UIProcess.
However, for the undo operation to succeed, the first command need to have been registered with
with the UIProcess via the WebPageProxy::RegisterEditCommandForUndo IPC to the UIProcess, which
is asynchronous.

After r236512, the UIProcess no longer processes incoming sync / async IPC in order and thus,
it is possible for the WebPageProxy::ExecuteUndoRedo synchronous IPC to get processed by the
UIProcess *before* the WebPageProxy::RegisterEditCommandForUndo asynchronous IPC for the
previous "Delete" command. As a result, canUndo would return false and we would fail to undo.

To address the issue, use SendOption::DispatchMessageEvenWhenWaitingForSyncReply flag when sending
the WebPageProxy::RegisterEditCommandForUndo IPC, so that it gets processed in order with regards
to surrounding synchronous IPC.

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::registerUndoStep):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp