Title: [204733] trunk/Source/WebCore
Revision
204733
Author
bfulg...@apple.com
Date
2016-08-22 12:48:50 -0700 (Mon, 22 Aug 2016)

Log Message

Invalid resource load statistics iterator when redirecting
https://bugs.webkit.org/show_bug.cgi?id=161021
<rdar://problem/27856875>

Reviewed by Dean Jackson.

If a load is the result of a redirect, an additional entry is added to the HashSet
containing the visited domains. This invalidates any existing iterators, so we
need to get a new iterator for further updates.

No change in functionality.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logSubresourceLoading):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (204732 => 204733)


--- trunk/Source/WebCore/ChangeLog	2016-08-22 19:45:01 UTC (rev 204732)
+++ trunk/Source/WebCore/ChangeLog	2016-08-22 19:48:50 UTC (rev 204733)
@@ -1,3 +1,20 @@
+2016-08-19  Brent Fulgham  <bfulg...@apple.com>
+
+        Invalid resource load statistics iterator when redirecting
+        https://bugs.webkit.org/show_bug.cgi?id=161021
+        <rdar://problem/27856875>
+
+        Reviewed by Dean Jackson.
+
+        If a load is the result of a redirect, an additional entry is added to the HashSet
+        containing the visited domains. This invalidates any existing iterators, so we
+        need to get a new iterator for further updates.
+
+        No change in functionality.
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::logSubresourceLoading):
+
 2016-08-22  Ryosuke Niwa  <rn...@webkit.org>
 
         Rename CustomElementsRegistry to CustomElementRegistry

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (204732 => 204733)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2016-08-22 19:45:01 UTC (rev 204732)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2016-08-22 19:48:50 UTC (rev 204733)
@@ -184,19 +184,22 @@
     if (isRedirect) {
         auto& redirectingOriginStatistics = m_store->ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
         
+        // We just inserted to the store, so we need to reget 'targetStatistics'
+        auto& updatedTargetStatistics = m_store->ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
+
         if (m_store->isPrevalentResource(targetPrimaryDomain))
             redirectingOriginStatistics.redirectedToOtherPrevalentResourceOrigins.add(targetPrimaryDomain);
         
         ++redirectingOriginStatistics.subresourceHasBeenRedirectedFrom;
-        ++targetStatistics.subresourceHasBeenRedirectedTo;
+        ++updatedTargetStatistics.subresourceHasBeenRedirectedTo;
 
         redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain);
 
-        ++targetStatistics.subresourceHasBeenSubresourceCount;
+        ++updatedTargetStatistics.subresourceHasBeenSubresourceCount;
 
         auto totalVisited = std::max(m_originsVisitedMap.size(), 1U);
         
-        targetStatistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited = static_cast<double>(targetStatistics.subresourceHasBeenSubresourceCount) / totalVisited;
+        updatedTargetStatistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited = static_cast<double>(updatedTargetStatistics.subresourceHasBeenSubresourceCount) / totalVisited;
     } else {
         ++targetStatistics.subresourceHasBeenSubresourceCount;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to