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 #258

Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
79a072c
Adding the new options of WebKit to the main CMakeLists.txt
VeithMetro Oct 23, 2023
7f4e892
Marking consoleMessageSentCallback as DEPRECATED since it was removed
VeithMetro Oct 23, 2023
8b16586
Adding the new option to each conf.in file
VeithMetro Oct 23, 2023
7e1149d
Adding the new option to each .config file
VeithMetro Oct 23, 2023
3fbe86d
Updating everything to the WebKit API version 2.42
VeithMetro Oct 23, 2023
4be68ee
Minor formatting adjustemtns
VeithMetro Oct 23, 2023
69327e5
Removing the initial values of indexdb options in cmakelist
VeithMetro Oct 24, 2023
391b68b
Making sure that the correct version are inside version checks, remov…
VeithMetro Oct 24, 2023
cd4177e
Other option of indexdb will be only available if indexdb is enabled
VeithMetro Oct 24, 2023
0e43a87
Bringing back values for enabled and path of indexdb options
VeithMetro Oct 24, 2023
5f49074
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Nov 6, 2023
076dabd
Adding a persistant path substitution
VeithMetro Nov 6, 2023
9e7697d
Removing c_str() as it is no longer necessary
VeithMetro Nov 6, 2023
903fbd4
Fixing how the subsitution is done
VeithMetro Nov 6, 2023
d2115c0
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Nov 14, 2023
6576b2d
Adding a use of USE_EXACT_PATHS for indexedDBPath
VeithMetro Nov 17, 2023
06bf7f7
Changing IndexedDBSize and IndexedDBTotalSize to DecUInt16
VeithMetro Nov 23, 2023
269cc78
Removing support for indexedDB for previous WebKit API versions
VeithMetro Nov 30, 2023
802e431
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Nov 30, 2023
f1a7799
Moving some changes to different branches
VeithMetro Nov 30, 2023
233ffa6
Final formatting changes
VeithMetro Nov 30, 2023
4eb7d94
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Dec 1, 2023
ac293cd
Making sure WebKitBrowser builds correctly for WebKit API pre 2.42
VeithMetro Dec 5, 2023
13c3cd3
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Dec 20, 2023
7aafc86
Moving IndexedDBPath section to 2.42 only, resolving merge conflicts
VeithMetro Jan 8, 2024
3e32a72
Merge branch 'development/webkitbrowser-2.42-update' of github.com:Ve…
VeithMetro Jan 8, 2024
957f314
Resolving some more merge conflicts with remove config files
VeithMetro Jan 8, 2024
65c6bbe
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Jan 8, 2024
fd99b0b
Merge branch 'WebPlatformForEmbedded:master' into development/webkitb…
VeithMetro Jan 16, 2024
ea47814
Renaming IndexedDBSize to OriginStorageRatio and IndexedDBTotalSize t…
VeithMetro Jan 17, 2024
4a9f3e3
Merge branch 'development/webkitbrowser-2.42-update' of github.com:Ve…
VeithMetro Jan 17, 2024
44d31df
Renaming configurations to match the newest changes
VeithMetro Jan 17, 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 @@ -62,6 +62,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 "%persistentpath%" CACHE STRING "HTML5 local storage path")
set(PLUGIN_WEBKITBROWSER_COOKIESTORAGE "%persistentpath%" 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")
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved
set(PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE "" CACHE STRING "The percentage of volume space that can be used for data storage for each domain")
set(PLUGIN_WEBKITBROWSER_INDEXEDDB_TOTAL_SIZE "" 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
1 change: 1 addition & 0 deletions WebKitBrowser/HtmlApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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("indexeddbtotalsize", "@PLUGIN_HTML_APP_INDEXEDDB_TOTAL_SIZE@")

if boolean("@PLUGIN_HTML_APP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
17 changes: 11 additions & 6 deletions WebKitBrowser/HtmlApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,20 @@ map()
if(PLUGIN_HTML_APP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_HTML_APP_COOKIESTORAGE})
endif()

if(PLUGIN_HTML_APP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_HTML_APP_INDEXEDDB_ENABLE})
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})
endif()
if(PLUGIN_HTML_APP_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_HTML_APP_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
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})
endif()

