Title: [256002] trunk/Source/WebKit
Revision
256002
Author
ysuz...@apple.com
Date
2020-02-06 19:08:39 -0800 (Thu, 06 Feb 2020)

Log Message

ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics relies on the order of m_getAllDomainsStatement, which can be changed by HashTable's implementation
https://bugs.webkit.org/show_bug.cgi?id=207348

Reviewed by Mark Lam.

It turns out that ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics's output
is relying on HashTable's particular iteration order which is not guaranteed.
This patch fixes this assumption by sorting domains before dumping.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::CompletionHandler<void):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (256001 => 256002)


--- trunk/Source/WebKit/ChangeLog	2020-02-07 02:57:30 UTC (rev 256001)
+++ trunk/Source/WebKit/ChangeLog	2020-02-07 03:08:39 UTC (rev 256002)
@@ -1,3 +1,17 @@
+2020-02-06  Yusuke Suzuki  <ysuz...@apple.com>
+
+        ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics relies on the order of m_getAllDomainsStatement, which can be changed by HashTable's implementation
+        https://bugs.webkit.org/show_bug.cgi?id=207348
+
+        Reviewed by Mark Lam.
+
+        It turns out that ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics's output
+        is relying on HashTable's particular iteration order which is not guaranteed.
+        This patch fixes this assumption by sorting domains before dumping.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        (WebKit::CompletionHandler<void):
+
 2020-02-06  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthn] authenticatorGetAssertion should be sent without pinAuth if UV = "discouraged"

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (256001 => 256002)


--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2020-02-07 02:57:30 UTC (rev 256001)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2020-02-07 03:08:39 UTC (rev 256002)
@@ -1709,10 +1709,15 @@
         return;
     }
 
+    Vector<String> domains;
+    while (m_getAllDomainsStatement.step() == SQLITE_ROW)
+        domains.append(m_getAllDomainsStatement.getColumnText(0));
+    std::sort(domains.begin(), domains.end(), WTF::codePointCompareLessThan);
+
     StringBuilder result;
     result.appendLiteral("Resource load statistics:\n\n");
-    while (m_getAllDomainsStatement.step() == SQLITE_ROW)
-        resourceToString(result, m_getAllDomainsStatement.getColumnText(0));
+    for (auto& domain : domains)
+        resourceToString(result, domain);
 
     auto thirdPartyData = aggregatedThirdPartyData();
     if (!thirdPartyData.isEmpty()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to