Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 807c526fad673c68ec2691e3e31657caa8e17f94
      
https://github.com/WebKit/WebKit/commit/807c526fad673c68ec2691e3e31657caa8e17f94
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-07-14 (Mon, 14 Jul 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm

  Log Message:
  -----------
  [macOS] Safari sometimes stalls when entering window fullscreen from Start 
Page
https://bugs.webkit.org/show_bug.cgi?id=295931
rdar://152090882

Reviewed by Tim Horton.

This is a speculative fix for rdar://152090882, wherein Safari becomes 
(visually) unresponsive when
entering window fullscreen, due to the ObjC block returned by 
`-_holdResizeSnapshotWithReason:`
staying around for much longer than intended. I wasn't able to reproduce this 
locally, but we can
implement several mitigations to improve this:

1.  Avoid holding the resize snapshot in the case where the web process is 
already known to be
    unresponsive, and is unlikely to complete a presentation update in a 
reasonable amount of time
    anyways.

2.  Avoid holding the resize snapshot in the case where the web process has 
been suspended, for the
    same reason.

3.  Avoid holding the resize snapshot if the web view `-isHidden`. There's no 
point in blocking on
    web content painting, since the page won't be visible to the user anyways.

4.  If all else fails, install a watchdog timer to ensure that the resize 
snapshot is invalidated
    after a fairly short delay (1 second), which should be more than sufficient 
for a single
    presentation update. This is currently unbounded, leading to the whole 
Safari app being
    unresponsive for an indefinite (in the bug, anywhere from 5 seconds to 
minute-long) amount of
    time.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _invalidateWindowSnapshotReadinessHandler]):
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _holdWindowResizeSnapshotIfNeeded]):

See above for more details. Additionally add more release logging, to make it 
easier to root-cause
similar issues with resize snapshots moving forward.

(-[WKWebView _doWindowSnapshotReadinessUpdate]):

Make this invoke `-_invalidateWindowSnapshotReadinessHandler` after 1 second, 
using
`-performSelector:withObject:afterDelay:`. This operation is canceled early if 
the presentation
update finishes first.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to