Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Crash when running test wpt/tests/element_click/bubbling.py::test_ele…
…ment_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):


Canonical link: https://commits.webkit.org/211627@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed May 1, 2019
1 parent 1626f72 commit 83e1026
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
17 changes: 17 additions & 0 deletions Source/WebKit/ChangeLog
@@ -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.
Expand Down
20 changes: 17 additions & 3 deletions Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Expand Up @@ -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);
};

Expand Down

0 comments on commit 83e1026

Please sign in to comment.