Title: [127161] trunk/Source/WebKit/mac
- Revision
- 127161
- Author
- [email protected]
- Date
- 2012-08-30 10:59:47 -0700 (Thu, 30 Aug 2012)
Log Message
[Mac] Registering web views for notifications is unbalanced
https://bugs.webkit.org/show_bug.cgi?id=95465
<rdar://problem/12206765>
Reviewed by Darin Adler.
Setting the notification provider for a WK1 WebView registers that web view to the
provider. When the WebView is closed, WebCore is essentially responsible for
unregistering the web view. This leads to an imbalance on Lion since notifications are
not supported, and the NotificationController responsible for making the unregistration
call doesn't exist.
Instead, the unregisterWebView method should be called when the web view is closed.
* WebView/WebViewPrivate.h: Remove _notificationControllerDestroyed, since it is
unneeded.
* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::notificationControllerDestroyed):
* WebView/WebView.mm:
(-[WebView _close]): Unregister the web view from the assigned provider here.
(-[WebView _setNotificationProvider:]): Only allow setting the provider once, to avoid
registering the web view to multiple providers.
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (127160 => 127161)
--- trunk/Source/WebKit/mac/ChangeLog 2012-08-30 17:47:31 UTC (rev 127160)
+++ trunk/Source/WebKit/mac/ChangeLog 2012-08-30 17:59:47 UTC (rev 127161)
@@ -1,3 +1,29 @@
+2012-08-30 Jon Lee <[email protected]>
+
+ [Mac] Registering web views for notifications is unbalanced
+ https://bugs.webkit.org/show_bug.cgi?id=95465
+ <rdar://problem/12206765>
+
+ Reviewed by Darin Adler.
+
+ Setting the notification provider for a WK1 WebView registers that web view to the
+ provider. When the WebView is closed, WebCore is essentially responsible for
+ unregistering the web view. This leads to an imbalance on Lion since notifications are
+ not supported, and the NotificationController responsible for making the unregistration
+ call doesn't exist.
+
+ Instead, the unregisterWebView method should be called when the web view is closed.
+
+ * WebView/WebViewPrivate.h: Remove _notificationControllerDestroyed, since it is
+ unneeded.
+
+ * WebCoreSupport/WebNotificationClient.mm:
+ (WebNotificationClient::notificationControllerDestroyed):
+ * WebView/WebView.mm:
+ (-[WebView _close]): Unregister the web view from the assigned provider here.
+ (-[WebView _setNotificationProvider:]): Only allow setting the provider once, to avoid
+ registering the web view to multiple providers.
+
2012-08-29 Jon Lee <[email protected]>
[Mac] Add iconURL to WebNotification
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm (127160 => 127161)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm 2012-08-30 17:47:31 UTC (rev 127160)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm 2012-08-30 17:59:47 UTC (rev 127161)
@@ -160,9 +160,6 @@
void WebNotificationClient::notificationControllerDestroyed()
{
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- [m_webView _notificationControllerDestroyed];
-#endif
delete this;
}
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (127160 => 127161)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2012-08-30 17:47:31 UTC (rev 127160)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2012-08-30 17:59:47 UTC (rev 127161)
@@ -1140,6 +1140,8 @@
[self _clearGlibLoopObserver];
#endif
+ [[self _notificationProvider] unregisterWebView:self];
+
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -6517,17 +6519,12 @@
@implementation WebView (WebViewNotification)
- (void)_setNotificationProvider:(id<WebNotificationProvider>)notificationProvider
{
- if (_private) {
+ if (_private && !_private->_notificationProvider) {
_private->_notificationProvider = notificationProvider;
[_private->_notificationProvider registerWebView:self];
}
}
-- (void)_notificationControllerDestroyed
-{
- [[self _notificationProvider] unregisterWebView:self];
-}
-
- (id<WebNotificationProvider>)_notificationProvider
{
if (_private)
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (127160 => 127161)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2012-08-30 17:47:31 UTC (rev 127160)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2012-08-30 17:59:47 UTC (rev 127161)
@@ -734,7 +734,6 @@
@interface WebView (WebViewNotification)
- (void)_setNotificationProvider:(id<WebNotificationProvider>)notificationProvider;
- (id<WebNotificationProvider>)_notificationProvider;
-- (void)_notificationControllerDestroyed;
- (void)_notificationDidShow:(uint64_t)notificationID;
- (void)_notificationDidClick:(uint64_t)notificationID;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes