[webkit-changes] [WebKit/WebKit] 4993fe: Many unimplemented storage paths in WebsiteDataSto...

Michael Catanzaro noreply at github.com
Sat Feb 18 08:04:16 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4993fe63cf51c7b4631445966440aa08fbf27e32
      https://github.com/WebKit/WebKit/commit/4993fe63cf51c7b4631445966440aa08fbf27e32
  Author: Michael Catanzaro <mcatanzaro at redhat.com>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M Source/WebKit/SourcesGTK.txt
    M Source/WebKit/SourcesWPE.txt
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
    A Source/WebKit/UIProcess/WebsiteData/glib/WebsiteDataStoreGLib.cpp
    M Source/WebKit/UIProcess/WebsiteData/playstation/WebsiteDataStorePlayStation.cpp
    M Source/WebKit/UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp
    R Source/WebKit/UIProcess/glib/WebsiteDataStoreGLib.cpp

  Log Message:
  -----------
  Many unimplemented storage paths in WebsiteDataStore.cpp
https://bugs.webkit.org/show_bug.cgi?id=251808

Reviewed by Sihui Liu.

Currently we define default storage directories in platform-specific
source files. Originally this probably seemed like a good idea to avoid
cluttering the cross-platform file with platform-specific details.
However, for non-Cocoa ports, there is nowadays no difference in
implementation except for the names selected for the directories, which
are different for no good reason but which we cannot easily change. All
the platform-specific logic has already moved to the functions
WebsiteDataStore::cacheDirectoryFileSystemRepresentation and
WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation. So let's
move all the default directory names to the cross-platform file, except
for Cocoa ports, where the implementations are still slightly different.

The primary goal of this change is to encourage developers to implement
the functions when adding them. Since the implementation is as simple as
choosing whether to use cache or data directory, plus choosing the name
for the directory, there's really no good reason not to. Otherwise, it
could take seven years for us to come in and fill in a directory name,
as happened for defaultMediaCacheDirectory. Developers probably
occasionally look in platform-specific files to look for unimplemented
functions, but not in cross-platform files, so having unimplemented
platform-specific code in cross-platform files is particularly annoying.

For the most part, I selected the Windows port names to be the new
default directory name, since the Windows names match the Cocoa names
(except for the media keys directory) and look nicer. PlayStation and
GLib port names are treated as exceptions. Hopefully this will serve as
a hint to future developers to treat them accordingly and not copy them.
The names of future directory types should match the Windows and Cocoa
names, not the GLib and PlayStation names, since there's no good reason
for them to be different.

This commits makes a few additional changes. First, it defines
HSTSStorageDirectory always. It's OK for it to be unused on certain
ports. Next, it implements defaultMediaCacheDirectory (implementation
missing since 2016!) and defaultAlternativeServicesDirectory (which is
unused, but there's no reason not to define where it would go if it were
not unused). It leaves defaultJavaScriptConfigurationDirectory
unimplemented because this is the only config directory type we have and
it really does not belong under data or cache, and this data type is
also unused except on Cocoa ports. I believe the only behavior change
here should be the addition of the media cache directory.

A GLib-specific bug in the defaultHSTSStorageDirectory is fixed, but
only for the new API versions. The HSTS database goes under the base
cache directory if provided, but if not provided it goes under the base
data directory. Oops. Leave it broken in the original API versions to
avoid leaking the HSTS database on disk. Also, move it to a subdirectory
in the new API version.

Finally, this commit moves WebsiteDataStoreGLib.cpp itself to live with
the other WebsiteData files. It was a bit lost previously.

* Source/WebKit/SourcesGTK.txt:
* Source/WebKit/SourcesWPE.txt:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
(WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
(WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
(WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
(WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultHSTSStorageDirectory):
(WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
(WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
(WebKit::WebsiteDataStore::defaultAlternativeServicesDirectory):
(WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
(WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
(WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
(WebKit::WebsiteDataStore::defaultUnifiedOriginStorageLevel): Deleted.
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::initializePaths):
* Source/WebKit/UIProcess/WebsiteData/glib/WebsiteDataStoreGLib.cpp: Renamed from Source/WebKit/UIProcess/glib/WebsiteDataStoreGLib.cpp.
(WebKit::programName):
(WebKit::WebsiteDataStore::defaultBaseCacheDirectory):
(WebKit::WebsiteDataStore::defaultBaseDataDirectory):
(WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::defaultUnifiedOriginStorageLevel):
* Source/WebKit/UIProcess/WebsiteData/playstation/WebsiteDataStorePlayStation.cpp:
(WebKit::WebsiteDataStore::defaultUnifiedOriginStorageLevel):
(WebKit::WebsiteDataStore::defaultApplicationCacheDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultCacheStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultLocalStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Deleted.
* Source/WebKit/UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
(WebKit::WebsiteDataStore::defaultUnifiedOriginStorageLevel):
(WebKit::WebsiteDataStore::defaultApplicationCacheDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultCacheStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultLocalStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory): Deleted.
(WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Deleted.

Canonical link: https://commits.webkit.org/260511@main




More information about the webkit-changes mailing list