Diff
Modified: trunk/LayoutTests/ChangeLog (227222 => 227223)
--- trunk/LayoutTests/ChangeLog 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/ChangeLog 2018-01-19 19:26:13 UTC (rev 227223)
@@ -1,3 +1,26 @@
+2018-01-19 John Wilander <[email protected]>
+
+ Resource Load Statistics: Implement callback support for removal of WebsiteDataType::ResourceLoadStatistics
+ https://bugs.webkit.org/show_bug.cgi?id=181822
+ https://bugs.webkit.org/show_bug.cgi?id=175263
+ https://bugs.webkit.org/show_bug.cgi?id=178536
+ https://bugs.webkit.org/show_bug.cgi?id=181223
+ https://bugs.webkit.org/show_bug.cgi?id=181482
+ <rdar://problem/33491222>
+ <rdar://problem/33805293>
+ <rdar://problem/36332683>
+ <rdar://problem/36549026>
+
+ Reviewed by Alex Christensen.
+
+ * http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html:
+ * http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html:
+ * http/tests/resourceLoadStatistics/grandfathering.html:
+ * platform/ios/TestExpectations:
+ Marked the three updated tests as [ Pass ].
+ * platform/mac-wk2/TestExpectations:
+ Marked the three updated tests as [ Pass ].
+
2018-01-19 James Craig <[email protected]>
AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html (227222 => 227223)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html 2018-01-19 19:26:13 UTC (rev 227223)
@@ -30,11 +30,7 @@
else
testFailed("Host did not get classified as prevalent resource.");
- testRunner.clearTestRunnerCallbacks();
- testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
- testRunner.installStatisticsDidModifyDataRecordsCallback(completeTest);
-
- testRunner.statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(1);
+ testRunner.statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(1, completeTest);
}
function runTestRunnerTest() {
@@ -53,7 +49,6 @@
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin3);
testRunner.installStatisticsDidScanDataRecordsCallback(testStep2);
- testRunner.installStatisticsDidModifyDataRecordsCallback(testStep2);
testRunner.statisticsProcessStatisticsAndDataRecords();
}
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html (227222 => 227223)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html 2018-01-19 19:26:13 UTC (rev 227223)
@@ -19,11 +19,7 @@
else
testFailed("Host did not get classified as prevalent resource.");
- testRunner.clearTestRunnerCallbacks();
- testRunner.installStatisticsDidModifyDataRecordsCallback(completeTest);
- testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
-
- testRunner.statisticsClearInMemoryAndPersistentStore();
+ testRunner.statisticsClearInMemoryAndPersistentStore(completeTest);
}
function completeTest() {
@@ -53,7 +49,6 @@
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin3);
testRunner.installStatisticsDidScanDataRecordsCallback(testStep2);
- testRunner.installStatisticsDidModifyDataRecordsCallback(testStep2);
testRunner.statisticsProcessStatisticsAndDataRecords();
}
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html (227222 => 227223)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html 2018-01-19 19:26:13 UTC (rev 227223)
@@ -40,10 +40,9 @@
}
function clearInMemoryAndPersistentStoreAndContinue() {
- testRunner.installStatisticsDidScanDataRecordsCallback(function() {
+ testRunner.statisticsClearInMemoryAndPersistentStore(function() {
runTest();
});
- testRunner.statisticsClearInMemoryAndPersistentStore();
}
function runTest() {
@@ -99,6 +98,7 @@
break;
default:
testFailed("Should not be reached.");
+ finishTest();
}
}
Modified: trunk/LayoutTests/platform/ios/TestExpectations (227222 => 227223)
--- trunk/LayoutTests/platform/ios/TestExpectations 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2018-01-19 19:26:13 UTC (rev 227223)
@@ -3014,6 +3014,9 @@
http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ]
http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ]
http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ]
+http/tests/resourceLoadStatistics/grandfathering.html [ Pass ]
+http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ]
+http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Pass ]
webkit.org/b/175273 imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name.html [ Failure ]
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (227222 => 227223)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-01-19 19:26:13 UTC (rev 227223)
@@ -808,6 +808,9 @@
[ HighSierra+ ] http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ]
[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ]
[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/grandfathering.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Pass ]
# <rdar://problem/33555759>
webkit.org/b/177616 [ HighSierra+ ] http/tests/media/video-buffered-range-contains-currentTime.html [ Pass Timeout ]
@@ -825,8 +828,6 @@
webkit.org/b/178472 http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html [ Pass ]
-webkit.org/b/178536 http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Skip ]
-
webkit.org/b/176881 plugins/js-from-destroy.html [ Pass Failure ]
webkit.org/b/178553 [ HighSierra Release ] imported/w3c/web-platform-tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html [ Skip ]
@@ -866,8 +867,6 @@
webkit.org/b/181502 swipe/pushstate-with-manual-scrollrestoration.html [ Failure ]
-webkit.org/b/181482 http/tests/resourceLoadStatistics/grandfathering.html [ Skip ]
-
webkit.org/b/181750 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html [ Pass Failure ]
webkit.org/b/181750 imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-sw.https.html [ Pass Failure ]
webkit.org/b/181750 imported/w3c/web-platform-tests/service-workers/service-worker/redirected-response.https.html [ Pass Failure ]
Modified: trunk/Source/WebKit/ChangeLog (227222 => 227223)
--- trunk/Source/WebKit/ChangeLog 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/ChangeLog 2018-01-19 19:26:13 UTC (rev 227223)
@@ -1,3 +1,42 @@
+2018-01-19 John Wilander <[email protected]>
+
+ Resource Load Statistics: Implement callback support for removal of WebsiteDataType::ResourceLoadStatistics
+ https://bugs.webkit.org/show_bug.cgi?id=181822
+ https://bugs.webkit.org/show_bug.cgi?id=175263
+ https://bugs.webkit.org/show_bug.cgi?id=178536
+ https://bugs.webkit.org/show_bug.cgi?id=181223
+ https://bugs.webkit.org/show_bug.cgi?id=181482
+ <rdar://problem/33491222>
+ <rdar://problem/33805293>
+ <rdar://problem/36332683>
+ <rdar://problem/36549026>
+
+ Reviewed by Alex Christensen.
+
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
+ (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+ (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]):
+ Calls the new API with no-op completion handler.
+ (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore:]):
+ New API with completion handler.
+ (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
+ Calls the new API with no-op completion handler.
+ (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:completionHandler:]):
+ New API with completion handler.
+ * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+ * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
+ (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::removeData):
+ (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2018-01-19 Daniel Bates <[email protected]>
REGRESSION (r223149): Ref WebPageProxy objects before calling their functionality
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2018-01-19 19:26:13 UTC (rev 227223)
@@ -328,7 +328,7 @@
if (!store)
return;
- store->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ store->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, []() { });
}
void WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours(WKWebsiteDataStoreRef dataStoreRef, unsigned hours)
@@ -337,7 +337,7 @@
if (!store)
return;
- store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, []() { });
}
void WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemovalFunction callback)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2018-01-19 19:26:13 UTC (rev 227223)
@@ -549,20 +549,38 @@
- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStore
{
+ [self _resourceLoadStatisticsClearInMemoryAndPersistentStore:^() { }];
+}
+
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStore:(void (^)())completionHandler
+{
auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics();
- if (!store)
+ if (!store) {
+ completionHandler();
return;
+ }
- store->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ store->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, [completionHandler = makeBlockPtr(completionHandler)]() {
+ completionHandler();
+ });
}
- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:(unsigned)hours
{
+ [self _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:hours completionHandler:^() { }];
+}
+
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:(unsigned)hours completionHandler:(void (^)())completionHandler
+{
auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics();
- if (!store)
+ if (!store) {
+ completionHandler();
return;
+ }
- store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, [completionHandler = makeBlockPtr(completionHandler)]() {
+ completionHandler();
+ });
}
- (void)_resourceLoadStatisticsResetToConsistentState
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2018-01-19 19:26:13 UTC (rev 227223)
@@ -79,8 +79,10 @@
- (void)_resourceLoadStatisticsSetShouldClassifyResourcesBeforeDataRecordsRemoval:(BOOL)value WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_resourceLoadStatisticsSetNotifyPagesWhenTelemetryWasCaptured:(BOOL)value WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStore WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:(unsigned)hours WK_API_AVAILABLE(macosx(10.13), ios(11.0));
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStore WK_API_DEPRECATED_WITH_REPLACEMENT("_resourceLoadStatisticsClearInMemoryAndPersistentStore", macosx(10.13, WK_MAC_TBA), ios(11.0, WK_IOS_TBA));
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStore:(void (^)())completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:(unsigned)hours WK_API_DEPRECATED_WITH_REPLACEMENT("_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours", macosx(10.13, WK_MAC_TBA), ios(11.0, WK_IOS_TBA));
+- (void)_resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:(unsigned)hours completionHandler:(void (^)())completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_resourceLoadStatisticsResetToConsistentState WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_setResourceLoadStatisticsTestingCallback:(nullable void (^)(WKWebsiteDataStore *, NSString *))callback WK_API_AVAILABLE(macosx(10.13), ios(11.0));
+ (void)_allowWebsiteDataRecordsForAllOrigins WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-01-19 19:26:13 UTC (rev 227223)
@@ -211,7 +211,7 @@
String filePath = resourceLogFilePath();
if (filePath.isEmpty() || !FileSystem::fileExists(filePath)) {
- m_memoryStore.grandfatherExistingWebsiteData();
+ m_memoryStore.grandfatherExistingWebsiteData([]() { });
monitorDirectoryForNewStatistics();
return;
}
@@ -225,7 +225,7 @@
auto decoder = createDecoderForFile(filePath);
if (!decoder) {
- m_memoryStore.grandfatherExistingWebsiteData();
+ m_memoryStore.grandfatherExistingWebsiteData([]() { });
return;
}
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-01-19 19:26:13 UTC (rev 227223)
@@ -305,15 +305,15 @@
});
}
-void WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData()
+void WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData(CompletionHandler<void()>&& callback)
{
ASSERT(!RunLoop::isMain());
- RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () mutable {
+ RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callback = WTFMove(callback)] () mutable {
// FIXME: This method being a static call on WebProcessProxy is wrong.
// It should be on the data store that this object belongs to.
- WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(WebResourceLoadStatisticsStore::monitoredDataTypes(), m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, [this, protectedThis = WTFMove(protectedThis)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
- m_statisticsQueue->dispatch([this, protectedThis = WTFMove(protectedThis), topDomains = crossThreadCopy(topPrivatelyControlledDomainsWithWebsiteData)] () mutable {
+ WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(WebResourceLoadStatisticsStore::monitoredDataTypes(), m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, [this, protectedThis = WTFMove(protectedThis), callback = WTFMove(callback)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
+ m_statisticsQueue->dispatch([this, protectedThis = WTFMove(protectedThis), topDomains = crossThreadCopy(topPrivatelyControlledDomainsWithWebsiteData), callback = WTFMove(callback)] () mutable {
for (auto& topPrivatelyControlledDomain : topDomains) {
auto& statistic = ensureResourceStatisticsForPrimaryDomain(topPrivatelyControlledDomain);
statistic.grandfathered = true;
@@ -320,9 +320,9 @@
}
m_endOfGrandfatheringTimestamp = WallTime::now() + m_parameters.grandfatheringTime;
m_persistentStorage.scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::Yes);
+ callback();
+ logTestingEvent(ASCIILiteral("Grandfathered"));
});
-
- logTestingEvent(ASCIILiteral("Grandfathered"));
});
});
}
@@ -593,23 +593,30 @@
});
}
-void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather)
+void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& callback)
{
ASSERT(RunLoop::isMain());
- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), shouldGrandfather] {
+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), shouldGrandfather, callback = WTFMove(callback)] () mutable {
clearInMemory();
m_persistentStorage.clear();
if (shouldGrandfather == ShouldGrandfather::Yes)
- grandfatherExistingWebsiteData();
+ grandfatherExistingWebsiteData([this, protectedThis = makeRef(*this), callback = WTFMove(callback)]() {
+ callback();
+ logTestingEvent(ASCIILiteral("ClearedInMemoryAndPersistent"));
+ });
+ else {
+ callback();
+ logTestingEvent(ASCIILiteral("ClearedInMemoryAndPersistent"));
+ }
});
}
-void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather shouldGrandfather)
+void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& callback)
{
// For now, be conservative and clear everything regardless of modifiedSince.
UNUSED_PARAM(modifiedSince);
- scheduleClearInMemoryAndPersistent(shouldGrandfather);
+ scheduleClearInMemoryAndPersistent(shouldGrandfather, WTFMove(callback));
}
void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-01-19 19:26:13 UTC (rev 227223)
@@ -119,8 +119,8 @@
No,
Yes,
};
- void scheduleClearInMemoryAndPersistent(ShouldGrandfather);
- void scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather);
+ void scheduleClearInMemoryAndPersistent(ShouldGrandfather, CompletionHandler<void()>&&);
+ void scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather, CompletionHandler<void()>&&);
void setTimeToLiveUserInteraction(Seconds);
void setTimeToLiveCookiePartitionFree(Seconds);
@@ -137,7 +137,7 @@
std::unique_ptr<WebCore::KeyedEncoder> createEncoderFromData() const;
void mergeWithDataFromDecoder(WebCore::KeyedDecoder&);
void clearInMemory();
- void grandfatherExistingWebsiteData();
+ void grandfatherExistingWebsiteData(CompletionHandler<void()>&&);
void setStatisticsTestingCallback(Function<void (const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); }
void logTestingEvent(const String&);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-01-19 19:26:13 UTC (rev 227223)
@@ -861,20 +861,26 @@
}
#endif
- // FIXME <rdar://problem/33491222>; scheduleClearInMemoryAndPersistent does not have a completion handler,
- // so the completion handler for this removeData() call can be called prematurely.
if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics) && m_resourceLoadStatistics) {
auto deletedTypesRaw = dataTypes.toRaw();
auto monitoredTypesRaw = WebResourceLoadStatisticsStore::monitoredDataTypes().toRaw();
-
+
// If we are deleting all of the data types that the resource load statistics store monitors
// we do not need to re-grandfather old data.
+ callbackAggregator->addPendingCallback();
if ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw)
- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::No);
+ m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::No, [callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
else
- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, [callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
- clearResourceLoadStatisticsInWebProcesses();
+ callbackAggregator->addPendingCallback();
+ clearResourceLoadStatisticsInWebProcesses([callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
}
// There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
@@ -1154,12 +1160,20 @@
// If we are deleting all of the data types that the resource load statistics store monitors
// we do not need to re-grandfather old data.
+ callbackAggregator->addPendingCallback();
if ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw)
- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::No);
+ m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::No, [callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
else
- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+ m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::Yes, [callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
- clearResourceLoadStatisticsInWebProcesses();
+ callbackAggregator->addPendingCallback();
+ clearResourceLoadStatisticsInWebProcesses([callbackAggregator] {
+ callbackAggregator->removePendingCallback();
+ });
}
// There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
@@ -1424,13 +1438,13 @@
processPool->setResourceLoadStatisticsEnabled(true);
}
-void WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses()
+void WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses(CompletionHandler<void()>&& callback)
{
- if (!resourceLoadStatisticsEnabled())
- return;
-
- for (auto& processPool : processPools())
- processPool->clearResourceLoadStatistics();
+ if (resourceLoadStatisticsEnabled()) {
+ for (auto& processPool : processPools())
+ processPool->clearResourceLoadStatistics();
+ }
+ callback();
}
StorageProcessCreationParameters WebsiteDataStore::storageProcessParameters()
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (227222 => 227223)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-01-19 19:26:13 UTC (rev 227223)
@@ -107,7 +107,7 @@
void setCacheStorageDirectory(String&& directory) { m_resolvedConfiguration.cacheStorageDirectory = WTFMove(directory); }
WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
- void clearResourceLoadStatisticsInWebProcesses();
+ void clearResourceLoadStatisticsInWebProcesses(CompletionHandler<void()>&&);
static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
Modified: trunk/Tools/ChangeLog (227222 => 227223)
--- trunk/Tools/ChangeLog 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Tools/ChangeLog 2018-01-19 19:26:13 UTC (rev 227223)
@@ -1,3 +1,27 @@
+2018-01-19 John Wilander <[email protected]>
+
+ Resource Load Statistics: Implement callback support for removal of WebsiteDataType::ResourceLoadStatistics
+ https://bugs.webkit.org/show_bug.cgi?id=181822
+ https://bugs.webkit.org/show_bug.cgi?id=175263
+ https://bugs.webkit.org/show_bug.cgi?id=178536
+ https://bugs.webkit.org/show_bug.cgi?id=181223
+ https://bugs.webkit.org/show_bug.cgi?id=181482
+ <rdar://problem/33491222>
+ <rdar://problem/33805293>
+ <rdar://problem/36332683>
+ <rdar://problem/36549026>
+
+ Reviewed by Alex Christensen.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::statisticsClearInMemoryAndPersistentStore):
+ (WTR::TestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::statisticsClearInMemoryAndPersistentStore):
+ (WTR::TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+
2018-01-19 Jonathan Bedard <[email protected]>
run-webkit-tests fails when there is a curly brace in Xcode build output
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (227222 => 227223)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-01-19 19:26:13 UTC (rev 227223)
@@ -293,8 +293,8 @@
void setStatisticsGrandfatheringTime(double seconds);
void setStatisticsMaxStatisticsEntries(unsigned long entries);
void setStatisticsPruneEntriesDownTo(unsigned long entries);
- void statisticsClearInMemoryAndPersistentStore();
- void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned long hours);
+ void statisticsClearInMemoryAndPersistentStore(object callback);
+ void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned long hours, object callback);
void statisticsClearThroughWebsiteDataRemoval(object callback);
void statisticsResetToConsistentState();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (227222 => 227223)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-01-19 19:26:13 UTC (rev 227223)
@@ -1639,14 +1639,18 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
}
-void TestRunner::statisticsClearInMemoryAndPersistentStore()
+void TestRunner::statisticsClearInMemoryAndPersistentStore(JSValueRef callback)
{
+ cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
+
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsClearInMemoryAndPersistentStore"));
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
}
-void TestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours)
+void TestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback)
{
+ cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
+
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsClearInMemoryAndPersistentStoreModifiedSinceHours"));
WKRetainPtr<WKTypeRef> messageBody(AdoptWK, WKUInt64Create(hours));
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (227222 => 227223)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-01-19 19:26:13 UTC (rev 227223)
@@ -392,8 +392,8 @@
void setStatisticsGrandfatheringTime(double seconds);
void setStatisticsMaxStatisticsEntries(unsigned);
void setStatisticsPruneEntriesDownTo(unsigned);
- void statisticsClearInMemoryAndPersistentStore();
- void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours);
+ void statisticsClearInMemoryAndPersistentStore(JSValueRef callback);
+ void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback);
void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
void statisticsCallClearThroughWebsiteDataRemovalCallback();
void statisticsResetToConsistentState();
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (227222 => 227223)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2018-01-19 19:15:58 UTC (rev 227222)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2018-01-19 19:26:13 UTC (rev 227223)
@@ -429,12 +429,16 @@
void TestController::statisticsClearInMemoryAndPersistentStore()
{
- [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore];
+ [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore:^() {
+ m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
+ }];
}
void TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours)
{
- [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:hours];
+ [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:hours completionHandler:^() {
+ m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
+ }];
}
void TestController::statisticsClearThroughWebsiteDataRemoval()