Title: [220412] trunk
Revision
220412
Author
wilan...@apple.com
Date
2017-08-08 10:18:24 -0700 (Tue, 08 Aug 2017)

Log Message

Resource Load Statistics: Clear web processes' state on history removal
https://bugs.webkit.org/show_bug.cgi?id=175271
<rdar://problem/33756560>

Reviewed by Chris Dumez.

Source/WebKit:

https://bugs.webkit.org/show_bug.cgi?id=175090 introduced state
in the web process and that state needs to be cleared when the
UI process' statistics are cleared as part of history removal.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::clearResourceLoadStatistics):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::clearResourceLoadStatistics):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Tools:

Test infrastructure for asynchronous tests of website data
removal for _WKWebsiteDataTypeResourceLoadStatistics.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsClearThroughWebsiteDataRemoval):
(WTR::TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsClearThroughWebsiteDataRemoval):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
(WTR::TestInvocation::didClearStatisticsThroughWebsiteDataRemoval):
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::statisticsClearThroughWebsiteDataRemoval):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html: Added.
* platform/mac-wk2/TestExpectations:
    user-interaction-reported-after-website-data-removal.html marked as [ Pass ].

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (220411 => 220412)


--- trunk/LayoutTests/ChangeLog	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/LayoutTests/ChangeLog	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1,3 +1,16 @@
+2017-08-08  John Wilander  <wilan...@apple.com>
+
+        Resource Load Statistics: Clear web processes' state on history removal
+        https://bugs.webkit.org/show_bug.cgi?id=175271
+        <rdar://problem/33756560>
+
+        Reviewed by Chris Dumez.
+
+        * http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt: Added.
+        * http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html: Added.
+        * platform/mac-wk2/TestExpectations:
+            user-interaction-reported-after-website-data-removal.html marked as [ Pass ].
+
 2017-08-08  Ryan Haddad  <ryanhad...@apple.com>
 
         Fix baseline for http/tests/security/set-domain-remove-subdomain-for-ip-address.html.

Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt (0 => 220412)


--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt	2017-08-08 17:18:24 UTC (rev 220412)
@@ -0,0 +1,22 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+Tests that user interaction is reported after history removal since that means all statistics have been reset.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.location.origin is topFrameOrigin
+PASS testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin) is false
+PASS testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin) is false
+PASS testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin) is true
+PASS testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin) is false
+PASS testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin) is false
+PASS testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin) is true
+PASS testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This is the test element

Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html (0 => 220412)


--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html	2017-08-08 17:18:24 UTC (rev 220412)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<script>
+    description("Tests that user interaction is reported after history removal since that means all statistics have been reset.");
+    jsTestIsAsync = true;
+
+    const topFrameOrigin = "http://127.0.0.1:8000";
+    const subFrameOrigin = "http://localhost:8000";
+
+    function activateElement(elementId, callback) {
+        var element = document.getElementById(elementId);
+        var centerX = element.offsetLeft + element.offsetWidth / 2;
+        var centerY = element.offsetTop + element.offsetHeight / 2;
+        UIHelper.activateAt(centerX, centerY).then(
+            function() {
+                callback();
+            },
+            function() {
+                testFailed("Promise rejected.");
+                finishJSTest();
+            }
+        );
+    }
+
+    function firstInteraction() {
+        shouldBeFalse("testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin)");
+        shouldBeFalse("testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin)");
+        activateElement("testElement", clearWebsiteData);
+    }
+
+    function clearWebsiteData() {
+        shouldBeTrue("testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin)");
+        shouldBeFalse("testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin)");
+
+        if (testRunner)
+            testRunner.statisticsClearThroughWebsiteDataRemoval(secondInteraction);
+    }
+
+    function secondInteraction() {
+        shouldBeFalse("testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin)");
+        activateElement("testElement", finishTest);
+    }
+
+    function finishTest() {
+        shouldBeTrue("testRunner.isStatisticsHasHadUserInteraction(topFrameOrigin)");
+        shouldBeFalse("testRunner.isStatisticsHasHadUserInteraction(subFrameOrigin)");
+
+        finishJSTest();
+    }
+
+    _onload_ = function() {
+        if (internals)
+            internals.setResourceLoadStatisticsEnabled(true);
+
+        shouldBe("document.location.origin", "topFrameOrigin");
+
+        firstInteraction();
+    };
+</script>
+<div id="testElement">This is the test element</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (220411 => 220412)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-08-08 17:18:24 UTC (rev 220412)
@@ -731,6 +731,7 @@
 # Move to general wk2 expectations once webkit.org/b/175170 is resolved.
 http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html [ Pass ]
 http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Pass ]
+http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Pass ]
 
 webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html [ Pass Timeout ]
 webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html [ Pass Timeout ]

Modified: trunk/Source/WebKit/ChangeLog (220411 => 220412)


