Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 69059cf01c1250dbde4796c1df60efd4e08e02b0 https://github.com/WebKit/WebKit/commit/69059cf01c1250dbde4796c1df60efd4e08e02b0 Author: Wenson Hsieh <wenson_hs...@apple.com> Date: 2022-10-10 (Mon, 10 Oct 2022)
Changed paths: M Source/WebKit/UIProcess/mac/WebViewImpl.mm M Tools/TestWebKitAPI/Tests/WebKitCocoa/PrepareForMoveToWindow.mm Log Message: ----------- [macOS] TV app crashes when unparenting a web view while setting up Apple One https://bugs.webkit.org/show_bug.cgi?id=246250 rdar://97021716 Reviewed by Devin Rousso. Make it safe for WebKit clients to use `-_prepareForMoveToWindow:completionHandler:` before unparenting a web view. Currently, this results in an Objective-C exception due to `-[WKWindowVisibilityObserver stopObserving:]` being called twice in a row. Because we've already removed the "contentLayoutRect" and "titlebarAppearsTransparent" key path observers during the first call, the second call throws an exception. Make `WKWindowVisibilityObserver` robust in this scenario by keeping track of the `NSWindow` we're currently observing, so that we never end up trying to either install duplicate key path observers, or attempt to remove nonexistent observers. Test: WKWebView.PrepareToUnparentView * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (-[WKWindowVisibilityObserver startObserving:]): (-[WKWindowVisibilityObserver stopObserving:]): (-[WKWindowVisibilityObserver _observeWindow:]): Add a helper method to make it easy to safely change the observed window (see above for more details). * Tools/TestWebKitAPI/Tests/WebKitCocoa/PrepareForMoveToWindow.mm: Canonical link: https://commits.webkit.org/255359@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes