Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigat...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2018 18:57:02 +0000 (18:57 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2018 18:57:02 +0000 (18:57 +0000)
commit45f7b167e254a85318ea17266dcf29b61e5e9d5c
tree53a37579e94ebc33747ee10e1f5e0e0828f3550b
parentac9a52d2126b46a644450de6b12e2b109e7d4ff2
Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=190052

Reviewed by Ryosuke Niwa.

Source/WebKit:

* Platform/IPC/Connection.cpp:
(IPC::Connection::sendMessage):
* Platform/IPC/Connection.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePagePostMessageIgnoringFullySynchronousMode):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
* WebProcess/WebPage/WebPage.h:

Tools:

The test relies on EventSender to send events to the page synchronously to the page and then uses console.log
to log those events. It also uses console.log() before sending those events to indicate what the test is about
to do. Note that console.log() normally causes the WebKitTestRunner to send an asynchronous IPC to the UIProcess
so that it can log the message.
The issue is that EventSender uses IPC::SendOption::UseFullySynchronousModeForTesting when sending the
sync IPC to the UIProcess. This option causes follow-up *asynchronous* IPC sent from the synchronous IPC reply
handler to be transformed into synchronous IPC.
As a result, some of the console.log IPC ended up being asynchronous and some other ended up being synchronous.
Because synchronous and asynchronous IPC is not necessarily processed in-order by the UIProcess, the logged
messages may end up being out of order, leading to flakiness.

To address the issue, we now make sure that InjectedBundle::outputText() uses a new IPC::SendOption indicated
that the IPC should always be sent asynchronously, even if the connection is in fully synchronous mode. As a
result, all text outputing IPC to the UIProcess will be asynchronous, and thus in order.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::outputText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/Platform/IPC/Connection.cpp
Source/WebKit/Platform/IPC/Connection.h
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp