haikuwebkit/LayoutTests/fast/forms/change-inputmode-crash-expe...

11 lines
354 B
Plaintext
Raw Permalink Normal View History

[iOS] Crash when changing inputmode for certain types of focusable elements https://bugs.webkit.org/show_bug.cgi?id=196431 <rdar://problem/49454962> Reviewed by Tim Horton. Source/WebKit: The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement is only set for certain types of elements that require user input (e.g. text fields, editable content, select menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's focused element doesn't fall into one of the aforementioned categories. To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused element. See below for more details. Test: fast/forms/change-inputmode-crash.html * WebProcess/WebPage/WebPage.cpp: (WebKit::isTextFormControlOrEditableContent): Clean up some existing logic by introducing a helper method for determining whether an element should propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead of checking against the tag name. (WebKit::WebPage::elementDidFocus): (WebKit::WebPage::focusedElementDidChangeInputMode): LayoutTests: Add a layout test that exercises the edge case; see WebKit ChangeLogs for more details. * fast/forms/change-inputmode-crash-expected.txt: Added. * fast/forms/change-inputmode-crash.html: Added. Canonical link: https://commits.webkit.org/210700@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-31 20:01:44 +00:00
This test verifies that changing the inputmode attribute after changing focus does not cause a crash. To manually run the test, load the page and verify that a crash does not occur.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.activeElement is target
PASS successfullyParsed is true
TEST COMPLETE