Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement removeDataOfTypes to WKWebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=256452 Reviewed by NOBODY (OOPS!). Add a function to WKAPI similar to WKWebsiteDataStore::removeDataOfTypes in the Cocoa port. * Source/WebKit/Headers.cmake: * Source/WebKit/Shared/API/c/WKBase.h: * Source/WebKit/Sources.txt: * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/UIProcess/API/C/WKAPICast.cpp: Added. (WebKit::toWebsiteDataTypes): (WebKit::toAPI): * Source/WebKit/UIProcess/API/C/WKAPICast.h: * Source/WebKit/UIProcess/API/C/WKWebsiteDataRecordRef.cpp: Copied from Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingTreeIOS.h. (WKWebsiteDataRecordGetTypeID): (WKWebsiteDataRecordGetDisplayName): (WKWebsiteDataRecordGetDataTypes): * Source/WebKit/UIProcess/API/C/WKWebsiteDataRecordRef.h: Added. * Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveITPDataForDomain): (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval): (WKWebsiteDataStoreRemoveAllFetchCaches): (WKWebsiteDataStoreRemoveNetworkCache): (WKWebsiteDataStoreRemoveMemoryCaches): (WKWebsiteDataStoreRemoveFetchCacheForOrigin): (WKWebsiteDataStoreRemoveAllIndexedDatabases): (WKWebsiteDataStoreRemoveLocalStorage): (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations): (WKWebsiteDataStoreClearPrivateClickMeasurementsThroughWebsiteDataRemoval): (WKWebsiteDataStoreClearStorage): (WKWebsiteDataStoreAllWebsiteDataTypes): (WKWebsiteDataStoreRemoveDataOfTypes): (WKWebsiteDataStoreRemoveDataOfTypesWithValues): * Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h: * Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingTreeIOS.cpp: * Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingTreeIOS.h: * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Tools/MiniBrowser/win/WebKitBrowserWindow.cpp: (removeDataOfTypesCallback): (WebKitBrowserWindow::clearWebsiteData): (removeAllFetchCachesCallback): Deleted. (removeNetworkCacheCallback): Deleted. (removeMemoryCachesCallback): Deleted. (removeAllServiceWorkerRegistrationsCallback): Deleted. (removeAllIndexedDatabasesCallback): Deleted. (removeLocalStorageCallback): Deleted. * Tools/WebKitTestRunner/TestController.cpp: (WTR::TestController::clearServiceWorkerRegistrations): (WTR::TestController::clearDOMCache): (WTR::TestController::clearDOMCaches): (WTR::TestController::clearMemoryCache): (WTR::TestController::clearIndexedDatabases): (WTR::TestController::clearLocalStorage): (WTR::TestController::clearStorage): (WTR::TestController::clearStatisticsDataForDomain): (WTR::TestController::statisticsClearThroughWebsiteDataRemoval): (WTR::TestController::clearPrivateClickMeasurementsThroughWebsiteDataRemoval): * Tools/WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
- Loading branch information
Showing
17 changed files
with
423 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (C) 2023 Sony Interactive Entertainment Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "WKAPICast.h" | ||
|
||
namespace WebKit { | ||
|
||
OptionSet<WebsiteDataType> toWebsiteDataTypes(WKWebsiteDataTypes websiteDataTypes) | ||
{ | ||
OptionSet<WebsiteDataType> result; | ||
|
||
if (websiteDataTypes & kWKWebsiteDataTypesCookies) | ||
result.add(WebsiteDataType::Cookies); | ||
if (websiteDataTypes & kWKWebsiteDataTypesDiskCache) | ||
result.add(WebsiteDataType::DiskCache); | ||
if (websiteDataTypes & kWKWebsiteDataTypesMemoryCache) | ||
result.add(WebsiteDataType::MemoryCache); | ||
if (websiteDataTypes & kWKWebsiteDataTypesOfflineWebApplicationCache) | ||
result.add(WebsiteDataType::OfflineWebApplicationCache); | ||
if (websiteDataTypes & kWKWebsiteDataTypesSessionStorage) | ||
result.add(WebsiteDataType::SessionStorage); | ||
if (websiteDataTypes & kWKWebsiteDataTypesLocalStorage) | ||
result.add(WebsiteDataType::LocalStorage); | ||
if (websiteDataTypes & kWKWebsiteDataTypesWebSQLDatabases) | ||
result.add(WebsiteDataType::WebSQLDatabases); | ||
if (websiteDataTypes & kWKWebsiteDataTypesIndexedDBDatabases) | ||
result.add(WebsiteDataType::IndexedDBDatabases); | ||
if (websiteDataTypes & kWKWebsiteDataTypesMediaKeys) | ||
result.add(WebsiteDataType::MediaKeys); | ||
if (websiteDataTypes & kWKWebsiteDataTypesHSTSCache) | ||
result.add(WebsiteDataType::HSTSCache); | ||
if (websiteDataTypes & kWKWebsiteDataTypesSearchFieldRecentSearches) | ||
result.add(WebsiteDataType::SearchFieldRecentSearches); | ||
if (websiteDataTypes & kWKWebsiteDataTypesResourceLoadStatistics) | ||
result.add(WebsiteDataType::ResourceLoadStatistics); | ||
if (websiteDataTypes & kWKWebsiteDataTypesCredentials) | ||
result.add(WebsiteDataType::Credentials); | ||
#if ENABLE(SERVICE_WORKER) | ||
if (websiteDataTypes & kWKWebsiteDataTypesServiceWorkerRegistrations) | ||
result.add(WebsiteDataType::ServiceWorkerRegistrations); | ||
#endif | ||
if (websiteDataTypes & kWKWebsiteDataTypesDOMCache) | ||
result.add(WebsiteDataType::DOMCache); | ||
if (websiteDataTypes & kWKWebsiteDataTypesDeviceIdHashSalt) | ||
result.add(WebsiteDataType::DeviceIdHashSalt); | ||
if (websiteDataTypes & kWKWebsiteDataTypesPrivateClickMeasurements) | ||
result.add(WebsiteDataType::PrivateClickMeasurements); | ||
#if HAVE(ALTERNATIVE_SERVICE) | ||
if (websiteDataTypes & kWKWebsiteDataTypesAlternativeServices) | ||
result.add(WebsiteDataType::AlternativeServices); | ||
#endif | ||
if (websiteDataTypes & kWKWebsiteDataTypesFileSystem) | ||
result.add(WebsiteDataType::FileSystem); | ||
#if ENABLE(SERVICE_WORKER) | ||
if (websiteDataTypes & kWKWebsiteDataTypesBackgroundFetchStorage) | ||
result.add(WebsiteDataType::BackgroundFetchStorage); | ||
#endif | ||
|
||
return result; | ||
} | ||
|
||
WKWebsiteDataTypes toAPI(const OptionSet<WebsiteDataType>& websiteDataTypes) | ||
{ | ||
WKWebsiteDataTypes result = 0; | ||
|
||
if (websiteDataTypes.contains(WebsiteDataType::Cookies)) | ||
result |= kWKWebsiteDataTypesCookies; | ||
if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) | ||
result |= kWKWebsiteDataTypesDiskCache; | ||
if (websiteDataTypes.contains(WebsiteDataType::MemoryCache)) | ||
result |= kWKWebsiteDataTypesMemoryCache; | ||
if (websiteDataTypes.contains(WebsiteDataType::OfflineWebApplicationCache)) | ||
result |= kWKWebsiteDataTypesOfflineWebApplicationCache; | ||
if (websiteDataTypes.contains(WebsiteDataType::SessionStorage)) | ||
result |= kWKWebsiteDataTypesSessionStorage; | ||
if (websiteDataTypes.contains(WebsiteDataType::LocalStorage)) | ||
result |= kWKWebsiteDataTypesLocalStorage; | ||
if (websiteDataTypes.contains(WebsiteDataType::WebSQLDatabases)) | ||
result |= kWKWebsiteDataTypesWebSQLDatabases; | ||
if (websiteDataTypes.contains(WebsiteDataType::IndexedDBDatabases)) | ||
result |= kWKWebsiteDataTypesIndexedDBDatabases; | ||
if (websiteDataTypes.contains(WebsiteDataType::MediaKeys)) | ||
result |= kWKWebsiteDataTypesMediaKeys; | ||
if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) | ||
result |= kWKWebsiteDataTypesHSTSCache; | ||
if (websiteDataTypes.contains(WebsiteDataType::SearchFieldRecentSearches)) | ||
result |= kWKWebsiteDataTypesSearchFieldRecentSearches; | ||
if (websiteDataTypes.contains(WebsiteDataType::ResourceLoadStatistics)) | ||
result |= kWKWebsiteDataTypesResourceLoadStatistics; | ||
if (websiteDataTypes.contains(WebsiteDataType::Credentials)) | ||
result |= kWKWebsiteDataTypesCredentials; | ||
#if ENABLE(SERVICE_WORKER) | ||
if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) | ||
result |= kWKWebsiteDataTypesServiceWorkerRegistrations; | ||
#endif | ||
if (websiteDataTypes.contains(WebsiteDataType::DOMCache)) | ||
result |= kWKWebsiteDataTypesDOMCache; | ||
if (websiteDataTypes.contains(WebsiteDataType::DeviceIdHashSalt)) | ||
result |= kWKWebsiteDataTypesDeviceIdHashSalt; | ||
if (websiteDataTypes.contains(WebsiteDataType::PrivateClickMeasurements)) | ||
result |= kWKWebsiteDataTypesPrivateClickMeasurements; | ||
#if HAVE(ALTERNATIVE_SERVICE) | ||
if (websiteDataTypes.contains(WebsiteDataType::AlternativeServices)) | ||
result |= kWKWebsiteDataTypesAlternativeServices; | ||
#endif | ||
if (websiteDataTypes.contains(WebsiteDataType::FileSystem)) | ||
result |= kWKWebsiteDataTypesFileSystem; | ||
#if ENABLE(SERVICE_WORKER) | ||
if (websiteDataTypes.contains(WebsiteDataType::BackgroundFetchStorage)) | ||
result |= kWKWebsiteDataTypesBackgroundFetchStorage; | ||
#endif | ||
|
||
return result; | ||
} | ||
|
||
} // namespace WebKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2023 Sony Interactive Entertainment Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "WKWebsiteDataRecordRef.h" | ||
|
||
#include "APIWebsiteDataRecord.h" | ||
#include "WKAPICast.h" | ||
|
||
WKTypeID WKWebsiteDataRecordGetTypeID() | ||
{ | ||
return WebKit::toAPI(API::WebsiteDataRecord::APIType); | ||
} | ||
|
||
WKStringRef WKWebsiteDataRecordGetDisplayName(WKWebsiteDataRecordRef dataRecordRef) | ||
{ | ||
return WebKit::toCopiedAPI(WebKit::toImpl(dataRecordRef)->websiteDataRecord().displayName); | ||
} | ||
|
||
WKWebsiteDataTypes WKWebsiteDataRecordGetDataTypes(WKWebsiteDataRecordRef dataRecordRef) | ||
{ | ||
return WebKit::toAPI(WebKit::toImpl(dataRecordRef)->websiteDataRecord().types); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2023 Sony Interactive Entertainment Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <WebKit/WKBase.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
enum { | ||
kWKWebsiteDataTypesCookies = 1 << 0, | ||
kWKWebsiteDataTypesDiskCache = 1 << 1, | ||
kWKWebsiteDataTypesMemoryCache = 1 << 2, | ||
kWKWebsiteDataTypesOfflineWebApplicationCache = 1 << 3, | ||
kWKWebsiteDataTypesSessionStorage = 1 << 4, | ||
kWKWebsiteDataTypesLocalStorage = 1 << 5, | ||
kWKWebsiteDataTypesWebSQLDatabases = 1 << 6, | ||
kWKWebsiteDataTypesIndexedDBDatabases = 1 << 7, | ||
kWKWebsiteDataTypesMediaKeys = 1 << 8, | ||
kWKWebsiteDataTypesHSTSCache = 1 << 9, | ||
kWKWebsiteDataTypesSearchFieldRecentSearches = 1 << 10, | ||
kWKWebsiteDataTypesResourceLoadStatistics = 1 << 12, | ||
kWKWebsiteDataTypesCredentials = 1 << 13, | ||
kWKWebsiteDataTypesServiceWorkerRegistrations = 1 << 14, | ||
kWKWebsiteDataTypesDOMCache = 1 << 15, | ||
kWKWebsiteDataTypesDeviceIdHashSalt = 1 << 16, | ||
kWKWebsiteDataTypesPrivateClickMeasurements = 1 << 17, | ||
kWKWebsiteDataTypesAlternativeServices = 1 << 18, | ||
kWKWebsiteDataTypesFileSystem = 1 << 19, | ||
kWKWebsiteDataTypesBackgroundFetchStorage = 1 << 20 | ||
}; | ||
typedef uint64_t WKWebsiteDataTypes; | ||
|
||
WK_EXPORT WKTypeID WKWebsiteDataRecordGetTypeID(); | ||
|
||
WK_EXPORT WKStringRef WKWebsiteDataRecordGetDisplayName(WKWebsiteDataRecordRef dataRecordRef); | ||
WK_EXPORT WKWebsiteDataTypes WKWebsiteDataRecordGetDataTypes(WKWebsiteDataRecordRef dataRecordRef); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.