Changeset 221896 in webkit


Ignore:
Timestamp:
Sep 11, 2017 5:40:11 PM (7 years ago)
Author:
achristensen@apple.com
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.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r221894 r221896  
     12017-09-11  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix memory leak introduced in r221894.
     4        https://bugs.webkit.org/show_bug.cgi?id=176753
     5
     6        * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
     7        (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
     8        The NotificationPermissionRequestManagerProxy keeps track of pending requests
     9        so they can be denied when invalidating the page.  We add them to a HashMap and in
     10        r221894 I removed the code that removes them from that map once the request is complete.
     11        This code adds the completed task removal back.
     12        The NotificationPermissionRequestManagerProxy and WebPageProxy have the same lifetime,
     13        so protecting the WebPageProxy (m_page) makes sure there is no use-after-free when the
     14        completion handler is called.
     15
    1162017-09-11  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebKit/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp

    r221894 r221896  
    4949Ref<NotificationPermissionRequest> NotificationPermissionRequestManagerProxy::createRequest(uint64_t notificationID)
    5050{
    51     auto request = NotificationPermissionRequest::create([notificationID, page = makeRef(m_page)](bool allowed) {
     51    auto request = NotificationPermissionRequest::create([this, notificationID, page = makeRef(m_page)](bool allowed) {
     52        m_pendingRequests.take(notificationID);
    5253        page->process().send(Messages::WebPage::DidReceiveNotificationPermissionDecision(notificationID, allowed), page->pageID());
    5354    });
Note: See TracChangeset for help on using the changeset viewer.