[webkit-changes] [WebKit/WebKit] feab6d: Make MockGamepadProvider robust so that it doesn't...

Chirag Shah noreply at github.com
Wed Jan 25 21:23:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: feab6de8fb5ee04b52a859ee7066266258c13b30
      https://github.com/WebKit/WebKit/commit/feab6de8fb5ee04b52a859ee7066266258c13b30
  Author: Chirag M Shah <chirag_m_shah at apple.com>
  Date:   2023-01-25 (Wed, 25 Jan 2023)

  Changed paths:
    M Source/WebCore/testing/MockGamepadProvider.cpp
    M Source/WebCore/testing/MockGamepadProvider.h

  Log Message:
  -----------
  Make MockGamepadProvider robust so that it doesn't end up crashing the test runner
https://bugs.webkit.org/show_bug.cgi?id=250605
rdar://104165858

Reviewed by David Kilzer.

This change adds more state to MockGamepadProvider so that it can track the gamepads
that were connected before the GamepadProviderClient starts monitoring. Before this change,
a simple snippet like:
<script>
  testRunner.setMockGamepadDetails(0);
  testRunner.connectMockGamepad(0);
  addEventListener('gamepadconnected', () => {});
</script>

would crash the test runner.

* Source/WebCore/testing/MockGamepadProvider.cpp:
(WebCore::MockGamepadProvider::startMonitoringGamepads):
(WebCore::MockGamepadProvider::stopMonitoringGamepads):
(WebCore::MockGamepadProvider::connectMockGamepad):
(WebCore::MockGamepadProvider::disconnectMockGamepad):
* Source/WebCore/testing/MockGamepadProvider.h:

Canonical link: https://commits.webkit.org/259411@main




More information about the webkit-changes mailing list