Changeset 252123 in webkit


Ignore:
Timestamp:
Nov 5, 2019 9:17:37 PM (4 years ago)
Author:
Kate Cheney
Message:

Layout test website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=203706
Source/WebKit:

<rdar://problem/56801615>

Reviewed by Chris Dumez.

No new tests, this change is tested by the existing resourceLoadStatistics
tests.

This test started flaking when a new memory store was being created
between tests to maintain consistency. The call to grandfatherExistingWebsiteData
from populateMemoryStoreFromDisk in the persistent storage was
async, causing a race condition that led to occasional failures.
Adding a completion handler and changing the callsite of
populateMemoryStoreFromDisk should fix this problem.

  • NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:

(WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):

  • NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):

LayoutTests:

<rdar://problem/56801615>

Reviewed by Chris Dumez.

Since the state is reset between tests, the call to
setUseITPDatabase(false) is redundant.

  • http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html:
  • http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252122 r252123  
     12019-11-05  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Layout test website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=203706
     5        <rdar://problem/56801615>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Since the state is reset between tests, the call to
     10        setUseITPDatabase(false) is redundant.
     11
     12        * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html:
     13        * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
     14
    1152019-11-05  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html

    r250393 r252123  
    99<script>
    1010    if (window.testRunner) {
    11         testRunner.setUseITPDatabase(false);
    1211        testRunner.waitUntilDone();
    1312        testRunner.dumpAsText();
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html

    r251287 r252123  
    1111<br>
    1212<script>
    13     testRunner.setUseITPDatabase(false);
    1413    testRunner.waitUntilDone();
    1514    testRunner.dumpAsText();
  • trunk/Source/WebKit/ChangeLog

    r252116 r252123  
     12019-11-05  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Layout test website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=203706
     5        <rdar://problem/56801615>
     6
     7        Reviewed by Chris Dumez.
     8
     9        No new tests, this change is tested by the existing resourceLoadStatistics
     10        tests.
     11
     12        This test started flaking when a new memory store was being created
     13        between tests to maintain consistency. The call to grandfatherExistingWebsiteData
     14        from populateMemoryStoreFromDisk in the persistent storage was
     15        async, causing a race condition that led to occasional failures.
     16        Adding a completion handler and changing the callsite of
     17        populateMemoryStoreFromDisk should fix this problem.
     18
     19        * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
     20        (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
     21        * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
     22        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
     23        (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
     24
    1252019-11-05  John Wilander  <wilander@apple.com>
    226
  • trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp

    r251672 r252123  
    184184}
    185185
    186 void ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk()
     186void ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk(CompletionHandler<void()>&& completionHandler)
    187187{
    188188    ASSERT(!RunLoop::isMain());
     
    190190    String filePath = resourceLogFilePath();
    191191    if (filePath.isEmpty() || !FileSystem::fileExists(filePath)) {
    192         m_memoryStore.grandfatherExistingWebsiteData([]() { });
     192        m_memoryStore.grandfatherExistingWebsiteData(WTFMove(completionHandler));
    193193        monitorDirectoryForNewStatistics();
    194194        return;
     
    197197    if (!hasFileChangedSince(filePath, m_lastStatisticsFileSyncTime)) {
    198198        // No need to grandfather in this case.
     199        completionHandler();
    199200        return;
    200201    }
     
    204205    auto decoder = createForFile(filePath);
    205206    if (!decoder) {
    206         m_memoryStore.grandfatherExistingWebsiteData([]() { });
     207        m_memoryStore.grandfatherExistingWebsiteData(WTFMove(completionHandler));
    207208        return;
    208209    }
     
    215216
    216217    m_memoryStore.logTestingEvent("PopulatedWithoutGrandfathering"_s);
     218    completionHandler();
    217219}
    218220
  • trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h

    r251672 r252123  
    5555    enum class ForceImmediateWrite { No, Yes, };
    5656    void scheduleOrWriteMemoryStore(ForceImmediateWrite);
    57     void populateMemoryStoreFromDisk();
     57    void populateMemoryStoreFromDisk(CompletionHandler<void()>&&);
    5858
    5959private:
  • trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp

    r252014 r252123  
    226226    ASSERT(RunLoop::isMain());
    227227   
    228     postTask([this, completionHandler = WTFMove(completionHandler)]() mutable {
     228    postTask([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
    229229        if (m_persistentStorage)
    230             m_persistentStorage->populateMemoryStoreFromDisk();
    231 
    232         postTaskReply(WTFMove(completionHandler));
     230            m_persistentStorage->populateMemoryStoreFromDisk([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)]() mutable {
     231                postTaskReply(WTFMove(completionHandler));
     232            });
     233        else
     234            postTaskReply(WTFMove(completionHandler));
    233235    });
    234236}
Note: See TracChangeset for help on using the changeset viewer.