[iOS 17.4] ~11 layout tests debug assert in -handleKeyEntry:withCompletionHandler:#25836
Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom Mar 14, 2024
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash f0f4a9f) Details
|
aprotyas
approved these changes
Mar 13, 2024
Member
Author
|
Thanks for the review! This API test failure is legit (and pretty subtle) — we should be defaulting to |
Collaborator
|
EWS run on current version of this PR (hash 7abc100) Details
|
…letionHandler:` https://bugs.webkit.org/show_bug.cgi?id=270928 rdar://123028621 Reviewed by Abrar Rahman Protyasha. The new debug assertion in `-handleKeyEntry:withCompletionHandler:` (which sanity checks that the key event completion handler for an incoming event `e` is invoked with `e`) is sometimes hit when running layout tests that send synthetic key events. This reveals an existing bug, wherein `WKContentView`'s `_keyWebEventHandler` is replaced with another incoming ObjC block in the case when async key events are invoked back-to-back, before the preceding key event's completion handler has been called. This causes the latter key event handler to be called with the previous key event, and also means that the previous key event handler won't ever be called. In practice, this is not an issue because UIKit's `UIKeyboardTaskQueue` doesn't attempt to send the next key event until the previous one has finished processing (i.e., WebKit has called the completion block associated with the event); this is likely an artifact of how HID key events are synthesized and dispatched in WebKitTestRunner. However, the `BETextInput` protocol doesn't inherently require or enforce this invariant, so it probably makes more sense for `WKContentView` to be robust for this scenario and call all incoming key event handler completion blocks with their corresponding appropriate events. To ensure this, we replace the current `_keyWebEventHandler` instance variable with a vector of events and completion blocks. This allows us to store multiple completion blocks if needed (for each key event that's currently in-flight), and invoke the correct event handler in response. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: Replace `_keyWebEventHandler` with `_keyWebEventHandlers`, a `Vector` of `WebEvent`s and completion handler blocks. See above for more details. (-[WKContentView cleanUpInteraction]): (-[WKContentView _cancelPendingKeyEventHandlers:]): (-[WKContentView resignFirstResponderForWebView]): (-[WKContentView _internalHandleKeyWebEvent:withCompletionHandler:]): (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): (-[WKContentView _cancelPendingKeyEventHandler]): Deleted. Canonical link: https://commits.webkit.org/276062@main
7abc100 to
a477452
Compare
Collaborator
|
Committed 276062@main (a477452): https://commits.webkit.org/276062@main Reviewed commits have been landed. Closing PR #25836 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧪 api-wpe
🧪 api-ios
a477452
7abc100
🛠 ios-sim🧪 wpe-wk2🧪 mac-AS-debug-wk2