Skip to content

Commit

Permalink
Merge r232111 - [GTK] WebDriver: implement AutomationSessionClient::d…
Browse files Browse the repository at this point in the history
…idDisconnectFromRemote

https://bugs.webkit.org/show_bug.cgi?id=185866

Reviewed by Brian Burg.

Source/WebDriver:

Close the dbus connection when receiving an empty target list.

* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::setTargetList):

Source/WebKit:

To handle the case of the session being closed by the browser, for example in case of a network process
crash. This is currently causing WebDriver tests to timeout in the bot.

* UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
the WebContext that the session will be closed.
* UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
* UIProcess/API/glib/WebKitWebContextPrivate.h:
  • Loading branch information
carlosgcampos committed Jun 11, 2018
1 parent b7d6323 commit ee72f6b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/WebDriver/ChangeLog
@@ -1,3 +1,15 @@
2018-05-23 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
https://bugs.webkit.org/show_bug.cgi?id=185866

Reviewed by Brian Burg.

Close the dbus connection when receiving an empty target list.

* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::setTargetList):

2018-03-05 Carlos Garcia Campos <cgarcia@igalia.com>

WebDriver: Also ignore NoSuchwindow errors when waiting for navigation to complete
Expand Down
2 changes: 2 additions & 0 deletions Source/WebDriver/glib/SessionHostGlib.cpp
Expand Up @@ -306,6 +306,8 @@ void SessionHost::setTargetList(uint64_t connectionID, Vector<Target>&& targetLi
if (targetList.isEmpty()) {
m_target = Target();
m_connectionID = 0;
if (m_dbusConnection)
g_dbus_connection_close(m_dbusConnection.get(), nullptr, nullptr, nullptr);
return;
}

Expand Down
15 changes: 15 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,18 @@
2018-05-23 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
https://bugs.webkit.org/show_bug.cgi?id=185866

Reviewed by Brian Burg.

To handle the case of the session being closed by the browser, for example in case of a network process
crash. This is currently causing WebDriver tests to timeout in the bot.

* UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
the WebContext that the session will be closed.
* UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
* UIProcess/API/glib/WebKitWebContextPrivate.h:

2018-06-11 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Remove PRIVATE keyword added in r232676.
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
Expand Up @@ -82,6 +82,11 @@ class AutomationSessionClient final : public API::AutomationSessionClient {
return String::fromUTF8(m_session->priv->id.data());
}

void didDisconnectFromRemote(WebAutomationSession&) override
{
webkitWebContextWillCloseAutomationSession(m_session->priv->webContext);
}

WebPageProxy* didRequestNewWindow(WebAutomationSession&) override
{
WebKitWebView* webView = nullptr;
Expand Down
6 changes: 6 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Expand Up @@ -242,6 +242,12 @@ class WebKitAutomationClient final : Inspector::RemoteInspector::Client {

WebKitWebContext* m_webContext;
};

void webkitWebContextWillCloseAutomationSession(WebKitWebContext* webContext)
{
webContext->priv->processPool->setAutomationSession(nullptr);
webContext->priv->automationSession = nullptr;
}
#endif // ENABLE(REMOTE_INSPECTOR)

WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)
Expand Down
3 changes: 3 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitWebContextPrivate.h
Expand Up @@ -47,3 +47,6 @@ void webkitWebContextWebViewDestroyed(WebKitWebContext*, WebKitWebView*);
WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext*, WebKit::WebPageProxy*);
GVariant* webkitWebContextInitializeWebExtensions(WebKitWebContext*);
void webkitWebContextInitializeNotificationPermissions(WebKitWebContext*);
#if ENABLE(REMOTE_INSPECTOR)
void webkitWebContextWillCloseAutomationSession(WebKitWebContext*);
#endif

0 comments on commit ee72f6b

Please sign in to comment.