Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebKitBrowser] Updating IndexedDB to match version 2.42 of WPEWebKit #5328

Open
wants to merge 25 commits into
base: sprint/24Q2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ae82b56
Adding new IndexedDB options to the CMakeLists file
VeithMetro May 23, 2024
5d4f75a
Updating the configuration options in HtmlApp config
VeithMetro May 23, 2024
3a8f493
Updating the IndexedDB options in JSPP config
VeithMetro May 23, 2024
ff1b5a9
Updating the IndexedDB options in LightningApp config
VeithMetro May 23, 2024
5dca2c1
Updating the IndexedDB options in ResidentApp config
VeithMetro May 23, 2024
bc98a30
Updating the IndexedDB options in SearchAndDiscoveryApp config
VeithMetro May 23, 2024
de757ff
Updating the IndexedDB options in WebKitBrowser config
VeithMetro May 23, 2024
3f25dc7
Updating WebKitImplementation to match the new IndexedDB changes comi…
VeithMetro May 23, 2024
732e1dd
Adding base data and cache directories to WebsiteDataManager as persi…
VeithMetro May 23, 2024
3a57b29
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 3, 2024
0746974
Update HtmlApp.config
VeithMetro Jun 3, 2024
fd36350
Update LightningApp.config
VeithMetro Jun 3, 2024
a686009
Update ResidentApp.config
VeithMetro Jun 3, 2024
e7fa405
Update SearchAndDiscoveryApp.config
VeithMetro Jun 3, 2024
0ac60e6
Update WebKitBrowser.config
VeithMetro Jun 3, 2024
5c74a72
Update JSPP.config
VeithMetro Jun 3, 2024
b03ecbc
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 5, 2024
6b843e7
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 10, 2024
18dd714
Supporting IndexedDB for WebKit 2.38 with per-origin-storage-quota
VeithMetro Jun 10, 2024
7d1fcfb
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 13, 2024
3798da3
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 14, 2024
bdf24c5
Using Core::Partition instead of Core::File to get Size()
VeithMetro Jun 19, 2024
5901441
Enabling the use of IndexedDBPath from WebKit 2.38 instead of 2.42
VeithMetro Jun 21, 2024
4c9d8f1
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jun 21, 2024
7f1d472
Merge branch 'sprint/24Q2' into development-24Q2/indexeddb-2.42-update
VeithMetro Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions WebKitBrowser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ set(PLUGIN_WEBKITBROWSER_XHRCACHE "true" CACHE STRING "XHR Cache")
set(PLUGIN_WEBKITBROWSER_EXTENSION_DIRECTORY "Extension" CACHE STRING "Directory to store extension libraries")
set(PLUGIN_WEBKITBROWSER_LOCALSTORAGE "" CACHE STRING "HTML5 local storage path")
set(PLUGIN_WEBKITBROWSER_COOKIESTORAGE "" CACHE STRING "Browser cookie storage path")
set(PLUGIN_WEBKITBROWSER_INDEXEDDB_ENABLE "false" CACHE STRING "Enable IndexedDB (HTML5) database")
set(PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH "%persistentpath%" CACHE STRING "The directory where IndexedDB databases will be stored")
set(PLUGIN_WEBKITBROWSER_ORIGIN_STORAGE_RATIO "" CACHE STRING "The percentage of volume space that can be used for data storage for each domain")
set(PLUGIN_WEBKITBROWSER_TOTAL_STORAGE_RATIO "" CACHE STRING "The percentage of volume space that can be used for data storage for all domains")
set(PLUGIN_WEBKITBROWSER_WINDOWCLOSE "false" CACHE STRING "Allow window close")
set(PLUGIN_WEBKITBROWSER_WEBGL "true" CACHE STRING "Enable WebGL")
set(PLUGIN_WEBKITBROWSER_RESOLUTION "720p" CACHE STRING "Browser resolution")
Expand Down
3 changes: 2 additions & 1 deletion WebKitBrowser/HtmlApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ configuration.add("localstoragesize", "@PLUGIN_HTML_APP_LOCALSTORAGESIZE@")
configuration.add("cookiestorage", "@PLUGIN_HTML_APP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_HTML_APP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_HTML_APP_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_HTML_APP_INDEXEDDB_SIZE@")
configuration.add("originstorageratio", "@PLUGIN_HTML_APP_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_HTML_APP_TOTAL_STORAGE_RATIO@")

