Changeset 250156 in webkit


Ignore:
Timestamp:
Sep 20, 2019 2:45:53 PM (5 years ago)
Author:
achristensen@apple.com
Message:

Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
https://bugs.webkit.org/show_bug.cgi?id=202025

Reviewed by Chris Dumez.

One expected change in behavior is that the resource load statistics directory is not created on startup with an ephemeral session any more
because we call the constructor of WebsiteDataStoreConfiguration inside _WKWebsiteDataStoreConfiguration and set the default directory like we do the other directories.

  • TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::websiteDataStore):
(WTR::TestController::generatePageConfiguration):

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r250138 r250156  
     12019-09-20  Alex Christensen  <achristensen@webkit.org>
     2
     3        Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
     4        https://bugs.webkit.org/show_bug.cgi?id=202025
     5
     6        Reviewed by Chris Dumez.
     7
     8        One expected change in behavior is that the resource load statistics directory is not created on startup with an ephemeral session any more
     9        because we call the constructor of WebsiteDataStoreConfiguration inside _WKWebsiteDataStoreConfiguration and set the default directory like we do the other directories.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
     12        * WebKitTestRunner/TestController.cpp:
     13        (WTR::TestController::websiteDataStore):
     14        (WTR::TestController::generatePageConfiguration):
     15
    1162019-09-20  Keith Rollin  <krollin@apple.com>
    217
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm

    r245698 r250156  
    226226{
    227227    done = false;
    228     [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
     228    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
     229    storeConfiguration.perOriginStorageQuota = 1024 * 400;
     230    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
     231    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
    229232        done = true;
    230233    }];
     
    232235
    233236    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    234 
    235     [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
    236    
     237    [configuration setWebsiteDataStore:dataStore];
     238
    237239    auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
    238240    [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
     
    287289{
    288290    done = false;
    289     [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
     291    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
     292    storeConfiguration.perOriginStorageQuota = 1024 * 400;
     293    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
     294    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
    290295        done = true;
    291296    }];
     
    293298   
    294299    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    295    
    296     [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
     300    [configuration setWebsiteDataStore:dataStore];
    297301   
    298302    auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
     
    333337{
    334338    done = false;
    335     [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
     339    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
     340    storeConfiguration.perOriginStorageQuota = 1024 * 400;
     341    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
     342    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
    336343        done = true;
    337344    }];
     
    339346
    340347    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    341 
    342     [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
     348    [configuration setWebsiteDataStore:dataStore];
    343349
    344350    auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm

    r249808 r250156  
    407407    [configuration.get().websiteDataStore _setResourceLoadStatisticsEnabled:YES];
    408408
    409     // We expect the directory to be created by starting up the data store machinery, but not the data file.
    410     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
     409    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
    411410
    412411    NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
     
    451450    [configuration.get().websiteDataStore _setResourceLoadStatisticsEnabled:YES];
    452451
    453     // We expect the directory to be created by starting up the data store machinery, but not the data file.
    454     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
     452    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
    455453
    456454    NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r249808 r250156  
    524524            WKWebsiteDataStoreConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + pathSeparator + "MediaKeys").get());
    525525            WKWebsiteDataStoreConfigurationSetResourceLoadStatisticsDirectory(configuration.get(), toWK(temporaryFolder + pathSeparator + "ResourceLoadStatistics").get());
     526            WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota(configuration.get(), 400 * 1024);
    526527        }
    527528        dataStore = WKWebsiteDataStoreCreateWithConfiguration(configuration.get());
     
    551552        WKContextUseTestingNetworkSession(m_context.get());
    552553        WKContextSetCacheModel(m_context.get(), kWKCacheModelDocumentBrowser);
    553 
    554         WKWebsiteDataStoreSetPerOriginStorageQuota(TestController::websiteDataStore(), 400 * 1024);
    555554
    556555        platformInitializeContext();
Note: See TracChangeset for help on using the changeset viewer.