--- trunk/Source/WebKit/ChangeLog	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/ChangeLog	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1,3 +1,27 @@
+2017-08-08  John Wilander  <wilan...@apple.com>
+
+        Resource Load Statistics: Clear web processes' state on history removal
+        https://bugs.webkit.org/show_bug.cgi?id=175271
+        <rdar://problem/33756560>
+
+        Reviewed by Chris Dumez.
+
+        https://bugs.webkit.org/show_bug.cgi?id=175090 introduced state
+        in the web process and that state needs to be cleared when the
+        UI process' statistics are cleared as part of history removal.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::clearResourceLoadStatistics):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::removeData):
+        (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::clearResourceLoadStatistics):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
 2017-08-08  Adrian Perez de Castro  <ape...@igalia.com>
 
         [WPE] Implement WebsiteDataStore::defaultApplicationCacheDirectory() and friends

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (220411 => 220412)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1099,6 +1099,11 @@
     sendToAllProcesses(Messages::WebProcess::SetResourceLoadStatisticsEnabled(enabled));
 }
 
+void WebProcessPool::clearResourceLoadStatistics()
+{
+    sendToAllProcesses(Messages::WebProcess::ClearResourceLoadStatistics());
+}
+
 void WebProcessPool::registerURLSchemeAsEmptyDocument(const String& urlScheme)
 {
     m_schemesToRegisterAsEmptyDocument.add(urlScheme);

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (220411 => 220412)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -388,6 +388,7 @@
 
     bool resourceLoadStatisticsEnabled() { return m_resourceLoadStatisticsEnabled; }
     void setResourceLoadStatisticsEnabled(bool);
+    void clearResourceLoadStatistics();
 
     bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
     bool shouldTakeUIBackgroundAssertion() const { return m_shouldTakeUIBackgroundAssertion; }

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (220411 => 220412)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -821,6 +821,8 @@
             m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::No);
         else
             m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+
+        clearResourceLoadStatisticsInWebProcesses();
     }
 
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
@@ -1099,6 +1101,8 @@
             m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::No);
         else
             m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+
+        clearResourceLoadStatisticsInWebProcesses();
     }
 
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
@@ -1315,6 +1319,15 @@
         processPool->setResourceLoadStatisticsEnabled(true);
 }
 
+void WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses()
+{
+    if (!resourceLoadStatisticsEnabled())
+        return;
+
+    for (auto& processPool : processPools())
+        processPool->clearResourceLoadStatistics();
+}
+
 StorageProcessCreationParameters WebsiteDataStore::storageProcessParameters()
 {
     resolveDirectoriesIfNecessary();

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (220411 => 220412)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -92,6 +92,7 @@
     bool resourceLoadStatisticsEnabled() const;
     void setResourceLoadStatisticsEnabled(bool);
     WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
+    void clearResourceLoadStatisticsInWebProcesses();
 
     static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
 

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (220411 => 220412)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1451,6 +1451,11 @@
     WebCore::Settings::setResourceLoadStatisticsEnabled(enabled);
 }
 
+void WebProcess::clearResourceLoadStatistics()
+{
+    ResourceLoadObserver::shared().clearState();
+}
+
 RefPtr<API::Object> WebProcess::transformHandlesToObjects(API::Object* object)
 {
     struct Transformer final : UserData::Transformer {

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (220411 => 220412)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -255,6 +255,7 @@
     void setAlwaysUsesComplexTextCodePath(bool);
     void setShouldUseFontSmoothing(bool);
     void setResourceLoadStatisticsEnabled(bool);
+    void clearResourceLoadStatistics();
     void userPreferredLanguagesChanged(const Vector<String>&) const;
     void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
 

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (220411 => 220412)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2017-08-08 17:18:24 UTC (rev 220412)
@@ -41,6 +41,7 @@
     SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
     SetShouldUseFontSmoothing(bool useFontSmoothing)
     SetResourceLoadStatisticsEnabled(bool resourceLoadStatisticsEnabled);
+    ClearResourceLoadStatistics();
     UserPreferredLanguagesChanged(Vector<String> languages)
     FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
 

Modified: trunk/Tools/ChangeLog (220411 => 220412)


--- trunk/Tools/ChangeLog	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/ChangeLog	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1,3 +1,31 @@
+2017-08-08  John Wilander  <wilan...@apple.com>
+
+        Resource Load Statistics: Clear web processes' state on history removal
+        https://bugs.webkit.org/show_bug.cgi?id=175271
+        <rdar://problem/33756560>
+
+        Reviewed by Chris Dumez.
+
+        Test infrastructure for asynchronous tests of website data
+        removal for _WKWebsiteDataTypeResourceLoadStatistics.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::statisticsClearThroughWebsiteDataRemoval):
+        (WTR::TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::statisticsClearThroughWebsiteDataRemoval):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+        (WTR::TestInvocation::didClearStatisticsThroughWebsiteDataRemoval):
+        * WebKitTestRunner/TestInvocation.h:
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::statisticsClearThroughWebsiteDataRemoval):
+
 2017-08-08  Alicia Boya García  <ab...@igalia.com>
 
         Add Alicia Boya García as contributor

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-08-08 17:18:24 UTC (rev 220412)
@@ -279,6 +279,7 @@
     void setStatisticsPruneEntriesDownTo(unsigned long entries);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned long hours);
