Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f76cc7fea13aca9f03c2886598932d7aeef854d2
https://github.com/WebKit/WebKit/commit/f76cc7fea13aca9f03c2886598932d7aeef854d2
Author: Pascoe <[email protected]>
Date: 2026-06-01 (Mon, 01 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/ModalDialogDuringOverlappingFocus.mm
Log Message:
-----------
[iOS] Modal JavaScript dialog hangs WebContent after overlapping async
element focus
https://bugs.webkit.org/show_bug.cgi?id=315708
rdar://174802752
Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.
When two `-[WKContentView _elementDidFocus:]` calls overlap and both go
through `-_webView:focusRequiresStrongPasswordAssistance:completionHandler:`
(introduced in 289895@main), their `CompletionHandlerCallingScope`s can
unwind in non-LIFO order. The second-to-fire scope writes its stale
captured `YES` over the first's correct restore to `NO`, leaving
`_isFocusingElementWithKeyboard` stuck. Every subsequent JS modal dialog
is then deferred at `-[WKContentView runModalJavaScriptDialog:]` and
never fired, hanging WebContent in `IPC::Connection::waitForSyncReply`.
Reproducible on zillow.com via its geolocation error `alert()`.
Replace the capture-and-restore with a generation counter: each
`_elementDidFocus:` call increments `_focusGeneration` and captures the
value. On scope unwind, only the latest generation resets the bools and
fires the deferred modal callback. Earlier (superseded) focus calls are
no-ops on unwind regardless of completion order.
Test:
TestWebKitAPI.ModalDialogDuringOverlappingFocus.AlertNotDeferredAfterFIFOAsyncFocusCompletions
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView
_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
(-[WKContentView
_continueElementDidFocus:requiresStrongPasswordAssistance:focusedElementInfo:activityStateChanges:restoreValues:]):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
*
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/ModalDialogDuringOverlappingFocus.mm:
Added.
(TestWebKitAPI::TEST(ModalDialogDuringOverlappingFocus,
AlertNotDeferredAfterFIFOAsyncFocusCompletions)):
Canonical link: https://commits.webkit.org/314318@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications