Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1007aa230ab983c5619c2023a8a1e71e9d818b97
      
https://github.com/WebKit/WebKit/commit/1007aa230ab983c5619c2023a8a1e71e9d818b97
  Author: Chris Dumez <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SOAuthorizationTests.mm

  Log Message:
  -----------
  Native SSO authentication load hangs when opening a tab in the background
https://bugs.webkit.org/show_bug.cgi?id=314189
rdar://171019203

Reviewed by Pascoe.

When a background tab triggers native SSO authentication, 
NavigationSOAuthorizationSession::beginAuthorizationIfReady()
sees that the page is not in a window and enters State::Waiting, registering a 
WebViewDidMoveToWindowObserver. When the
user later switches to that tab, Safari uses 
beginDeferringViewInWindowChanges/endDeferringViewInWindowChanges around the
tab switch. This causes viewDidMoveToWindow() to fire (which calls 
webViewDidMoveToWindow()) before IsInWindow is set in
the activity state. The observer checks page->isInWindow(), sees it's false, 
and returns early. Later,
endDeferringViewInWindowChanges() sets IsInWindow but never calls 
webViewDidMoveToWindow() again, so the observer is
never re-notified and the SSO session stays in State::Waiting permanently.

Fix this by calling webViewDidMoveToWindow() in 
endDeferringViewInWindowChanges() and endDeferringViewInWindowChangesSync()
after the activity state has been updated.

Test: 
SOAuthorizationRedirect.InterceptionSucceedEntersWaitingWithDeferredViewInWindowChanges

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::endDeferringViewInWindowChanges):
(WebKit::WebViewImpl::endDeferringViewInWindowChangesSync):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SOAuthorizationTests.mm:
(TestWebKitAPI::TEST(SOAuthorizationRedirect, 
InterceptionSucceedEntersWaitingWithDeferredViewInWindowChanges)):

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



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

Reply via email to