Title: [213790] trunk/Source/WebKit2
Revision
213790
Author
[email protected]
Date
2017-03-13 02:21:34 -0700 (Mon, 13 Mar 2017)

Log Message

Web Automation: automation commands hang when trying to navigate go/back and it's not possible
https://bugs.webkit.org/show_bug.cgi?id=169407

Reviewed by Michael Catanzaro.

Trying to navigate back or forward when there are no back/forward items makes the automation commands to hang, because
navigation callback is never called. WebPageProxy returns nullptr to indicate no navigation will take place. In
that case we can consider that the operation succeeded.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::goBackInBrowsingContext):
(WebKit::WebAutomationSession::goForwardInBrowsingContext):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (213789 => 213790)


--- trunk/Source/WebKit2/ChangeLog	2017-03-13 09:15:51 UTC (rev 213789)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-13 09:21:34 UTC (rev 213790)
@@ -1,3 +1,18 @@
+2017-03-13  Carlos Garcia Campos  <[email protected]>
+
+        Web Automation: automation commands hang when trying to navigate go/back and it's not possible
+        https://bugs.webkit.org/show_bug.cgi?id=169407
+
+        Reviewed by Michael Catanzaro.
+
+        Trying to navigate back or forward when there are no back/forward items makes the automation commands to hang, because
+        navigation callback is never called. WebPageProxy returns nullptr to indicate no navigation will take place. In
+        that case we can consider that the operation succeeded.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::goBackInBrowsingContext):
+        (WebKit::WebAutomationSession::goForwardInBrowsingContext):
+
 2017-03-13  Zan Dobersek  <[email protected]>
 
         [WK2][CMake] Remove the intermediate NetworkProcess_COMMON_SOURCES variable

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (213789 => 213790)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2017-03-13 09:15:51 UTC (rev 213789)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2017-03-13 09:21:34 UTC (rev 213790)
@@ -309,9 +309,11 @@
 
     if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
         callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME(Timeout));
-    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
 
-    page->goBack();
+    if (page->goBack())
+        m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
+    else
+        callback->sendSuccess();
 }
 
 void WebAutomationSession::goForwardInBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<GoForwardInBrowsingContextCallback>&& callback)
@@ -322,9 +324,11 @@
 
     if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
         callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME(Timeout));
-    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
 
-    page->goForward();
+    if (page->goForward())
+        m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
+    else
+        callback->sendSuccess();
 }
 
 void WebAutomationSession::reloadBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<ReloadBrowsingContextCallback>&& callback)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to