Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 86165926688ee85b587a42ed20321e8e0ddeb7ba
https://github.com/WebKit/WebKit/commit/86165926688ee85b587a42ed20321e8e0ddeb7ba
Author: Chris Dumez <[email protected]>
Date: 2026-10-03 (Sat, 03 Oct 2026)
Changed paths:
M Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm
M Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.h
M Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm
M Source/WebKitLegacy/mac/WebView/WebView.mm
M Source/WebKitLegacy/mac/WebView/WebViewData.h
M Source/WebKitLegacy/mac/WebView/WebViewInternal.h
M Tools/TestWebKitAPI/PlatformCocoa.cmake
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKitLegacy/mac/DeallocWebViewProviders.mm
Log Message:
-----------
[Safer CPP] WebKitLegacy geolocation and notification clients lose access to
their WebView during -[WebView dealloc]
https://bugs.webkit.org/show_bug.cgi?id=325917
Reviewed by Alexey Proskuryakov and David Kilzer.
322353@main changed the WebView back-pointer in WebGeolocationClient and
WebNotificationClient
from a raw pointer to __weak, which regressed teardown: a __weak read returns
nil once
-[WebView dealloc] starts. The page is torn down inside dealloc -> close, so
the geolocation
provider never gets unregisterWebView: and the notification provider never gets
notificationDestroyed:, leaving dangling WebView pointers in the providers.
Handle this on the Objective-C side rather than having the C++ clients reach
the WebView during
teardown. The WebView now tracks whether it is registered with its geolocation
provider and
unregisters itself in -dealloc if needed. WebNotificationClient keeps a weak
reference to the
provider it shows notifications with, so cancel and destroy no longer go
through the WebView.
The editor and progress clients switched to __weak in 322353@main now post
their macOS
notifications with a nil object during -[WebView dealloc].
* Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm:
(WebGeolocationClient::startUpdating):
(WebGeolocationClient::stopUpdating):
* Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::show):
(WebNotificationClient::cancel):
(WebNotificationClient::notificationObjectDestroyed):
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView dealloc]):
(-[WebView _registerWithGeolocationProvider]):
(-[WebView _unregisterFromGeolocationProvider]):
* Source/WebKitLegacy/mac/WebView/WebViewData.h:
* Source/WebKitLegacy/mac/WebView/WebViewInternal.h:
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitLegacy/mac/DeallocWebViewProviders.mm: Added.
(-[DeallocWebViewTestWebView dealloc]):
(TestWebKitAPI::TEST(WebKitLegacy,
GeolocationProviderUnregistersWebViewOnDealloc)):
(TestWebKitAPI::TEST(WebKitLegacy,
GeolocationProviderNotUnregisteredOnDeallocWhenUnused)):
(TestWebKitAPI::TEST(WebKitLegacy,
NotificationProviderNotifiedOfDestroyedNotificationsOnDealloc)):
Canonical link: https://commits.webkit.org/322602@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications