Changeset 239074 in webkit


Ignore:
Timestamp:
Dec 11, 2018 9:39:16 AM (5 years ago)
Author:
BJ Burg
Message:

SimulatedInputDispatcher::transitionInputSourceToState() can reuse a moved-from completion handler
https://bugs.webkit.org/show_bug.cgi?id=191155
<rdar://problem/45745569>

Reviewed by Joseph Pecoraro.

  • UIProcess/Automation/SimulatedInputDispatcher.cpp:

(WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
Add an ASSERT to guard against unexpected inputs where >1 VirtualKey changes per state.
webkitdriver needs to be updated to not produce such states in this scenario, but this will
avoid a runtime crash caused by trying to call a moved-out completion handler a second time.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r239072 r239074  
     12018-12-11  Brian Burg  <bburg@apple.com>
     2
     3        SimulatedInputDispatcher::transitionInputSourceToState() can reuse a moved-from completion handler
     4        https://bugs.webkit.org/show_bug.cgi?id=191155
     5        <rdar://problem/45745569>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UIProcess/Automation/SimulatedInputDispatcher.cpp:
     10        (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
     11        Add an ASSERT to guard against unexpected inputs where >1 VirtualKey changes per state.
     12        webkitdriver needs to be updated to not produce such states in this scenario, but this will
     13        avoid a runtime crash caused by trying to call a moved-out completion handler a second time.
     14
    1152018-12-11  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp

    r236939 r239074  
    298298            m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyRelease, a.pressedCharKey.value(), WTFMove(eventDispatchFinished));
    299299        } else if (a.pressedVirtualKeys != b.pressedVirtualKeys) {
     300            bool simulatedAnInteraction = false;
    300301            for (VirtualKey key : b.pressedVirtualKeys) {
    301302                if (!a.pressedVirtualKeys.contains(key)) {
     303                    ASSERT_WITH_MESSAGE(!simulatedAnInteraction, "Only one VirtualKey may differ at a time between two input source states.");
     304                    if (simulatedAnInteraction)
     305                        continue;
     306                    simulatedAnInteraction = true;
    302307#if !LOG_DISABLED
    303308                    String virtualKeyName = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(key);
     
    310315            for (VirtualKey key : a.pressedVirtualKeys) {
    311316                if (!b.pressedVirtualKeys.contains(key)) {
     317                    ASSERT_WITH_MESSAGE(!simulatedAnInteraction, "Only one VirtualKey may differ at a time between two input source states.");
     318                    if (simulatedAnInteraction)
     319                        continue;
     320                    simulatedAnInteraction = true;
    312321#if !LOG_DISABLED
    313322                    String virtualKeyName = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(key);
Note: See TracChangeset for help on using the changeset viewer.