Crash in gamepads in WKWebView apps that also listen to the GameController framework themselves If an app's UI process uses GameController framework directly before a web page in a WKWebView does, then the GameController framework tells that app about attached controllers ahead of time. This subtlely gets WebKit's notion of attached game controllers out of sync with reality. If the user then moves a joystick on the gamepad to cause input (but not press a button to cause the gamepad to be exposed to the web page) then we crash. (And ASSERT in debug builds)
Created attachment 463363 [details] Patch
<rdar://problem/100036005>
Comment on attachment 463363 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=463363&action=review r=me > Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp:118 > + for (size_t i = 0; i < m_gamepads.size() && i < platformGamepads.size(); ++i) { You can compute 'auto end = std::min(m_gamepads.size(), platformGamepads.size())' outside the loop. A bit clearer and a bit more efficient.
Pull request: https://github.com/WebKit/WebKit/pull/6054
Committed 256255@main (809586a6b81e): <https://commits.webkit.org/256255@main> Reviewed commits have been landed. Closing PR #6054 and removing active labels.