Changeset 269421 in webkit


Ignore:
Timestamp:
Nov 5, 2020 12:47:42 AM (21 months ago)
Author:
Carlos Garcia Campos
Message:

WebDriver: handle surrogate pairs in keyboard actions
https://bugs.webkit.org/show_bug.cgi?id=218279

Reviewed by Brian Burg.

Source/WebKit:

And fail with invalid argument if the string can be represented as a single code point.

Fixes: imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f604]

imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f60d]
imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[fa]
imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbfb]
imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbf\u0ba8]
imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u1100\u1161\u11a8c]

  • UIProcess/Automation/WebAutomationSession.cpp:

(WebKit::pressedCharKey):
(WebKit::WebAutomationSession::performInteractionSequence):

WebDriverTests:

Remove expectations for tests that are now passing.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r269420 r269421  
     12020-11-05  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        WebDriver: handle surrogate pairs in keyboard actions
     4        https://bugs.webkit.org/show_bug.cgi?id=218279
     5
     6        Reviewed by Brian Burg.
     7
     8        And fail with invalid argument if the string can be represented as a single code point.
     9
     10        Fixes: imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f604]
     11               imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f60d]
     12               imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[fa]
     13               imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbfb]
     14               imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbf\u0ba8]
     15               imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u1100\u1161\u11a8c]
     16
     17        * UIProcess/Automation/WebAutomationSession.cpp:
     18        (WebKit::pressedCharKey):
     19        (WebKit::WebAutomationSession::performInteractionSequence):
     20
    1212020-11-05  Jiewen Tan  <jiewen_tan@apple.com>
    222
  • trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp

    r269419 r269421  
    19451945    }
    19461946}
     1947
     1948static Optional<UChar32> pressedCharKey(const String& pressedCharKeyString)
     1949{
     1950    switch (pressedCharKeyString.length()) {
     1951    case 1:
     1952        return pressedCharKeyString.characterAt(0);
     1953    case 2: {
     1954        auto lead = pressedCharKeyString.characterAt(0);
     1955        auto trail = pressedCharKeyString.characterAt(1);
     1956        if (U16_IS_LEAD(lead) && U16_IS_TRAIL(trail))
     1957            return U16_GET_SUPPLEMENTARY(lead, trail);
     1958    }
     1959    }
     1960
     1961    return WTF::nullopt;
     1962}
    19471963#endif // ENABLE(WEBDRIVER_ACTIONS_API)
    19481964
     
    20562072
    20572073            auto pressedCharKeyString = stateObject->getString("pressedCharKey"_s);
    2058             if (!!pressedCharKeyString)
    2059                 sourceState.pressedCharKeys.add(pressedCharKeyString.characterAt(0));
     2074            if (!!pressedCharKeyString) {
     2075                auto charKey = pressedCharKey(pressedCharKeyString);
     2076                if (!charKey)
     2077                    ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "Invalid 'pressedCharKey'.");
     2078                sourceState.pressedCharKeys.add(*charKey);
     2079            }
    20602080
    20612081            if (auto pressedVirtualKeysArray = stateObject->getArray("pressedVirtualKeys"_s)) {
  • trunk/WebDriverTests/ChangeLog

    r269304 r269421  
     12020-11-05  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        WebDriver: handle surrogate pairs in keyboard actions
     4        https://bugs.webkit.org/show_bug.cgi?id=218279
     5
     6        Reviewed by Brian Burg.
     7
     8        Remove expectations for tests that are now passing.
     9
     10        * TestExpectations.json:
     11
    1122020-11-03  Lauro Moura  <lmoura@igalia.com>
    213
  • trunk/WebDriverTests/TestExpectations.json

    r269035 r269421  
    448448    },
    449449    "imported/w3c/webdriver/tests/perform_actions/key_special_keys.py": {
    450         "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/184967"}}
     450        "subtests": {
     451            "test_codepoint_keys_behave_correctly[\\u0ba8\\u0bbf]": {
     452                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/184967"}}
     453            },
     454            "test_codepoint_keys_behave_correctly[\\u1100\\u1161\\u11a8]": {
     455                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/184967"}}
     456            }
     457        }
    451458    },
    452459
Note: See TracChangeset for help on using the changeset viewer.