Changeset 220412 in webkit


Ignore:
Timestamp:
Aug 8, 2017 10:18:24 AM (7 years ago)
Author:
wilander@apple.com
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 ].

Location:
trunk
Files:
2 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220410 r220412  
     12017-08-08  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Clear web processes' state on history removal
     4        https://bugs.webkit.org/show_bug.cgi?id=175271
     5        <rdar://problem/33756560>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal-expected.txt: Added.
     10        * http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html: Added.
     11        * platform/mac-wk2/TestExpectations:
     12            user-interaction-reported-after-website-data-removal.html marked as [ Pass ].
     13
    1142017-08-08  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r220375 r220412  
    732732http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html [ Pass ]
    733733http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Pass ]
     734http/tests/loading/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Pass ]
    734735
    735736webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html [ Pass Timeout ]
  • trunk/Source/WebKit/ChangeLog

    r220408 r220412  
     12017-08-08  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Clear web processes' state on history removal
     4        https://bugs.webkit.org/show_bug.cgi?id=175271
     5        <rdar://problem/33756560>
     6
     7        Reviewed by Chris Dumez.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=175090 introduced state
     10        in the web process and that state needs to be cleared when the
     11        UI process' statistics are cleared as part of history removal.
     12
     13        * UIProcess/WebProcessPool.cpp:
     14        (WebKit::WebProcessPool::clearResourceLoadStatistics):
     15        * UIProcess/WebProcessPool.h:
     16        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     17        (WebKit::WebsiteDataStore::removeData):
     18        (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
     19        * UIProcess/WebsiteData/WebsiteDataStore.h:
     20        * WebProcess/WebProcess.cpp:
     21        (WebKit::WebProcess::clearResourceLoadStatistics):
     22        * WebProcess/WebProcess.h:
     23        * WebProcess/WebProcess.messages.in:
     24
    1252017-08-08  Adrian Perez de Castro  <aperez@igalia.com>
    226
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r220105 r220412  
    11001100}
    11011101
     1102void WebProcessPool::clearResourceLoadStatistics()
     1103{
     1104    sendToAllProcesses(Messages::WebProcess::ClearResourceLoadStatistics());
     1105}
     1106
    11021107void WebProcessPool::registerURLSchemeAsEmptyDocument(const String& urlScheme)
    11031108{
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r220105 r220412  
    389389    bool resourceLoadStatisticsEnabled() { return m_resourceLoadStatisticsEnabled; }
    390390    void setResourceLoadStatisticsEnabled(bool);
     391    void clearResourceLoadStatistics();
    391392
    392393    bool alwaysRunsAtBackgroundPriority() const { return m_alwaysRunsAtBackgroundPriority; }
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r220105 r220412  
    822822        else
    823823            m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
     824
     825        clearResourceLoadStatisticsInWebProcesses();
    824826    }
    825827
     
    11001102        else
    11011103            m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
     1104
     1105        clearResourceLoadStatisticsInWebProcesses();
    11021106    }
    11031107
     
    13161320}
    13171321
     1322void WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses()
     1323{
     1324    if (!resourceLoadStatisticsEnabled())
     1325        return;
     1326
     1327    for (auto& processPool : processPools())
     1328        processPool->clearResourceLoadStatistics();
     1329}
     1330
    13181331StorageProcessCreationParameters WebsiteDataStore::storageProcessParameters()
    13191332{
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r220243 r220412  
    9393    void setResourceLoadStatisticsEnabled(bool);
    9494    WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
     95    void clearResourceLoadStatisticsInWebProcesses();
    9596
    9697    static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r220404 r220412  
    14521452}
    14531453
     1454void WebProcess::clearResourceLoadStatistics()
     1455{
     1456    ResourceLoadObserver::shared().clearState();
     1457}
     1458
    14541459RefPtr<API::Object> WebProcess::transformHandlesToObjects(API::Object* object)
    14551460{
  • trunk/Source/WebKit/WebProcess/WebProcess.h

    r220105 r220412  
    256256    void setShouldUseFontSmoothing(bool);
    257257    void setResourceLoadStatisticsEnabled(bool);
     258    void clearResourceLoadStatistics();
    258259    void userPreferredLanguagesChanged(const Vector<String>&) const;
    259260    void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
  • trunk/Source/WebKit/WebProcess/WebProcess.messages.in

    r218419 r220412  
    4242    SetShouldUseFontSmoothing(bool useFontSmoothing)
    4343    SetResourceLoadStatisticsEnabled(bool resourceLoadStatisticsEnabled);
     44    ClearResourceLoadStatistics();
    4445    UserPreferredLanguagesChanged(Vector<String> languages)
    4546    FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
  • trunk/Tools/ChangeLog

    r220407 r220412  
     12017-08-08  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Clear web processes' state on history removal
     4        https://bugs.webkit.org/show_bug.cgi?id=175271
     5        <rdar://problem/33756560>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Test infrastructure for asynchronous tests of website data
     10        removal for _WKWebsiteDataTypeResourceLoadStatistics.
     11
     12        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     13        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     14        (WTR::InjectedBundle::didReceiveMessageToPage):
     15        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     16        (WTR::TestRunner::statisticsClearThroughWebsiteDataRemoval):
     17        (WTR::TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback):
     18        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     19        * WebKitTestRunner/TestController.cpp:
     20        (WTR::TestController::statisticsClearThroughWebsiteDataRemoval):
     21        * WebKitTestRunner/TestController.h:
     22        * WebKitTestRunner/TestInvocation.cpp:
     23        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     24        (WTR::TestInvocation::didClearStatisticsThroughWebsiteDataRemoval):
     25        * WebKitTestRunner/TestInvocation.h:
     26        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     27        (WTR::TestController::statisticsClearThroughWebsiteDataRemoval):
     28
    1292017-08-08  Alicia Boya García  <aboya@igalia.com>
    230
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r219319 r220412  
    280280    void statisticsClearInMemoryAndPersistentStore();
    281281    void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned long hours);
     282    void statisticsClearThroughWebsiteDataRemoval(object callback);
    282283    void statisticsResetToConsistentState();
    283284
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r220311 r220412  
    241241    }
    242242
     243    if (WKStringIsEqualToUTF8CString(messageName, "CallDidClearStatisticsThroughWebsiteDataRemoval")) {
     244        m_testRunner->statisticsCallClearThroughWebsiteDataRemovalCallback();
     245        return;
     246    }
     247
    243248    if (WKStringIsEqualToUTF8CString(messageName, "CallDidRemoveAllSessionCredentialsCallback")) {
    244249        m_testRunner->callDidRemoveAllSessionCredentialsCallback();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r220403 r220412  
    646646    StatisticsDidScanDataRecordsCallbackID,
    647647    StatisticsDidRunTelemetryCallbackID,
     648    StatisticsDidClearThroughWebsiteDataRemovalCallbackID,
    648649    DidRemoveAllSessionCredentialsCallbackID,
    649650    FirstUIScriptCallbackID = 100
     
    15531554}
    15541555
     1556void TestRunner::statisticsClearThroughWebsiteDataRemoval(JSValueRef callback)
     1557{
     1558    cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
     1559   
     1560    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsClearThroughWebsiteDataRemoval"));
     1561    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
     1562}
     1563
     1564void TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback()
     1565{
     1566    callTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID);
     1567}
     1568
    15551569void TestRunner::statisticsResetToConsistentState()
    15561570{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r220311 r220412  
    380380    void statisticsClearInMemoryAndPersistentStore();
    381381    void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours);
     382    void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
     383    void statisticsCallClearThroughWebsiteDataRemovalCallback();
    382384    void statisticsResetToConsistentState();
    383385
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r220370 r220412  
    23582358}
    23592359
     2360void TestController::statisticsClearThroughWebsiteDataRemoval()
     2361{
     2362}
     2363
    23602364void TestController::statisticsResetToConsistentState()
    23612365{
  • trunk/Tools/WebKitTestRunner/TestController.h

    r219319 r220412  
    176176    void statisticsClearInMemoryAndPersistentStore();
    177177    void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned);
     178    void statisticsClearThroughWebsiteDataRemoval();
    178179    void statisticsResetToConsistentState();
    179180
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r219319 r220412  
    11431143    }
    11441144   
     1145    if (WKStringIsEqualToUTF8CString(messageName, "StatisticsClearThroughWebsiteDataRemoval")) {
     1146        TestController::singleton().statisticsClearThroughWebsiteDataRemoval();
     1147        return nullptr;
     1148    }
     1149   
    11451150    if (WKStringIsEqualToUTF8CString(messageName, "StatisticsResetToConsistentState")) {
    11461151        TestController::singleton().statisticsResetToConsistentState();
     
    12271232}
    12281233
     1234void TestInvocation::didClearStatisticsThroughWebsiteDataRemoval()
     1235{
     1236    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidClearStatisticsThroughWebsiteDataRemoval"));
     1237    WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
     1238}
     1239
    12291240void TestInvocation::didRemoveAllSessionCredentials()
    12301241{
  • trunk/Tools/WebKitTestRunner/TestInvocation.h

    r217886 r220412  
    7272    void notifyDownloadDone();
    7373
     74    void didClearStatisticsThroughWebsiteDataRemoval();
     75
    7476    void didRemoveAllSessionCredentials();
    7577   
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r219319 r220412  
    372372}
    373373
     374void TestController::statisticsClearThroughWebsiteDataRemoval()
     375{
     376#if WK_API_ENABLED
     377    auto types = adoptNS([[NSSet alloc] initWithObjects:_WKWebsiteDataTypeResourceLoadStatistics, nil]);
     378    [globalWebViewConfiguration.websiteDataStore removeDataOfTypes:types.get() modifiedSince:[NSDate distantPast] completionHandler:^() {
     379        m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
     380    }];
     381#endif
     382}
     383
    374384void TestController::statisticsResetToConsistentState()
    375385{
Note: See TracChangeset for help on using the changeset viewer.