Web Automation: don't return an error if resizing/moving a window has no effect
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 22:36:15 +0000 (22:36 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 22:36:15 +0000 (22:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182742

Reviewed by Tim Horton.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
(WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
Unify the behavior for all ports. Don't raise an error if the command was
idempotent (by mistake or not). It should not be an error to re-maximize a window.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp

index 41b0eaa..d669e3b 100644 (file)
@@ -1,3 +1,16 @@
+2018-02-13  Brian Burg  <bburg@apple.com>
+
+        Web Automation: don't return an error if resizing/moving a window has no effect
+        https://bugs.webkit.org/show_bug.cgi?id=182742
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
+        (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
+        Unify the behavior for all ports. Don't raise an error if the command was
+        idempotent (by mistake or not). It should not be an error to re-maximize a window.
+
 2018-02-13  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Make WebCore headers copies
index 62eb426..136594a 100644 (file)
@@ -344,19 +344,7 @@ void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString&
             return callback->sendSuccess();
 
         page->setWindowFrame(newFrame);
-
-#if PLATFORM(GTK)
         callback->sendSuccess();
-#else
-        // If nothing changed at all, it's probably fair to report that something went wrong.
-        // (We can't assume that the requested frame size will be honored exactly, however.)
-        page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) {
-            if (originalFrame == updatedFrame)
-                callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not."));
-            else
-                callback->sendSuccess();
-        });
-#endif
     });
 #endif
 }
@@ -392,19 +380,7 @@ void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& e
             return callback->sendSuccess();
 
         page->setWindowFrame(newFrame);
-
-#if PLATFORM(GTK)
         callback->sendSuccess();
-#else
-        // If nothing changed at all, it's probably fair to report that something went wrong.
-        // (We can't assume that the requested frame size will be honored exactly, however.)
-        page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) {
-            if (originalFrame == updatedFrame)
-                callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not."));
-            else
-                callback->sendSuccess();
-        });
-#endif
     });
 #endif
 }