- Revision
- 248047
- Author
- [email protected]
- Date
- 2019-07-31 10:37:51 -0700 (Wed, 31 Jul 2019)
Log Message
REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
https://bugs.webkit.org/show_bug.cgi?id=200086
<rdar://problem/53501721>
Reviewed by Alex Christensen.
Source/WebKit:
The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
test was flaky because it expected the network process to receive the IPC from the UIProcess
*before* the one from the WebContent process. However, there is no guarantee about ordering
from IPC messages coming from different connections.
To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
process processes this IPC *before* receiving any IPC from the WebContent process that is
the result of IPC from the UIProcess.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
(WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
* UIProcess/WebProcessPool.h:
Tools:
re-enable the API test.
* TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (248046 => 248047)
--- trunk/Source/WebKit/ChangeLog 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/ChangeLog 2019-07-31 17:37:51 UTC (rev 248047)
@@ -1,3 +1,36 @@
+2019-07-31 Chris Dumez <[email protected]>
+
+ REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
+ https://bugs.webkit.org/show_bug.cgi?id=200086
+ <rdar://problem/53501721>
+
+ Reviewed by Alex Christensen.
+
+ The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
+ run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
+ test was flaky because it expected the network process to receive the IPC from the UIProcess
+ *before* the one from the WebContent process. However, there is no guarantee about ordering
+ from IPC messages coming from different connections.
+
+ To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
+ synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
+ process processes this IPC *before* receiving any IPC from the WebContent process that is
+ the result of IPC from the UIProcess.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
+ (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
+ * UIProcess/WebProcessPool.h:
+
2019-07-31 Wenson Hsieh <[email protected]>
[iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (248046 => 248047)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-07-31 17:37:51 UTC (rev 248047)
@@ -2110,6 +2110,12 @@
RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processWillSuspendImminently() END", this);
}
+void NetworkProcess::processWillSuspendImminentlyForTestingSync(CompletionHandler<void()>&& completionHandler)
+{
+ processWillSuspendImminently();
+ completionHandler();
+}
+
void NetworkProcess::prepareToSuspend()
{
RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::prepareToSuspend()", this);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (248046 => 248047)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-07-31 17:37:51 UTC (rev 248047)
@@ -181,6 +181,7 @@
bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }
void processWillSuspendImminently();
+ void processWillSuspendImminentlyForTestingSync(CompletionHandler<void()>&&);
void prepareToSuspend();
void cancelPrepareToSuspend();
void processDidResume();
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (248046 => 248047)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-07-31 17:37:51 UTC (rev 248047)
@@ -79,6 +79,7 @@
ProcessDidTransitionToForeground()
ProcessWillSuspendImminently()
+ ProcessWillSuspendImminentlyForTestingSync() -> () Synchronous
PrepareToSuspend()
CancelPrepareToSuspend()
ProcessDidResume()
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (248046 => 248047)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2019-07-31 17:37:51 UTC (rev 248047)
@@ -439,7 +439,7 @@
- (void)_sendNetworkProcessWillSuspendImminently
{
- _processPool->sendNetworkProcessWillSuspendImminently();
+ _processPool->sendNetworkProcessWillSuspendImminentlyForTesting();
}
- (void)_sendNetworkProcessDidResume
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (248046 => 248047)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-07-31 17:37:51 UTC (rev 248047)
@@ -981,6 +981,12 @@
if (canSendMessage())
send(Messages::NetworkProcess::ProcessWillSuspendImminently(), 0);
}
+
+void NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting()
+{
+ if (canSendMessage())
+ sendSync(Messages::NetworkProcess::ProcessWillSuspendImminentlyForTestingSync(), Messages::NetworkProcess::ProcessWillSuspendImminentlyForTestingSync::Reply(), 0);
+}
void NetworkProcessProxy::sendPrepareToSuspend()
{
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (248046 => 248047)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-07-31 17:37:51 UTC (rev 248047)
@@ -185,6 +185,8 @@
// ProcessThrottlerClient
void sendProcessWillSuspendImminently() final;
void sendProcessDidResume() final;
+
+ void sendProcessWillSuspendImminentlyForTesting();
private:
// AuxiliaryProcessProxy
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (248046 => 248047)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-07-31 17:37:51 UTC (rev 248047)
@@ -1776,10 +1776,10 @@
m_didNetworkProcessCrash = true;
}
-void WebProcessPool::sendNetworkProcessWillSuspendImminently()
+void WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting()
{
if (m_networkProcess)
- m_networkProcess->sendProcessWillSuspendImminently();
+ m_networkProcess->sendProcessWillSuspendImminentlyForTesting();
}
void WebProcessPool::sendNetworkProcessDidResume()
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (248046 => 248047)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2019-07-31 17:37:51 UTC (rev 248047)
@@ -312,7 +312,7 @@
void clearCachedCredentials();
void clearPermanentCredentialsForProtectionSpace(WebCore::ProtectionSpace&&, CompletionHandler<void()>&&);
void terminateNetworkProcess();
- void sendNetworkProcessWillSuspendImminently();
+ void sendNetworkProcessWillSuspendImminentlyForTesting();
void sendNetworkProcessDidResume();
void terminateServiceWorkerProcesses();
void disableServiceWorkerProcessTerminationDelay();
Modified: trunk/Tools/ChangeLog (248046 => 248047)
--- trunk/Tools/ChangeLog 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Tools/ChangeLog 2019-07-31 17:37:51 UTC (rev 248047)
@@ -1,3 +1,16 @@
+2019-07-31 Chris Dumez <[email protected]>
+
+ REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
+ https://bugs.webkit.org/show_bug.cgi?id=200086
+ <rdar://problem/53501721>
+
+ Reviewed by Alex Christensen.
+
+ re-enable the API test.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
+ (TEST):
+
2019-07-31 Wenson Hsieh <[email protected]>
[iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm (248046 => 248047)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm 2019-07-31 17:31:17 UTC (rev 248046)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm 2019-07-31 17:37:51 UTC (rev 248047)
@@ -112,7 +112,7 @@
TestWebKitAPI::Util::run(&readyToContinue);
}
-TEST(WKWebView, DISABLED_LocalStorageProcessSuspends)
+TEST(WKWebView, LocalStorageProcessSuspends)
{
readyToContinue = false;
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {