Changeset 229619 in webkit


Ignore:
Timestamp:
Mar 14, 2018 10:05:36 PM (6 years ago)
Author:
wilander@apple.com
Message:

Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
https://bugs.webkit.org/show_bug.cgi?id=183641
<rdar://problem/38469497>

Reviewed by Brent Fulgham and Chris Dumez.

Source/WebCore:

No new tests. This change is to stabilize existing layout tests.
See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.

  • platform/network/NetworkStorageSession.h:
  • platform/network/cf/NetworkStorageSessionCFNet.cpp:

(WebCore::NetworkStorageSession::removeAllStorageAccess):

New function to clear out all storage access entries.

Source/WebKit:

This change is to stabilize existing layout tests by removing
all storage access entries on a call to
WebResourceLoadStatisticsStore::clearInMemory().
See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.

Almost all of the code changes are piping to get this
call from the WebResourceLoadStatisticsStore to
WebCore::NetworkStorageSession where entries reside.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::removeAllStorageAccess):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::removeAllStorageAccess):

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::clearInMemory):

Now also clears all storage access entries in the network process.

  • UIProcess/WebResourceLoadStatisticsStore.h:
  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):

  • UIProcess/WebsiteData/WebsiteDataStore.h:
Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r229616 r229619  
     12018-03-14  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
     4        https://bugs.webkit.org/show_bug.cgi?id=183641
     5        <rdar://problem/38469497>
     6
     7        Reviewed by Brent Fulgham and Chris Dumez.
     8
     9        No new tests. This change is to stabilize existing layout tests.
     10        See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
     11
     12        * platform/network/NetworkStorageSession.h:
     13        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
     14        (WebCore::NetworkStorageSession::removeAllStorageAccess):
     15            New function to clear out all storage access entries.
     16
    1172018-03-14  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r229569 r229619  
    110110    WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
    111111    WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);
     112    WEBCORE_EXPORT void removeAllStorageAccess();
    112113#endif
    113114#elif USE(SOUP)
  • trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp

    r229569 r229619  
    361361}
    362362
     363void NetworkStorageSession::removeAllStorageAccess()
     364{
     365    m_pagesGrantedStorageAccess.clear();
     366    m_framesGrantedStorageAccess.clear();
     367}
     368
    363369#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
    364370
  • trunk/Source/WebKit/ChangeLog

    r229617 r229619  
     12018-03-14  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
     4        https://bugs.webkit.org/show_bug.cgi?id=183641
     5        <rdar://problem/38469497>
     6
     7        Reviewed by Brent Fulgham and Chris Dumez.
     8
     9        This change is to stabilize existing layout tests by removing
     10        all storage access entries on a call to
     11        WebResourceLoadStatisticsStore::clearInMemory().
     12        See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
     13
     14        Almost all of the code changes are piping to get this
     15        call from the WebResourceLoadStatisticsStore to
     16        WebCore::NetworkStorageSession where entries reside.
     17
     18        * NetworkProcess/NetworkProcess.cpp:
     19        (WebKit::NetworkProcess::removeAllStorageAccess):
     20        * NetworkProcess/NetworkProcess.h:
     21        * NetworkProcess/NetworkProcess.messages.in:
     22        * UIProcess/Network/NetworkProcessProxy.cpp:
     23        (WebKit::NetworkProcessProxy::removeAllStorageAccess):
     24        * UIProcess/Network/NetworkProcessProxy.h:
     25        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     26        (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
     27        (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
     28        (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
     29            Now also clears all storage access entries in the network process.
     30        * UIProcess/WebResourceLoadStatisticsStore.h:
     31        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     32        (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
     33        (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
     34        * UIProcess/WebsiteData/WebsiteDataStore.h:
     35
    1362018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
    237
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r229569 r229619  
    395395}
    396396
     397void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID)
     398{
     399    if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
     400        networkStorageSession->removeAllStorageAccess();
     401    else
     402        ASSERT_NOT_REACHED();
     403}
     404
    397405void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains)
    398406{
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r229569 r229619  
    141141    void getAllStorageAccessEntries(PAL::SessionID, uint64_t contextId);
    142142    void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId);
     143    void removeAllStorageAccess(PAL::SessionID);
    143144    void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
    144145#endif
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r229569 r229619  
    8787    GetAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId)
    8888    GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId)
     89    RemoveAllStorageAccess(PAL::SessionID sessionID)
    8990    RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
    9091#endif
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r229569 r229619  
    429429}
    430430
     431void NetworkProcessProxy::removeAllStorageAccess(PAL::SessionID sessionID)
     432{
     433    if (canSendMessage())
     434        send(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID), 0);
     435}
     436
    431437void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId)
    432438{
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r229569 r229619  
    8383    void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String>&& domains)>&&);
    8484    void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
     85    void removeAllStorageAccess(PAL::SessionID);
    8586#endif
    8687
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

    r229597 r229619  
    155155}
    156156
    157 WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessHandler&& grantStorageAccessHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler)
     157WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessHandler&& grantStorageAccessHandler, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler)
    158158    : m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility))
    159159    , m_persistentStorage(*this, resourceLoadStatisticsDirectory, isEphemeral ? ResourceLoadStatisticsPersistentStorage::IsReadOnly::Yes : ResourceLoadStatisticsPersistentStorage::IsReadOnly::No)
     
    161161    , m_hasStorageAccessForFrameHandler(WTFMove(hasStorageAccessForFrameHandler))
    162162    , m_grantStorageAccessHandler(WTFMove(grantStorageAccessHandler))
     163    , m_removeAllStorageAccessHandler(WTFMove(removeAllStorageAccessHandler))
    163164    , m_removeDomainsHandler(WTFMove(removeDomainsHandler))
    164165    , m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks)
     
    409410    RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Grant storage access for %{public}s under opener %{public}s, %{public}s user interaction.", domainInNeedOfStorageAccess.utf8().data(), openerDomain.utf8().data(), (isTriggeredByUserGesture ? "with" : "without"));
    410411#endif
     412}
     413
     414void WebResourceLoadStatisticsStore::removeAllStorageAccess()
     415{
     416    ASSERT(!RunLoop::isMain());
     417    RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () {
     418        m_removeAllStorageAccessHandler();
     419    });
    411420}
    412421
     
    955964    m_operatingDates.clear();
    956965
     966    removeAllStorageAccess();
    957967    updateCookiePartitioningForDomains({ }, { }, { }, ShouldClearFirst::Yes, []() { });
    958968}
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h

    r229597 r229619  
    6565    using HasStorageAccessForFrameHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool hasAccess)>&& callback)>;
    6666    using GrantStorageAccessHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::Function<void(bool wasGranted)>&& callback)>;
     67    using RemoveAllStorageAccessHandler = WTF::Function<void()>;
    6768    using RemovePrevalentDomainsHandler = WTF::Function<void (const Vector<String>&)>;
    68     static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { })
     69    static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { })
    6970    {
    70         return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), isEphemeral, WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeDomainsHandler)));
     71        return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), isEphemeral, WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeAllStorageAccessHandler), WTFMove(removeDomainsHandler)));
    7172    }
    7273
     
    152153
    153154private:
    154     WebResourceLoadStatisticsStore(const String&, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForFrameHandler&&, GrantStorageAccessHandler&&, RemovePrevalentDomainsHandler&&);
     155    WebResourceLoadStatisticsStore(const String&, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForFrameHandler&&, GrantStorageAccessHandler&&, RemoveAllStorageAccessHandler&&, RemovePrevalentDomainsHandler&&);
    155156
    156157    void removeDataRecords(CompletionHandler<void()>&&);
     
    179180
    180181    void resetCookiePartitioningState();
     182    void removeAllStorageAccess();
    181183
    182184    void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled  = enabled; }
     
    213215    HasStorageAccessForFrameHandler m_hasStorageAccessForFrameHandler;
    214216    GrantStorageAccessHandler m_grantStorageAccessHandler;
     217    RemoveAllStorageAccessHandler m_removeAllStorageAccessHandler;
    215218    RemovePrevalentDomainsHandler m_removeDomainsHandler;
    216219
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r229569 r229619  
    12151215}
    12161216
     1217void WebsiteDataStore::removeAllStorageAccessHandler()
     1218{
     1219    for (auto& processPool : processPools()) {
     1220        if (auto networkProcess = processPool->networkProcess())
     1221            networkProcess->removeAllStorageAccess(m_sessionID);
     1222    }
     1223}
     1224
    12171225void WebsiteDataStore::removePrevalentDomains(const Vector<String>& domains)
    12181226{
     
    14451453    }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback) {
    14461454        grantStorageAccessHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
     1455    }, [this, protectedThis = makeRef(*this)] () {
     1456        removeAllStorageAccessHandler();
    14471457    }, [this, protectedThis = makeRef(*this)] (const Vector<String>& domainsToRemove) {
    14481458        removePrevalentDomains(domainsToRemove);
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r229569 r229619  
    128128    void getAllStorageAccessEntries(CompletionHandler<void(Vector<String>&& domains)>&&);
    129129    void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback);
     130    void removeAllStorageAccessHandler();
    130131    void removePrevalentDomains(const Vector<String>& domains);
    131132    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
Note: See TracChangeset for help on using the changeset viewer.