Title: [229277] releases/WebKitGTK/webkit-2.20/Source/WebDriver
Revision
229277
Author
carlo...@webkit.org
Date
2018-03-05 05:18:17 -0800 (Mon, 05 Mar 2018)

Log Message

Merge r229211 - WebDriver: Also ignore NoSuchwindow errors when waiting for navigation to complete
https://bugs.webkit.org/show_bug.cgi?id=183280

Reviewed by Brian Burg.

We currently ignore NoSuchFrame, but navigation or previous command might have closed the window too.

Fixes: imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py::testClickingOnAButtonThatClosesAnOpenWindowDoesNotCauseTheBrowserToHang
       imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py::testCanCallGetWindowHandlesAfterClosingAWindow

* Session.cpp:
(WebDriver::Session::waitForNavigationToComplete): Ignore NoSuchWindow errors.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebDriver/ChangeLog (229276 => 229277)


--- releases/WebKitGTK/webkit-2.20/Source/WebDriver/ChangeLog	2018-03-05 13:18:13 UTC (rev 229276)
+++ releases/WebKitGTK/webkit-2.20/Source/WebDriver/ChangeLog	2018-03-05 13:18:17 UTC (rev 229277)
@@ -1,3 +1,18 @@
+2018-03-05  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: Also ignore NoSuchwindow errors when waiting for navigation to complete
+        https://bugs.webkit.org/show_bug.cgi?id=183280
+
+        Reviewed by Brian Burg.
+
+        We currently ignore NoSuchFrame, but navigation or previous command might have closed the window too.
+
+        Fixes: imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py::testClickingOnAButtonThatClosesAnOpenWindowDoesNotCauseTheBrowserToHang
+               imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py::testCanCallGetWindowHandlesAfterClosingAWindow
+
+        * Session.cpp:
+        (WebDriver::Session::waitForNavigationToComplete): Ignore NoSuchWindow errors.
+
 2018-02-14  Brian Burg  <bb...@apple.com>
 
         Web Automation: combine session commands to resize and move top-level browsing contexts

Modified: releases/WebKitGTK/webkit-2.20/Source/WebDriver/Session.cpp (229276 => 229277)


--- releases/WebKitGTK/webkit-2.20/Source/WebDriver/Session.cpp	2018-03-05 13:18:13 UTC (rev 229276)
+++ releases/WebKitGTK/webkit-2.20/Source/WebDriver/Session.cpp	2018-03-05 13:18:17 UTC (rev 229277)
@@ -1378,10 +1378,16 @@
     m_host->sendCommandToBackend(ASCIILiteral("waitForNavigationToComplete"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
         if (response.isError) {
             auto result = CommandResult::fail(WTFMove(response.responseObject));
-            if (result.errorCode() == CommandResult::ErrorCode::NoSuchFrame) {
+            switch (result.errorCode()) {
+            case CommandResult::ErrorCode::NoSuchWindow:
+                // Window was closed, reset the top level browsing context and ignore the error.
+                m_toplevelBrowsingContext = std::nullopt;
+                break;
+            case CommandResult::ErrorCode::NoSuchFrame:
                 // Navigation destroyed the current frame, switch to top level browsing context and ignore the error.
                 switchToBrowsingContext(std::nullopt);
-            } else {
+                break;
+            default:
                 completionHandler(WTFMove(result));
                 return;
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to