+    void statisticsClearThroughWebsiteDataRemoval(object callback);
     void statisticsResetToConsistentState();
 
     // Open panel

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -240,6 +240,11 @@
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "CallDidClearStatisticsThroughWebsiteDataRemoval")) {
+        m_testRunner->statisticsCallClearThroughWebsiteDataRemovalCallback();
+        return;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "CallDidRemoveAllSessionCredentialsCallback")) {
         m_testRunner->callDidRemoveAllSessionCredentialsCallback();
         return;

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -645,6 +645,7 @@
     StatisticsDidModifyDataRecordsCallbackID,
     StatisticsDidScanDataRecordsCallbackID,
     StatisticsDidRunTelemetryCallbackID,
+    StatisticsDidClearThroughWebsiteDataRemovalCallbackID,
     DidRemoveAllSessionCredentialsCallbackID,
     FirstUIScriptCallbackID = 100
 };
@@ -1552,6 +1553,19 @@
     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
 
+void TestRunner::statisticsClearThroughWebsiteDataRemoval(JSValueRef callback)
+{
+    cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
+    
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsClearThroughWebsiteDataRemoval"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
+}
+
+void TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback()
+{
+    callTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID);
+}
+
 void TestRunner::statisticsResetToConsistentState()
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsResetToConsistentState"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -379,6 +379,8 @@
     void setStatisticsPruneEntriesDownTo(unsigned);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours);
+    void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
+    void statisticsCallClearThroughWebsiteDataRemovalCallback();
     void statisticsResetToConsistentState();
 
     // Open panel

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -2357,6 +2357,10 @@
 {
 }
 
+void TestController::statisticsClearThroughWebsiteDataRemoval()
+{
+}
+
 void TestController::statisticsResetToConsistentState()
 {
 }

Modified: trunk/Tools/WebKitTestRunner/TestController.h (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/TestController.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -175,6 +175,7 @@
     void setStatisticsPruneEntriesDownTo(unsigned);
     void statisticsClearInMemoryAndPersistentStore();
     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned);
+    void statisticsClearThroughWebsiteDataRemoval();
     void statisticsResetToConsistentState();
 
     WKArrayRef openPanelFileURLs() const { return m_openPanelFileURLs.get(); }

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-08-08 17:18:24 UTC (rev 220412)
@@ -1142,6 +1142,11 @@
         return nullptr;
     }
     
+    if (WKStringIsEqualToUTF8CString(messageName, "StatisticsClearThroughWebsiteDataRemoval")) {
+        TestController::singleton().statisticsClearThroughWebsiteDataRemoval();
+        return nullptr;
+    }
+    
     if (WKStringIsEqualToUTF8CString(messageName, "StatisticsResetToConsistentState")) {
         TestController::singleton().statisticsResetToConsistentState();
         return nullptr;
@@ -1226,6 +1231,12 @@
     WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
 }
 
+void TestInvocation::didClearStatisticsThroughWebsiteDataRemoval()
+{
+    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidClearStatisticsThroughWebsiteDataRemoval"));
+    WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
 void TestInvocation::didRemoveAllSessionCredentials()
 {
     WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidRemoveAllSessionCredentialsCallback"));

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/TestInvocation.h	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h	2017-08-08 17:18:24 UTC (rev 220412)
@@ -71,6 +71,8 @@
 
     void notifyDownloadDone();
 
+    void didClearStatisticsThroughWebsiteDataRemoval();
+
     void didRemoveAllSessionCredentials();
     
 private:

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (220411 => 220412)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2017-08-08 17:15:49 UTC (rev 220411)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2017-08-08 17:18:24 UTC (rev 220412)
@@ -371,6 +371,16 @@
     [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:hours];
 }
 
+void TestController::statisticsClearThroughWebsiteDataRemoval()
+{
+#if WK_API_ENABLED
+    auto types = adoptNS([[NSSet alloc] initWithObjects:_WKWebsiteDataTypeResourceLoadStatistics, nil]);
+    [globalWebViewConfiguration.websiteDataStore removeDataOfTypes:types.get() modifiedSince:[NSDate distantPast] completionHandler:^() {
+        m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
+    }];
+#endif
+}
+
 void TestController::statisticsResetToConsistentState()
 {
     [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsResetToConsistentState];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to