Title: [228854] trunk/Source/WebKit
Revision
228854
Author
bb...@apple.com
Date
2018-02-20 18:17:57 -0800 (Tue, 20 Feb 2018)

Log Message

ASSERT under WebAutomationSession::setProcessPool() when running W3C test suite a second time
https://bugs.webkit.org/show_bug.cgi?id=182991
<rdar://problem/37620578>

Reviewed by Timothy Hatcher.

Sometimes when running more than one session end-to-end with the same browser instance,
UIProcess would crash under addMessageReceiver because another WebAutomationSession was still
registered. This is hard to reproduce, but upon code inspection, the receiver management code
is somewhat problematic because it only runs when the WebAutomationSession destructor runs.
In some cases the client could retain two sessions and cause the first one to never remove itself
as the message receiver.

Instead of unregistering the session as a message receiver underneath the session's destructor,
do this whenever a new session supplants an old session since there is only one active session at a time.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::~WebAutomationSession):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setAutomationSession):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (228853 => 228854)


--- trunk/Source/WebKit/ChangeLog	2018-02-21 01:32:26 UTC (rev 228853)
+++ trunk/Source/WebKit/ChangeLog	2018-02-21 02:17:57 UTC (rev 228854)
@@ -1,3 +1,26 @@
+2018-02-20  Brian Burg  <bb...@apple.com>
+
+        ASSERT under WebAutomationSession::setProcessPool() when running W3C test suite a second time
+        https://bugs.webkit.org/show_bug.cgi?id=182991
+        <rdar://problem/37620578>
+
+        Reviewed by Timothy Hatcher.
+
+        Sometimes when running more than one session end-to-end with the same browser instance,
+        UIProcess would crash under addMessageReceiver because another WebAutomationSession was still
+        registered. This is hard to reproduce, but upon code inspection, the receiver management code
+        is somewhat problematic because it only runs when the WebAutomationSession destructor runs.
+        In some cases the client could retain two sessions and cause the first one to never remove itself
+        as the message receiver.
+
+        Instead of unregistering the session as a message receiver underneath the session's destructor,
+        do this whenever a new session supplants an old session since there is only one active session at a time.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::~WebAutomationSession):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::setAutomationSession):
+
 2018-02-20  Tim Horton  <timothy_hor...@apple.com>
 
         Introduce HAVE(IOSURFACE_ACCELERATOR)

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (228853 => 228854)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-21 01:32:26 UTC (rev 228853)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-21 02:17:57 UTC (rev 228854)
@@ -71,9 +71,7 @@
 WebAutomationSession::~WebAutomationSession()
 {
     ASSERT(!m_client);
-
-    if (m_processPool)
-        m_processPool->removeMessageReceiver(Messages::WebAutomationSession::messageReceiverName());
+    ASSERT(!m_processPool);
 }
 
 void WebAutomationSession::setClient(std::unique_ptr<API::AutomationSessionClient>&& client)

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (228853 => 228854)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-02-21 01:32:26 UTC (rev 228853)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-02-21 02:17:57 UTC (rev 228854)
@@ -1502,6 +1502,9 @@
 
 void WebProcessPool::setAutomationSession(RefPtr<WebAutomationSession>&& automationSession)
 {
+    if (m_automationSession)
+        m_automationSession->setProcessPool(nullptr);
+    
     m_automationSession = WTFMove(automationSession);
 
 #if ENABLE(REMOTE_INSPECTOR)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to