if boolean("@PLUGIN_HTML_APP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
7 changes: 5 additions & 2 deletions WebKitBrowser/HtmlApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ map()
if(PLUGIN_HTML_APP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_HTML_APP_INDEXEDDB_PATH})
endif()
if(PLUGIN_HTML_APP_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_HTML_APP_INDEXEDDB_SIZE})
if(PLUGIN_HTML_APP_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_HTML_APP_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_HTML_APP_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_HTML_APP_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_HTML_APP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_HTML_APP_WINDOWCLOSE})
Expand Down
4 changes: 4 additions & 0 deletions WebKitBrowser/JSPP.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ configuration.add("localstorageenabled", "@PLUGIN_JSPP_LOCALSTORAGE_ENABLE@")
configuration.add("localstorage", "@PLUGIN_JSPP_LOCALSTORAGE@")
configuration.add("localstoragesize", "@PLUGIN_JSPP_LOCALSTORAGESIZE@")
configuration.add("cookiestorage", "@PLUGIN_JSPP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_JSPP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_JSPP_INDEXEDDB_PATH@")
configuration.add("originstorageratio", "@PLUGIN_JSPP_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_JSPP_TOTAL_STORAGE_RATIO@")

if boolean("@PLUGIN_JSPP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
12 changes: 12 additions & 0 deletions WebKitBrowser/JSPP.config
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ map()
if(PLUGIN_JSPP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_JSPP_COOKIESTORAGE})
endif()
if(PLUGIN_JSPP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_JSPP_INDEXEDDB_ENABLE})
endif()
if(PLUGIN_JSPP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_JSPP_INDEXEDDB_PATH})
endif()
if(PLUGIN_JSPP_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_JSPP_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_JSPP_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_JSPP_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_JSPP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_JSPP_WINDOWCLOSE})
endif()
Expand Down
3 changes: 2 additions & 1 deletion WebKitBrowser/LightningApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ configuration.add("localstoragesize", "@PLUGIN_LIGHTNING_APP_LOCALSTORAGESIZE@")
configuration.add("cookiestorage", "@PLUGIN_LIGHTNING_APP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_LIGHTNING_APP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_LIGHTNING_APP_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_LIGHTNING_APP_INDEXEDDB_SIZE@")
configuration.add("originstorageratio", "@PLUGIN_LIGHTNING_APP_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_LIGHTNING_APP_TOTAL_STORAGE_RATIO@")

if boolean("@PLUGIN_LIGHTNING_APP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
7 changes: 5 additions & 2 deletions WebKitBrowser/LightningApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ map()
if(PLUGIN_LIGHTNING_APP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_LIGHTNING_APP_INDEXEDDB_PATH})
endif()
if(PLUGIN_LIGHTNING_APP_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_LIGHTNING_APP_INDEXEDDB_SIZE})
if(PLUGIN_LIGHTNING_APP_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_LIGHTNING_APP_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_LIGHTNING_APP_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_LIGHTNING_APP_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_LIGHTNING_APP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_LIGHTNING_APP_WINDOWCLOSE})
Expand Down
3 changes: 2 additions & 1 deletion WebKitBrowser/ResidentApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ configuration.add("localstoragesize", "@PLUGIN_RESIDENT_APP_LOCALSTORAGESIZE@")
configuration.add("cookiestorage", "@PLUGIN_RESIDENT_APP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_RESIDENT_APP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_RESIDENT_APP_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_RESIDENT_APP_INDEXEDDB_SIZE@")
configuration.add("originstorageratio", "@PLUGIN_RESIDENT_APP_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_RESIDENT_APP_TOTAL_STORAGE_RATIO@")

