Changeset 208657 in webkit


Ignore:
Timestamp:
Nov 12, 2016 2:24:33 PM (7 years ago)
Author:
BJ Burg
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.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r208633 r208657  
     12016-11-12  Brian Burg  <bburg@apple.com>
     2
     3        Web Automation: terminate the automation session if the web process crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=164671
     5        <rdar://problem/29028964>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UIProcess/Automation/WebAutomationSession.h:
     10        * UIProcess/Automation/WebAutomationSession.cpp:
     11        (WebKit::WebAutomationSession::disconnect):
     12        (WebKit::WebAutomationSession::terminate):
     13        Factor out code that disconnects the remote, unpairs, and notifies the client.
     14        Then, expose terminate() which can be called without a FrontendChannel.
     15        Calling this causes the _WKAutomationDelegate to clear the local-side session in the
     16        browser, and disconnecting from the remote will hang up the remote-side session.
     17
     18        * UIProcess/WebPageProxy.cpp:
     19        (WebKit::WebPageProxy::processDidCrash):
     20        Terminate the session.
     21
    1222016-11-11  Alex Christensen  <achristensen@webkit.org>
    223
  • trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp

    r203635 r208657  
    130130{
    131131    ASSERT(channel == m_remoteChannel);
    132 
    133     m_remoteChannel = nullptr;
    134     m_frontendRouter->disconnectFrontend(channel);
     132    terminate();
     133}
     134
     135#endif // ENABLE(REMOTE_INSPECTOR)
     136
     137void WebAutomationSession::terminate()
     138{
     139#if ENABLE(REMOTE_INSPECTOR)
     140    if (Inspector::FrontendChannel* channel = m_remoteChannel) {
     141        m_remoteChannel = nullptr;
     142        m_frontendRouter->disconnectFrontend(channel);
     143    }
    135144
    136145    setIsPaired(false);
     146#endif
    137147
    138148    if (m_client)
    139149        m_client->didDisconnectFromRemote(this);
    140150}
    141 
    142 #endif // ENABLE(REMOTE_INSPECTOR)
    143151
    144152WebPageProxy* WebAutomationSession::webPageProxyForHandle(const String& handle)
  • trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h

    r204668 r208657  
    9494    void disconnect(Inspector::FrontendChannel*) override;
    9595#endif
     96    void terminate();
    9697
    9798    // Inspector::AutomationBackendDispatcherHandler API
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r208406 r208657  
    52885288    else
    52895289        m_loaderClient->processDidCrash(*this);
     5290
     5291    if (m_controlledByAutomation) {
     5292        if (auto* automationSession = process().processPool().automationSession())
     5293            automationSession->terminate();
     5294    }
    52905295}
    52915296
Note: See TracChangeset for help on using the changeset viewer.