if(PLUGIN_HTML_APP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_HTML_APP_WINDOWCLOSE})
endif()
Expand Down
1 change: 1 addition & 0 deletions WebKitBrowser/JSPP.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ configuration.add("cookiestorage", "@PLUGIN_JSPP_COOKIESTORAGE@")
configuration.add("indexeddbenabled", "@PLUGIN_JSPP_INDEXEDDB_ENABLE@")
configuration.add("indexeddbpath", "@PLUGIN_JSPP_INDEXEDDB_PATH@")
configuration.add("indexeddbsize", "@PLUGIN_JSPP_INDEXEDDB_SIZE@")
configuration.add("indexeddbtotalsize", "@PLUGIN_JSPP_INDEXEDDB_TOTAL_SIZE@")

if boolean("@PLUGIN_JSPP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
14 changes: 14 additions & 0 deletions WebKitBrowser/JSPP.config
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ map()
if(PLUGIN_JSPP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_JSPP_COOKIESTORAGE})
endif()

if(PLUGIN_JSPP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_JSPP_INDEXEDDB_ENABLE})
if(PLUGIN_JSPP_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_JSPP_INDEXEDDB_PATH})
endif()
if(PLUGIN_JSPP_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_JSPP_INDEXEDDB_SIZE})
endif()
if(PLUGIN_JSPP_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_JSPP_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved

if(PLUGIN_JSPP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_JSPP_WINDOWCLOSE})
endif()
Expand Down
1 change: 1 addition & 0 deletions WebKitBrowser/LightningApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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("indexeddbtotalsize", "@PLUGIN_LIGHTNING_APP_INDEXEDDB_TOTAL_SIZE@")

if boolean("@PLUGIN_LIGHTNING_APP_WINDOWCLOSE@"):
configuration.add("windowclose", "true")
Expand Down
17 changes: 11 additions & 6 deletions WebKitBrowser/LightningApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,20 @@ map()
if(PLUGIN_LIGHTNING_APP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_LIGHTNING_APP_COOKIESTORAGE})
endif()

if(PLUGIN_LIGHTNING_APP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_LIGHTNING_APP_INDEXEDDB_ENABLE})
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})
endif()
if(PLUGIN_LIGHTNING_APP_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_LIGHTNING_APP_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
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})
endif()

if(PLUGIN_LIGHTNING_APP_WINDOWCLOSE)
kv(windowclose ${PLUGIN_LIGHTNING_APP_WINDOWCLOSE})
endif()
Expand Down
1 change: 1 addition & 0 deletions WebKitBrowser/ResidentApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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("indexeddbtotalsize", "@PLUGIN_RESIDENT_APP_INDEXEDDB_TOTAL_SIZE@")

if "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@" != "" and "@PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY@" != "":
configuration.add("clientcert", "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@")
Expand Down
17 changes: 11 additions & 6 deletions WebKitBrowser/ResidentApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,20 @@ map()
if(PLUGIN_RESIDENT_APP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_RESIDENT_APP_COOKIESTORAGE})
endif()

if(PLUGIN_RESIDENT_APP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_RESIDENT_APP_INDEXEDDB_ENABLE})
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})
endif()
if(PLUGIN_RESIDENT_APP_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_RESIDENT_APP_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
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})
endif()

if(PLUGIN_WEBKITBROWSER_CLIENT_CERT AND PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY)
kv(clientcert ${PLUGIN_WEBKITBROWSER_CLIENT_CERT})
kv(clientcertkey ${PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY})
Expand Down
1 change: 1 addition & 0 deletions WebKitBrowser/SearchAndDiscoveryApp.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ configuration.add("cookiestorage", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_COOKIESTORA
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("indexeddbtotalsize", "@PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_TOTAL_SIZE@")

if "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@" != "" and "@PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY@" != "":
configuration.add("clientcert", "@PLUGIN_WEBKITBROWSER_CLIENT_CERT@")
Expand Down
17 changes: 11 additions & 6 deletions WebKitBrowser/SearchAndDiscoveryApp.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,20 @@ map()
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_SEARCH_AND_DISCOVERY_APP_COOKIESTORAGE})
endif()

if(PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_ENABLE})
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})
endif()
if(PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_SEARCH_AND_DISCOVERY_APP_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
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})
endif()

if(PLUGIN_WEBKITBROWSER_CLIENT_CERT AND PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY)
kv(clientcert ${PLUGIN_WEBKITBROWSER_CLIENT_CERT})
kv(clientcertkey ${PLUGIN_WEBKITBROWSER_CLIENT_CERT_KEY})
Expand Down
1 change: 1 addition & 0 deletions WebKitBrowser/WebKitBrowser.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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("indexeddbtotalsize", "@PLUGIN_WEBKITBROWSER_INDEXEDDB_TOTAL_SIZE@")

if boolean("@PLUGIN_WEBKITBROWSER_WINDOWCLOSE@"):
configuration.add("windowclose", "@PLUGIN_WEBKITBROWSER_WINDOWCLOSE@")
Expand Down
17 changes: 11 additions & 6 deletions WebKitBrowser/WebKitBrowser.config
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,20 @@ map()
if(PLUGIN_WEBKITBROWSER_COOKIESTORAGE)
kv(cookiestorage ${PLUGIN_WEBKITBROWSER_COOKIESTORAGE})
endif()

if(PLUGIN_WEBKITBROWSER_INDEXEDDB_ENABLE)
kv(indexeddbenabled ${PLUGIN_WEBKITBROWSER_INDEXEDDB_ENABLE})
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH})
endif()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE})
endif()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_TOTAL_SIZE)
kv(indexeddbtotalsize ${PLUGIN_WEBKITBROWSER_INDEXEDDB_TOTAL_SIZE})
endif()
endif()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH)
kv(indexeddbpath ${PLUGIN_WEBKITBROWSER_INDEXEDDB_PATH})
endif()
if(PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE)
kv(indexeddbsize ${PLUGIN_WEBKITBROWSER_INDEXEDDB_SIZE})
endif()

if(PLUGIN_WEBKITBROWSER_WINDOWCLOSE)
kv(windowclose ${PLUGIN_WEBKITBROWSER_WINDOWCLOSE})
endif()
Expand Down
43 changes: 35 additions & 8 deletions WebKitBrowser/WebKitImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ static GSourceFuncs _handlerIntervention =
, IndexedDBEnabled(false)
, IndexedDBPath()
, IndexedDBSize()
, IndexedDBTotalSize()
, Secure(false)
, InjectedBundle()
, Transparent(false)
Expand Down Expand Up @@ -661,6 +662,7 @@ static GSourceFuncs _handlerIntervention =
Add(_T("indexeddbenabled"), &IndexedDBEnabled);
Add(_T("indexeddbpath"), &IndexedDBPath);
Add(_T("indexeddbsize"), &IndexedDBSize);
Add(_T("indexeddbtotalsize"), &IndexedDBTotalSize);
Add(_T("secure"), &Secure);
Add(_T("injectedbundle"), &InjectedBundle);
Add(_T("transparent"), &Transparent);
Expand Down Expand Up @@ -735,7 +737,8 @@ static GSourceFuncs _handlerIntervention =
Core::JSON::DecUInt16 LocalStorageSize;
Core::JSON::Boolean IndexedDBEnabled;
Core::JSON::String IndexedDBPath;
Core::JSON::DecUInt16 IndexedDBSize; // [KB]
Core::JSON::DecUInt16 IndexedDBSize; // [percentage of volume space for each domain]
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved
Core::JSON::DecUInt16 IndexedDBTotalSize; // [percentage of volume space for all domains]
Core::JSON::Boolean Secure;
Core::JSON::String InjectedBundle;
Core::JSON::Boolean Transparent;
Expand Down Expand Up @@ -2885,17 +2888,21 @@ static GSourceFuncs _handlerIntervention =

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;
}

#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 @@ -2909,16 +2916,36 @@ 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.IndexedDBSize.IsSet() && _config.IndexedDBSize.Value() != 0) {
originStorageRatio = static_cast<double>(_config.IndexedDBSize.Value());
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved
}

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

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,
"origin-storage-ratio", originStorageRatio,
"total-storage-ratio", totalStorageRatio,
nullptr);
g_free(indexedDBPath);
#else
auto* websiteDataManager = webkit_website_data_manager_new(
"local-storage-directory", wpeStoragePath,
"disk-cache-directory", wpeDiskCachePath,
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved
"local-storage-quota", localStorageDatabaseQuotaInBytes,
nullptr);
#endif
g_free(wpeStoragePath);
g_free(wpeDiskCachePath);
g_free(indexedDBPath);
VeithMetro marked this conversation as resolved.
Show resolved Hide resolved

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