if "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@" != "" and "@PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY@" != "":
configuration.add("clientcert", "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@")
Expand Down
7 changes: 5 additions & 2 deletions WebKitBrowser/ResidentApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ map()
if(PLUGIN_RESIDENT_APP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_RESIDENT_APP_INDEXEDDB_PATH})
endif()
if(PLUGIN_RESIDENT_APP_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_RESIDENT_APP_INDEXEDDB_SIZE})
if(PLUGIN_RESIDENT_APP_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_RESIDENT_APP_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_RESIDENT_APP_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_RESIDENT_APP_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_WEBKITBROWSER_CLIENT_CERT AND PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY)
kv(clientcert ${PLUGIN_WEBKITBROWSER_CLIENT_CERT})
Expand Down
3 changes: 2 additions & 1 deletion WebKitBrowser/SearchAndDiscoveryApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ configuration.add("localstoragesize", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_LOCALSTO
configuration.add("cookiestorage", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_SIZE@")
configuration.add("originstorageratio", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_TOTAL_STORAGE_RATIO@")

if "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@" != "" and "@PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY@" != "":
configuration.add("clientcert", "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@")
Expand Down
7 changes: 5 additions & 2 deletions WebKitBrowser/SearchAndDiscoveryApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ map()
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_PATH})
endif()
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_SIZE})
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_SEARCH_AND_DISCOVERY_APP_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_SEARCH_AND_DISCOVERY_APP_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_WEBKITBROWSER_CLIENT_CERT AND PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY)
kv(clientcert ${PLUGIN_WEBKITBROWSER_CLIENT_CERT})
Expand Down
3 changes: 2 additions & 1 deletion WebKitBrowser/WebKitBrowser.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ configuration.add("localstorage", "@PLUGIN_WEBKITBROWSER_LOCALSTORAGE@")
configuration.add("cookiestorage", "@PLUGIN_WEBKITBROWSER_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_WEBKITBROWSER_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE@")
configuration.add("originstorageratio", "@PLUGIN_WEBKITBROWSER_ORIGIN_STORAGE_RATIO@")
configuration.add("totalstorageratio", "@PLUGIN_WEBKITBROWSER_TOTAL_STORAGE_RATIO@")

if boolean("@PLUGIN_WEBKITBROWSER_WINDOWCLOSE@"):
configuration.add("windowclose", "@PLUGIN_WEBKITBROWSER_WINDOWCLOSE@")
Expand Down
7 changes: 5 additions & 2 deletions WebKitBrowser/WebKitBrowser.config
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ map()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH})
endif()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE})
if(PLUGIN_WEBKITBROWSER_ORIGIN_STORAGE_RATIO)
kv(originstorageratio ${PLUGIN_WEBKITBROWSER_ORIGIN_STORAGE_RATIO})
endif()
if(PLUGIN_WEBKITBROWSER_TOTAL_STORAGE_RATIO)
kv(totalstorageratio ${PLUGIN_WEBKITBROWSER_TOTAL_STORAGE_RATIO})
endif()
if(PLUGIN_WEBKITBROWSER_WINDOWCLOSE)
kv(windowclose ${PLUGIN_WEBKITBROWSER_WINDOWCLOSE})
Expand Down
68 changes: 57 additions & 11 deletions WebKitBrowser/WebKitImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ static GSourceFuncs _handlerIntervention =
, LocalStorageSize()
, IndexedDBEnabled(false)
, IndexedDBPath()
, IndexedDBSize()
, OriginStorageRatio()
, TotalStorageRatio()
, Secure(false)
, InjectedBundle()
, Transparent(false)
Expand Down Expand Up @@ -639,7 +640,8 @@ static GSourceFuncs _handlerIntervention =
Add(_T("localstoragesize"), &LocalStorageSize);
Add(_T("indexeddbenabled"), &IndexedDBEnabled);
Add(_T("indexeddbpath"), &IndexedDBPath);
Add(_T("indexeddbsize"), &IndexedDBSize);
Add(_T("originstorageratio"), &OriginStorageRatio);
Add(_T("totalstorageratio"), &TotalStorageRatio);
Add(_T("secure"), &Secure);
Add(_T("injectedbundle"), &InjectedBundle);
Add(_T("transparent"), &Transparent);
Expand Down Expand Up @@ -712,7 +714,8 @@ static GSourceFuncs _handlerIntervention =
Core::JSON::DecUInt16 LocalStorageSize;
Core::JSON::Boolean IndexedDBEnabled;
Core::JSON::String IndexedDBPath;
Core::JSON::DecUInt16 IndexedDBSize; // [KB]
Core::JSON::DecUInt8 OriginStorageRatio; // [percentage of volume space for each domain]
Core::JSON::DecUInt8 TotalStorageRatio; // [percentage of volume space for all domains]
Core::JSON::Boolean Secure;
Core::JSON::String InjectedBundle;
Core::JSON::Boolean Transparent;
Expand Down Expand Up @@ -2811,20 +2814,24 @@ static GSourceFuncs _handlerIntervention =
wpeDiskCachePath = g_build_filename(g_get_user_cache_dir(), "wpe", "disk-cache", nullptr);
}
g_mkdir_with_parents(wpeDiskCachePath, 0700);

#if WEBKIT_CHECK_VERSION(2, 42, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you enable this starting from 2.38, currently build is broken with:

WebKitImplementation.cpp:2883:44: error: 'indexedDBPath' was not declared in this scope

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done!

