Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 836e95d333f07b1b7dd8e1a173f5e20d23443dd3
      
https://github.com/WebKit/WebKit/commit/836e95d333f07b1b7dd8e1a173f5e20d23443dd3
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-10-31 (Fri, 31 Oct 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/ViewGestureController.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/NavigationSwipeTests.mm

  Log Message:
  -----------
  REGRESSION(iOS26): 
TestWebKitAPI.NavigationSwipeTests.RestoreFirstResponderAfterNavigationSwipe is 
a constant failure
https://bugs.webkit.org/show_bug.cgi?id=301656
rdar://163668275

Reviewed by Abrar Rahman Protyasha.

On iOS 26, UIKit calls `-[_UIViewControllerTransitionContext 
completeTransition:]` asynchronously
after ending a swipe transition animation (as a part of a larger set of changes 
to support
interruptible parallax transition animations). `-completeTransition:` then goes 
on to invoke the
swipe transition context's completion handler. However, the API tests in 
`NavigationSwipeTests`
currently expect this to happen synchronously after calling 
`_completeStoppedInteractiveTransition`
to simulate ending the swipe gesture. As a result, some of these tests either 
fail or are otherwise
no longer testing what they intend because they depend on 
`ViewGestureController::endSwipeGesture`
being called in `_completeStoppedInteractiveTransition`.

Fix this by waiting for `endSwipeGesture` to be invoked after 
`_completeStoppedInteractiveTransition`
by adding a new testing hook to check the state of `m_didCallEndSwipeGesture`, 
and spinning the
runloop until it has been set.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _didCallEndSwipeGestureForTesting]):
* Source/WebKit/UIProcess/ViewGestureController.h:
* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::didCallEndSwipeGestureForTesting const):

Add plumbing for a new testing property, `-[WKWebView 
_didCallEndSwipeGestureForTesting]`. See above
for more details.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/NavigationSwipeTests.mm:
(TestWebKitAPI::simulateBackSwipeAndWaitForGestureToEnd):

Add a helper to simulate a swipe (with an optional callback to invoke in 
between beginning and
completing the swipe). Deploy this in the three tests below to make sure we 
wait for the full swipe
interaction to complete.

(TestWebKitAPI::TEST(NavigationSwipeTests, 
RestoreFirstResponderAfterNavigationSwipe)):
(TestWebKitAPI::TEST(NavigationSwipeTests, 
DoNotBecomeFirstResponderAfterNavigationSwipeIfWebViewIsUnparented)):
(TestWebKitAPI::TEST(NavigationSwipeTests, 
DoNotAssertWhenSnapshottingZeroSizeView)):
(TestWebKitAPI::TEST(NavigationSwipeTests, 
DISABLED_RestoreFirstResponderAfterNavigationSwipe)): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to