Title: [221896] trunk/Source/WebKit
Revision
221896
Author
[email protected]
Date
2017-09-11 17:40:11 -0700 (Mon, 11 Sep 2017)

Log Message

Fix memory leak introduced in r221894.
https://bugs.webkit.org/show_bug.cgi?id=176753

* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
(WebKit::NotificationPermissionRequestManagerProxy::createRequest):
The NotificationPermissionRequestManagerProxy keeps track of pending requests
so they can be denied when invalidating the page.  We add them to a HashMap and in
r221894 I removed the code that removes them from that map once the request is complete.
This code adds the completed task removal back.
The NotificationPermissionRequestManagerProxy and WebPageProxy have the same lifetime,
so protecting the WebPageProxy (m_page) makes sure there is no use-after-free when the
completion handler is called.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (221895 => 221896)


--- trunk/Source/WebKit/ChangeLog	2017-09-12 00:10:09 UTC (rev 221895)
+++ trunk/Source/WebKit/ChangeLog	2017-09-12 00:40:11 UTC (rev 221896)
@@ -1,5 +1,20 @@
 2017-09-11  Alex Christensen  <[email protected]>
 
+        Fix memory leak introduced in r221894.
+        https://bugs.webkit.org/show_bug.cgi?id=176753
+
+        * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
+        (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
+        The NotificationPermissionRequestManagerProxy keeps track of pending requests
+        so they can be denied when invalidating the page.  We add them to a HashMap and in
+        r221894 I removed the code that removes them from that map once the request is complete.
+        This code adds the completed task removal back.
+        The NotificationPermissionRequestManagerProxy and WebPageProxy have the same lifetime,
+        so protecting the WebPageProxy (m_page) makes sure there is no use-after-free when the
+        completion handler is called.
+
+2017-09-11  Alex Christensen  <[email protected]>
+
         Make NotificationPermissionRequest work with completion handlers
         https://bugs.webkit.org/show_bug.cgi?id=176753
 

Modified: trunk/Source/WebKit/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp (221895 => 221896)


--- trunk/Source/WebKit/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp	2017-09-12 00:10:09 UTC (rev 221895)
+++ trunk/Source/WebKit/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp	2017-09-12 00:40:11 UTC (rev 221896)
@@ -48,7 +48,8 @@
 
 Ref<NotificationPermissionRequest> NotificationPermissionRequestManagerProxy::createRequest(uint64_t notificationID)
 {
-    auto request = NotificationPermissionRequest::create([notificationID, page = makeRef(m_page)](bool allowed) {
+    auto request = NotificationPermissionRequest::create([this, notificationID, page = makeRef(m_page)](bool allowed) {
+        m_pendingRequests.take(notificationID);
         page->process().send(Messages::WebPage::DidReceiveNotificationPermissionDecision(notificationID, allowed), page->pageID());
     });
     m_pendingRequests.add(notificationID, request.ptr());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to