Title: [208657] trunk/Source/WebKit2
Revision
208657
Author
[email protected]
Date
2016-11-12 14:24:33 -0800 (Sat, 12 Nov 2016)

Log Message

Web Automation: terminate the automation session if the web process crashes
https://bugs.webkit.org/show_bug.cgi?id=164671
<rdar://problem/29028964>

Reviewed by Joseph Pecoraro.

* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::disconnect):
(WebKit::WebAutomationSession::terminate):
Factor out code that disconnects the remote, unpairs, and notifies the client.
Then, expose terminate() which can be called without a FrontendChannel.
Calling this causes the _WKAutomationDelegate to clear the local-side session in the
browser, and disconnecting from the remote will hang up the remote-side session.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidCrash):
Terminate the session.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (208656 => 208657)


--- trunk/Source/WebKit2/ChangeLog	2016-11-12 21:34:42 UTC (rev 208656)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-12 22:24:33 UTC (rev 208657)
@@ -1,3 +1,24 @@
+2016-11-12  Brian Burg  <[email protected]>
+
+        Web Automation: terminate the automation session if the web process crashes
+        https://bugs.webkit.org/show_bug.cgi?id=164671
+        <rdar://problem/29028964>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/Automation/WebAutomationSession.h:
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::disconnect):
+        (WebKit::WebAutomationSession::terminate):
+        Factor out code that disconnects the remote, unpairs, and notifies the client.
+        Then, expose terminate() which can be called without a FrontendChannel.
+        Calling this causes the _WKAutomationDelegate to clear the local-side session in the
+        browser, and disconnecting from the remote will hang up the remote-side session.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::processDidCrash):
+        Terminate the session.
+
 2016-11-11  Alex Christensen  <[email protected]>
 
         Use SecurityOriginData as keys in StorageManager

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (208656 => 208657)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-11-12 21:34:42 UTC (rev 208656)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-11-12 22:24:33 UTC (rev 208657)
@@ -129,18 +129,26 @@
 void WebAutomationSession::disconnect(Inspector::FrontendChannel* channel)
 {
     ASSERT(channel == m_remoteChannel);
+    terminate();
+}
 
-    m_remoteChannel = nullptr;
-    m_frontendRouter->disconnectFrontend(channel);
+#endif // ENABLE(REMOTE_INSPECTOR)
 
+void WebAutomationSession::terminate()
+{
+#if ENABLE(REMOTE_INSPECTOR)
+    if (Inspector::FrontendChannel* channel = m_remoteChannel) {
+        m_remoteChannel = nullptr;
+        m_frontendRouter->disconnectFrontend(channel);
+    }
+
     setIsPaired(false);
+#endif
 
     if (m_client)
         m_client->didDisconnectFromRemote(this);
 }
 
-#endif // ENABLE(REMOTE_INSPECTOR)
-
 WebPageProxy* WebAutomationSession::webPageProxyForHandle(const String& handle)
 {
     auto iter = m_handleWebPageMap.find(handle);

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (208656 => 208657)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-11-12 21:34:42 UTC (rev 208656)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-11-12 22:24:33 UTC (rev 208657)
@@ -93,6 +93,7 @@
     void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false) override;
     void disconnect(Inspector::FrontendChannel*) override;
 #endif
+    void terminate();
 
     // Inspector::AutomationBackendDispatcherHandler API
     void getBrowsingContexts(Inspector::ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>&) override;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208656 => 208657)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-12 21:34:42 UTC (rev 208656)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-12 22:24:33 UTC (rev 208657)
@@ -5287,6 +5287,11 @@
         m_navigationClient->processDidCrash(*this);
     else
         m_loaderClient->processDidCrash(*this);
+
+    if (m_controlledByAutomation) {
+        if (auto* automationSession = process().processPool().automationSession())
+            automationSession->terminate();
+    }
 }
 
 #if PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to