gchar* indexedDBPath = nullptr;
if (_config.IndexedDBPath.IsSet() && !_config.IndexedDBPath.Value().empty()) {
_config.IndexedDBPath = _service->Substitute(_config.IndexedDBPath.Value());
#ifdef USE_EXACT_PATHS
indexedDBPath = g_build_filename(_config.IndexedDBPath.Value().c_str(), nullptr);
#else
indexedDBPath = g_build_filename(_config.IndexedDBPath.Value().c_str(), "wpe", "databases", "indexeddb", nullptr);
#endif
} else {
#ifdef USE_EXACT_PATHS
indexedDBPath = g_build_filename(g_get_user_cache_dir(), nullptr);
#else
indexedDBPath = g_build_filename(g_get_user_cache_dir(), "wpe", "databases", "indexeddb", nullptr);
#endif
}
g_mkdir_with_parents(indexedDBPath, 0700);

uint64_t indexedDBSizeBytes = 0; // No limit by default, use WebKit defaults (1G at the moment of writing)
if (_config.IndexedDBSize.IsSet() && _config.IndexedDBSize.Value() != 0) {
indexedDBSizeBytes = _config.IndexedDBSize.Value() * 1024;
}

#endif
#if HAS_MEMORY_PRESSURE_SETTINGS_API
if ((_config.Memory.IsSet() == true) && (_config.Memory.NetworkProcessSettings.IsSet() == true)) {
WebKitMemoryPressureSettings* memoryPressureSettings = webkit_memory_pressure_settings_new();
Expand All @@ -2838,16 +2845,55 @@ static GSourceFuncs _handlerIntervention =
webkit_memory_pressure_settings_free(memoryPressureSettings);
}
#endif

#if WEBKIT_CHECK_VERSION(2, 42, 0)
double originStorageRatio = -1.0; // -1.0 means WebKit will use the default quota (1GB)
if (_config.OriginStorageRatio.IsSet() && _config.OriginStorageRatio.Value() != 0) {
originStorageRatio = static_cast<double>(_config.OriginStorageRatio.Value());
}

double totalStorageRatio = -1.0; // -1.0 means there's no limit for the total storage
if (_config.TotalStorageRatio.IsSet() && _config.TotalStorageRatio.Value() != 0) {
totalStorageRatio = static_cast<double>(_config.TotalStorageRatio.Value());
}

auto* websiteDataManager = webkit_website_data_manager_new(
"local-storage-directory", wpeStoragePath,
"disk-cache-directory", wpeDiskCachePath,
"local-storage-quota", localStorageDatabaseQuotaInBytes,
"indexeddb-directory", indexedDBPath,
"origin-storage-ratio", originStorageRatio,
"total-storage-ratio", totalStorageRatio,
"base-data-directory", _service->PersistentPath(),
"base-cache-directory", _service->VolatilePath(),
nullptr);
g_free(indexedDBPath);
#else
modeveci marked this conversation as resolved.
Show resolved Hide resolved
#if WEBKIT_CHECK_VERSION(2, 38, 0)
uint64_t indexedDBSizeBytes = 0; // No limit by default, use WebKit defaults (1G at the moment of writing)
if (_config.OriginStorageRatio.IsSet() && _config.OriginStorageRatio.Value() != 0) {
Core::File persistentPath(_service->PersistentPath());
indexedDBSizeBytes = ((persistentPath.Core::File::Size() * _config.OriginStorageRatio.Value()) / 100);
modeveci marked this conversation as resolved.
Show resolved Hide resolved
}

auto* websiteDataManager = webkit_website_data_manager_new(
"local-storage-directory", wpeStoragePath,
"disk-cache-directory", wpeDiskCachePath,
"local-storage-quota", localStorageDatabaseQuotaInBytes,
"indexeddb-directory", indexedDBPath,
"per-origin-storage-quota", indexedDBSizeBytes,
nullptr);
g_free(indexedDBPath);
#else
auto* websiteDataManager = webkit_website_data_manager_new(
"local-storage-directory", wpeStoragePath,
"disk-cache-directory", wpeDiskCachePath,
"local-storage-quota", localStorageDatabaseQuotaInBytes,
nullptr);
#endif
#endif
g_free(wpeStoragePath);
g_free(wpeDiskCachePath);
g_free(indexedDBPath);

#if HAS_MEMORY_PRESSURE_SETTINGS_API
if ((_config.Memory.IsSet() == true) && (_config.Memory.WebProcessSettings.IsSet() == true)) {
Expand Down
Loading