Title: [217991] trunk/Source/WebKit2
Revision
217991
Author
[email protected]
Date
2017-06-09 09:38:37 -0700 (Fri, 09 Jun 2017)

Log Message

Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
https://bugs.webkit.org/show_bug.cgi?id=173163

Reviewed by Brent Fulgham.

Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
or it may end up getting destroyed before the lambda executing and crash when calling m_statisticsQueue->dispatch().

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (217990 => 217991)


--- trunk/Source/WebKit2/ChangeLog	2017-06-09 16:35:41 UTC (rev 217990)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-09 16:38:37 UTC (rev 217991)
@@ -1,3 +1,16 @@
+2017-06-09  Chris Dumez  <[email protected]>
+
+        Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
+        https://bugs.webkit.org/show_bug.cgi?id=173163
+
+        Reviewed by Brent Fulgham.
+
+        Make sure |this| is protected in lambda capture in WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
+        or it may end up getting destroyed before the lambda executing and crash when calling m_statisticsQueue->dispatch().
+
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
+
 2017-06-09  Daewoong Jang  <[email protected]>
 
         [CoordinatedGraphics] Remove unneeded interfaces in PageClient

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (217990 => 217991)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2017-06-09 16:35:41 UTC (rev 217990)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2017-06-09 16:38:37 UTC (rev 217991)
@@ -265,10 +265,10 @@
     }
 }
 
-void WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, std::function<void(HashSet<String>&&)> completionHandler)
+void WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<void(HashSet<String>&&)> completionHandler)
 {
     struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
-        explicit CallbackAggregator(std::function<void(HashSet<String>&&)> completionHandler)
+        explicit CallbackAggregator(Function<void(HashSet<String>&&)>&& completionHandler)
             : completionHandler(WTFMove(completionHandler))
         {
         }
@@ -298,7 +298,7 @@
         }
         
         unsigned pendingCallbacks = 0;
-        std::function<void(HashSet<String>&&)> completionHandler;
+        Function<void(HashSet<String>&&)> completionHandler;
         HashSet<String> domainsWithDeletedWebsiteData;
     };
     

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (217990 => 217991)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2017-06-09 16:35:41 UTC (rev 217990)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2017-06-09 16:38:37 UTC (rev 217991)
@@ -142,7 +142,7 @@
     void deleteWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()> completionHandler);
     void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()> completionHandler);
     static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, std::function<void(Vector<String>)> completionHandler);
-    static void topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, std::function<void(HashSet<String>&&)> completionHandler);
+    static void topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<void(HashSet<String>&&)> completionHandler);
     static void notifyPageStatisticsAndDataRecordsProcessed();
 
     void enableSuddenTermination();

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (217990 => 217991)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-06-09 16:35:41 UTC (rev 217990)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-06-09 16:38:37 UTC (rev 217991)
@@ -215,7 +215,7 @@
     
     // Switch to the main thread to get the default website data store
     RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () mutable {
-        WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(dataTypesToRemove, notifyPages, [this](HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
+        WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(dataTypesToRemove, notifyPages, [this, protectedThis = makeRef(*this)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
             // But always touch the ResourceLoadStatistics store on the worker queue
             m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), topDomains = CrossThreadCopier<HashSet<String>>::copy(topPrivatelyControlledDomainsWithWebsiteData)] () mutable {
                 this->coreStore().handleFreshStartWithEmptyOrNoStore(WTFMove(topDomains));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to