Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2019 00:12:51 +0000 (00:12 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2019 00:12:51 +0000 (00:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197361
<rdar://problem/49861407>

Reviewed by Brian Burg.

Don't assume that all elements have client rects (e.g. `getClientRects`). If the container
element isn't visible, then the child won't be either.

* UIProcess/Automation/SimulatedInputDispatcher.cpp:
(WebKit::SimulatedInputDispatcher::resolveLocation):
(WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):

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

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

index 8a95139..1c4bbc1 100644 (file)
@@ -1,3 +1,20 @@
+2019-04-30  Devin Rousso  <drousso@apple.com>
+
+        Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_during_click
+        https://bugs.webkit.org/show_bug.cgi?id=197361
+        <rdar://problem/49861407>
+
+        Reviewed by Brian Burg.
+
+        Don't assume that all elements have client rects (e.g. `getClientRects`). If the container
+        element isn't visible, then the child won't be either.
+
+        * UIProcess/Automation/SimulatedInputDispatcher.cpp:
+        (WebKit::SimulatedInputDispatcher::resolveLocation):
+        (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
+
 2019-04-30  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r244802.
index 35eb719..26a74e9 100644 (file)
@@ -222,7 +222,11 @@ void SimulatedInputDispatcher::resolveLocation(const WebCore::IntPoint& currentL
                 return;
             }
 
-            ASSERT(inViewCenterPoint);
+            if (!inViewCenterPoint) {
+                completionHandler(WTF::nullopt, AUTOMATION_COMMAND_ERROR_WITH_NAME(ElementNotInteractable));
+                return;
+            }
+
             destination.moveBy(inViewCenterPoint.value());
             completionHandler(destination, WTF::nullopt);
         });
@@ -269,7 +273,12 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource
                 eventDispatchFinished(error);
                 return;
             }
-            RELEASE_ASSERT(location);
+
+            if (!location) {
+                eventDispatchFinished(AUTOMATION_COMMAND_ERROR_WITH_NAME(ElementNotInteractable));
+                return;
+            }
+
             b.location = location;
             // The "dispatch a pointer{Down,Up,Move} action" algorithms (§17.4 Dispatching Actions).
             if (!a.pressedMouseButton && b.pressedMouseButton) {
@@ -303,7 +312,12 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource
                 eventDispatchFinished(error);
                 return;
             }
-            RELEASE_ASSERT(location);
+
+            if (!location) {
+                eventDispatchFinished(AUTOMATION_COMMAND_ERROR_WITH_NAME(ElementNotInteractable));
+                return;
+            }
+
             b.location = location;
             // The "dispatch a pointer{Down,Up,Move} action" algorithms (§17.4 Dispatching Actions).
             if (!a.pressedMouseButton && b.pressedMouseButton) {
index ac745a6..9850f0a 100644 (file)
@@ -1461,7 +1461,11 @@ void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page
             return;
         }
 
-        ASSERT(inViewCenterPoint);
+        if (!inViewCenterPoint) {
+            completionHandler(WTF::nullopt, AUTOMATION_COMMAND_ERROR_WITH_NAME(ElementNotInteractable));
+            return;
+        }
+
         completionHandler(inViewCenterPoint, WTF::nullopt);
     };