Source/WebCore/ChangeLog

 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 Mark Lam <mark.lam@apple.com>
218
319 Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
229611

Source/WebCore/platform/network/NetworkStorageSession.h

@@public:
109109 WEBCORE_EXPORT void grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID);
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)
114115 NetworkStorageSession(PAL::SessionID, std::unique_ptr<SoupNetworkSession>&&);
229604

Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp

@@void NetworkStorageSession::removeStorag
360360 m_framesGrantedStorageAccess.remove(pageID);
361361}
362362
 363void NetworkStorageSession::removeAllStorageAccess()
 364{
 365 m_pagesGrantedStorageAccess.clear();
 366 m_framesGrantedStorageAccess.clear();
 367}
 368
363369#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
364370
365371#if !PLATFORM(COCOA)
229604

Source/WebKit/ChangeLog

 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 Tim Horton <timothy_horton@apple.com>
237
338 Fix the build after r229567
229611

Source/WebKit/NetworkProcess/NetworkProcess.cpp

@@void NetworkProcess::grantStorageAccess(
394394 parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(isStorageGranted, contextId), 0);
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{
399407 if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
229604

Source/WebKit/NetworkProcess/NetworkProcess.h

@@public:
140140 void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId);
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
145146
229604

Source/WebKit/NetworkProcess/NetworkProcess.messages.in

@@messages -> NetworkProcess LegacyReceive
8686 HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
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
9192
229604

Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

@@static Vector<OperatingDate> mergeOperat
154154 return mergedDates;
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)
160160 , m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler))
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)
165166 , m_statisticsTestingCallback(WTFMove(testingCallback))

@@void WebResourceLoadStatisticsStore::req
410411#endif
411412}
412413
 414void WebResourceLoadStatisticsStore::removeAllStorageAccess()
 415{
 416 ASSERT(!RunLoop::isMain());
 417 RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () {
 418 m_removeAllStorageAccessHandler();
 419 });
 420}
 421
413422void WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData(CompletionHandler<void()>&& callback)
414423{
415424 ASSERT(!RunLoop::isMain());

@@void WebResourceLoadStatisticsStore::cle
954963 m_resourceStatisticsMap.clear();
955964 m_operatingDates.clear();
956965
 966 removeAllStorageAccess();
957967 updateCookiePartitioningForDomains({ }, { }, { }, ShouldClearFirst::Yes, []() { });
958968}
959969
229604

Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h

@@public:
6464 using UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler = WTF::Function<void(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst)>;
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
7374 ~WebResourceLoadStatisticsStore();

@@public:
151152 void logTestingEvent(const String&);
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()>&&);
157158

@@private:
178179 void processStatisticsAndDataRecords();
179180
180181 void resetCookiePartitioningState();
 182 void removeAllStorageAccess();
181183
182184 void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled = enabled; }
183185

@@private:
212214 UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler;
213215 HasStorageAccessForFrameHandler m_hasStorageAccessForFrameHandler;
214216 GrantStorageAccessHandler m_grantStorageAccessHandler;
 217 RemoveAllStorageAccessHandler m_removeAllStorageAccessHandler;
215218 RemovePrevalentDomainsHandler m_removeDomainsHandler;
216219
217220 WallTime m_endOfGrandfatheringTimestamp;
229604

Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

@@void NetworkProcessProxy::grantStorageAc
428428 send(Messages::NetworkProcess::GrantStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0);
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{
433439 auto callback = m_storageAccessResponseCallbackMap.take(contextId);
229604

Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

@@public:
8282 void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
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
8788 void writeBlobToFilePath(const WebCore::URL&, const String& path, CompletionHandler<void(bool)>&& callback);
229604

Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

@@void WebsiteDataStore::grantStorageAcces
12141214 processPool->networkProcess()->grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
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{
12191227 for (auto& processPool : processPools())

@@void WebsiteDataStore::enableResourceLoa
14441452 hasStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
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);
14491459 });
229604

Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

@@public:
127127 void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback);
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);
132133 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
229604