Test expectation adjustment.
[WebKit-https.git] / Source / WebKit / UIProcess / WebsiteData / WebsiteDataStoreConfiguration.cpp
1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "WebsiteDataStoreConfiguration.h"
28
29 #include "WebsiteDataStore.h"
30
31 namespace WebKit {
32
33 WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration(IsPersistent isPersistent, WillCopyPathsFromExistingConfiguration willCopyPaths)
34     : m_isPersistent(isPersistent)
35 {
36     if (isPersistent == IsPersistent::Yes && willCopyPaths == WillCopyPathsFromExistingConfiguration::No) {
37         setApplicationCacheDirectory(WebsiteDataStore::defaultApplicationCacheDirectory());
38         setCacheStorageDirectory(WebsiteDataStore::defaultCacheStorageDirectory());
39         setNetworkCacheDirectory(WebsiteDataStore::defaultNetworkCacheDirectory());
40         setAlternativeServicesDirectory(WebsiteDataStore::defaultAlternativeServicesDirectory());
41         setMediaCacheDirectory(WebsiteDataStore::defaultMediaCacheDirectory());
42         setIndexedDBDatabaseDirectory(WebsiteDataStore::defaultIndexedDBDatabaseDirectory());
43         setServiceWorkerRegistrationDirectory(WebsiteDataStore::defaultServiceWorkerRegistrationDirectory());
44         setWebSQLDatabaseDirectory(WebsiteDataStore::defaultWebSQLDatabaseDirectory());
45         setLocalStorageDirectory(WebsiteDataStore::defaultLocalStorageDirectory());
46         setMediaKeysStorageDirectory(WebsiteDataStore::defaultMediaKeysStorageDirectory());
47         setResourceLoadStatisticsDirectory(WebsiteDataStore::defaultResourceLoadStatisticsDirectory());
48         setDeviceIdHashSaltsStorageDirectory(WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory());
49         setJavaScriptConfigurationDirectory(WebsiteDataStore::defaultJavaScriptConfigurationDirectory());
50     }
51 }
52
53 Ref<WebsiteDataStoreConfiguration> WebsiteDataStoreConfiguration::copy() const
54 {
55     auto copy = WebsiteDataStoreConfiguration::create(m_isPersistent, WillCopyPathsFromExistingConfiguration::Yes);
56
57     copy->m_serviceWorkerProcessTerminationDelayEnabled = this->m_serviceWorkerProcessTerminationDelayEnabled;
58     copy->m_fastServerTrustEvaluationEnabled = this->m_fastServerTrustEvaluationEnabled;
59     copy->m_networkCacheSpeculativeValidationEnabled = this->m_networkCacheSpeculativeValidationEnabled;
60     copy->m_staleWhileRevalidateEnabled = this->m_staleWhileRevalidateEnabled;
61     copy->m_cacheStorageDirectory = this->m_cacheStorageDirectory;
62     copy->m_perOriginStorageQuota = this->m_perOriginStorageQuota;
63     copy->m_networkCacheDirectory = this->m_networkCacheDirectory;
64     copy->m_applicationCacheDirectory = this->m_applicationCacheDirectory;
65     copy->m_applicationCacheFlatFileSubdirectoryName = this->m_applicationCacheFlatFileSubdirectoryName;
66     copy->m_mediaCacheDirectory = this->m_mediaCacheDirectory;
67     copy->m_indexedDBDatabaseDirectory = this->m_indexedDBDatabaseDirectory;
68     copy->m_serviceWorkerRegistrationDirectory = this->m_serviceWorkerRegistrationDirectory;
69     copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory;
70     copy->m_hstsStorageDirectory = this->m_hstsStorageDirectory;
71     copy->m_localStorageDirectory = this->m_localStorageDirectory;
72     copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory;
73     copy->m_alternativeServicesDirectory = this->m_alternativeServicesDirectory;
74     copy->m_deviceIdHashSaltsStorageDirectory = this->m_deviceIdHashSaltsStorageDirectory;
75     copy->m_resourceLoadStatisticsDirectory = this->m_resourceLoadStatisticsDirectory;
76     copy->m_javaScriptConfigurationDirectory = this->m_javaScriptConfigurationDirectory;
77     copy->m_cookieStorageFile = this->m_cookieStorageFile;
78     copy->m_sourceApplicationBundleIdentifier = this->m_sourceApplicationBundleIdentifier;
79     copy->m_sourceApplicationSecondaryIdentifier = this->m_sourceApplicationSecondaryIdentifier;
80     copy->m_httpProxy = this->m_httpProxy;
81     copy->m_httpsProxy = this->m_httpsProxy;
82     copy->m_deviceManagementRestrictionsEnabled = this->m_deviceManagementRestrictionsEnabled;
83     copy->m_allLoadsBlockedByDeviceManagementRestrictionsForTesting = this->m_allLoadsBlockedByDeviceManagementRestrictionsForTesting;
84     copy->m_boundInterfaceIdentifier = this->m_boundInterfaceIdentifier;
85     copy->m_allowsCellularAccess = this->m_allowsCellularAccess;
86     copy->m_legacyTLSEnabled = this->m_legacyTLSEnabled;
87     copy->m_dataConnectionServiceType = this->m_dataConnectionServiceType;
88     copy->m_testingSessionEnabled = this->m_testingSessionEnabled;
89     copy->m_testSpeedMultiplier = this->m_testSpeedMultiplier;
90     copy->m_suppressesConnectionTerminationOnSystemChange = this->m_suppressesConnectionTerminationOnSystemChange;
91     copy->m_allowsServerPreconnect = this->m_allowsServerPreconnect;
92     copy->m_requiresSecureHTTPSProxyConnection = this->m_requiresSecureHTTPSProxyConnection;
93     copy->m_preventsSystemHTTPProxyAuthentication = this->m_preventsSystemHTTPProxyAuthentication;
94     copy->m_standaloneApplicationURL = this->m_standaloneApplicationURL;
95 #if PLATFORM(COCOA)
96     if (m_proxyConfiguration)
97         copy->m_proxyConfiguration = adoptCF(CFDictionaryCreateCopy(nullptr, this->m_proxyConfiguration.get()));
98 #endif
99
100     return copy;
101 }
102
103 } // namespace WebKit