Title: [219211] trunk/Source/WebKit2
Revision
219211
Author
cdu...@apple.com
Date
2017-07-06 12:22:36 -0700 (Thu, 06 Jul 2017)

Log Message

Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
https://bugs.webkit.org/show_bug.cgi?id=174205
<rdar://problem/33093552>

Reviewed by Brent Fulgham.

Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
thread.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
(WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
(WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
(WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
(WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
(WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
(WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
(WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
(WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (219210 => 219211)


--- trunk/Source/WebKit2/ChangeLog	2017-07-06 18:50:47 UTC (rev 219210)
+++ trunk/Source/WebKit2/ChangeLog	2017-07-06 19:22:36 UTC (rev 219211)
@@ -1,3 +1,27 @@
+2017-07-06  Chris Dumez  <cdu...@apple.com>
+
+        Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
+        https://bugs.webkit.org/show_bug.cgi?id=174205
+        <rdar://problem/33093552>
+
+        Reviewed by Brent Fulgham.
+
+        Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
+        thread.
+
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
+        (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
+        (WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
+        (WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
+        (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
+        (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
+        (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
+        (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
+        (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
+        (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+
 2017-07-06  Alex Christensen  <achristen...@webkit.org>
 
         Fix CFURLRequestRef serialization after r207330

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (219210 => 219211)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-07-06 18:50:47 UTC (rev 219210)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-07-06 19:22:36 UTC (rev 219211)
@@ -254,7 +254,7 @@
 {
     ASSERT(!RunLoop::isMain());
 
-    String resourceLog = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLog = resourceLogFilePath();
     if (resourceLog.isEmpty() || !fileExists(resourceLog)) {
         grandfatherExistingWebsiteData();
         return;
@@ -286,7 +286,7 @@
 {
     ASSERT(!RunLoop::isMain());
 
-    String resourceLog = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLog = resourceLogFilePath();
     if (resourceLog.isEmpty())
         return;
 
@@ -326,13 +326,19 @@
     semaphore.wait(WallTime::infinity());
 }
 
-String WebResourceLoadStatisticsStore::persistentStoragePath(const String& label) const
+String WebResourceLoadStatisticsStore::statisticsStoragePath() const
 {
-    if (m_statisticsStoragePath.isEmpty())
+    return m_statisticsStoragePath.isolatedCopy();
+}
+
+String WebResourceLoadStatisticsStore::resourceLogFilePath() const
+{
+    String statisticsStoragePath = this->statisticsStoragePath();
+    if (statisticsStoragePath.isEmpty())
         return emptyString();
 
     // TODO Decide what to call this file
-    return pathByAppendingComponent(m_statisticsStoragePath, label + "_resourceLog.plist");
+    return pathByAppendingComponent(statisticsStoragePath, "full_browsing_session_resourceLog.plist");
 }
 
 void WebResourceLoadStatisticsStore::writeStoreToDisk()
@@ -343,7 +349,7 @@
 
     auto encoder = coreStore().createEncoderFromData();
 
-    String resourceLog = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLog = resourceLogFilePath();
     writeEncoderToDisk(*encoder.get(), resourceLog);
 
     m_lastStatisticsFileSyncTime = WallTime::now();
@@ -382,8 +388,9 @@
     if (!rawData)
         return;
 
-    if (!m_statisticsStoragePath.isEmpty()) {
-        makeAllDirectories(m_statisticsStoragePath);
+    auto statisticsStoragePath = this->statisticsStoragePath();
+    if (!statisticsStoragePath.isEmpty()) {
+        makeAllDirectories(statisticsStoragePath);
         platformExcludeFromBackup();
     }
 
@@ -401,7 +408,7 @@
 void WebResourceLoadStatisticsStore::deleteStoreFromDisk()
 {
     ASSERT(!RunLoop::isMain());
-    String resourceLogPath = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLogPath = resourceLogFilePath();
     if (resourceLogPath.isEmpty())
         return;
 
@@ -423,7 +430,7 @@
     if (m_statisticsStorageMonitor)
         return;
     
-    String resourceLogPath = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLogPath = resourceLogFilePath();
     if (resourceLogPath.isEmpty())
         return;
     
@@ -461,7 +468,7 @@
     if (m_statisticsStorageMonitor)
         return;
 
-    String resourceLog = persistentStoragePath(ASCIILiteral("full_browsing_session"));
+    String resourceLog = resourceLogFilePath();
     if (resourceLog.isEmpty() || !fileExists(resourceLog))
         return;
 

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (219210 => 219211)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h	2017-07-06 18:50:47 UTC (rev 219210)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h	2017-07-06 19:22:36 UTC (rev 219211)
@@ -113,7 +113,8 @@
     void startMonitoringStatisticsStorage();
     void stopMonitoringStatisticsStorage();
 
-    String persistentStoragePath(const String& label) const;
+    String statisticsStoragePath() const;
+    String resourceLogFilePath() const;
 
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
@@ -145,7 +146,7 @@
 #endif
     Ref<WTF::WorkQueue> m_statisticsQueue;
     RefPtr<WebCore::FileMonitor> m_statisticsStorageMonitor;
-    String m_statisticsStoragePath;
+    const String m_statisticsStoragePath;
     WTF::WallTime m_lastStatisticsFileSyncTime;
     RunLoop::Timer<WebResourceLoadStatisticsStore> m_telemetryOneShotTimer;
     RunLoop::Timer<WebResourceLoadStatisticsStore> m_telemetryRepeatedTimer;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to