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

Remove ApplicationCache code from WebKit #24669

Conversation

szewai
Copy link
Contributor

@szewai szewai commented Feb 17, 2024

bcbd49c

Remove ApplicationCache code from WebKit
https://bugs.webkit.org/show_bug.cgi?id=269629
rdar://123123740

Reviewed by Alex Christensen.

Also, clean up AppCache data left on disk when WebsiteDataStore resolves directories.

* Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheForMainRequest):
(WebCore::ApplicationCacheGroup::fallbackCacheForMainRequest):
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::didReachMaxAppCacheSize):
(WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::reachedMaxAppCacheSize):
(WebCore::ChromeClient::reachedApplicationCacheOriginQuota):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::Page):
* Source/WebCore/page/Page.h:
(WebCore::Page::applicationCacheStorage):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setApplicationCacheOriginQuota):
* Source/WebKit/Shared/WebProcessDataStoreParameters.h:
* Source/WebKit/Shared/WebProcessDataStoreParameters.serialization.in:
* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::exceededDatabaseQuota):
(API::UIClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationCopyApplicationCacheDirectory): Deleted.
(WKContextConfigurationSetApplicationCacheDirectory): Deleted.
* Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::removeData):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedCacheStorageDirectory const):
(WebKit::WebsiteDataStore::applicationCacheFlatFileSubdirectoryName const): Deleted.
(WebKit::WebsiteDataStore::resolvedApplicationCacheDirectory const): Deleted.
* Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp:
(WebKit::WebProcessProxy::platformGetLaunchOptions):
* Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
(API::InjectedBundle::PageUIClient::didReachApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageClearApplicationCache):
(WKBundlePageClearApplicationCacheForOrigin):
(WKBundlePageSetAppCacheMaximumSize):
(WKBundlePageGetAppCacheUsageForOrigin):
(WKBundlePageCopyOriginsWithApplicationCache):
(WKBundlePageSetApplicationCacheOriginQuota): Deleted.
(WKBundlePageResetApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp:
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* Source/WebKit/WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didFailResourceLoad):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::reachedMaxAppCacheSize): Deleted.
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::m_unifiedTextReplacementController):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
(WebKit::WebProcess::didClose):
* Source/WebKit/WebProcess/WebProcess.h:
(WebKit::WebProcess::applicationCacheStorage): Deleted.
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm:
(TEST):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::disallowIncreaseForApplicationCacheQuota): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::shouldDisallowIncreaseForApplicationCacheQuota): Deleted.

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

05f7af7

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  gtk
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv-sim
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@szewai szewai self-assigned this Feb 17, 2024
@szewai szewai added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Feb 17, 2024
@szewai szewai force-pushed the eng/Remove-ApplicationCache-code-from-WebKit branch from 49ebbd4 to a7431cc Compare February 17, 2024 01:31
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 17, 2024
@szewai szewai removed the merging-blocked Applied to prevent a change from being merged label Feb 19, 2024
@szewai szewai force-pushed the eng/Remove-ApplicationCache-code-from-WebKit branch from a7431cc to 07e5b4f Compare February 19, 2024 19:54
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 19, 2024
@szewai szewai removed the merging-blocked Applied to prevent a change from being merged label Feb 20, 2024
@szewai szewai force-pushed the eng/Remove-ApplicationCache-code-from-WebKit branch from 07e5b4f to fe33951 Compare February 20, 2024 00:27
@szewai szewai marked this pull request as ready for review February 20, 2024 17:50
@szewai szewai requested review from a team, cdumez and JonWBedard as code owners February 20, 2024 17:50
@cdumez
Copy link
Contributor

cdumez commented Feb 20, 2024

API test failure looks real.

@@ -129,7 +129,6 @@ WK_EXPORT void WKBundlePageClearApplicationCache(WKBundlePageRef page);
WK_EXPORT void WKBundlePageClearApplicationCacheForOrigin(WKBundlePageRef page, WKStringRef origin);
WK_EXPORT void WKBundlePageSetAppCacheMaximumSize(WKBundlePageRef page, uint64_t size);
WK_EXPORT uint64_t WKBundlePageGetAppCacheUsageForOrigin(WKBundlePageRef page, WKStringRef origin);
WK_EXPORT void WKBundlePageSetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin, uint64_t bytes);
WK_EXPORT void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not deprecate or remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove the ones that are not in use. Some of them are still in use by WebKitTestRunner, I will modify tests and remove the rest in followup.

@@ -102,7 +102,7 @@ typedef struct WKBundlePageUIClientV1 {
WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;

// Version 1.
WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota;
void* unused3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not change the type or name of this.

@@ -461,6 +458,14 @@ void WebsiteDataStore::resolveDirectoriesIfNecessary()
FileSystem::deleteEmptyDirectory(webSQLDirectory);
});
}

if (auto applicationCacheDirectory = m_configuration->applicationCacheDirectory(); !applicationCacheDirectory.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clear the stale data left on disk

@szewai szewai force-pushed the eng/Remove-ApplicationCache-code-from-WebKit branch from fe33951 to 05f7af7 Compare February 20, 2024 21:35
Copy link
Contributor

@achristensen07 achristensen07 left a comment

Choose a reason for hiding this comment

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

Looks like a good start.

void WKBundlePageResetApplicationCacheOriginQuota(WKBundlePageRef page, WKStringRef origin)
{
WebKit::toImpl(page)->corePage()->applicationCacheStorage().storeUpdatedQuotaForOrigin(WebCore::SecurityOrigin::createFromString(WebKit::toImpl(origin)->string()).ptr(), WebKit::toImpl(page)->corePage()->applicationCacheStorage().defaultOriginQuota());
return 0;
}

WKArrayRef WKBundlePageCopyOriginsWithApplicationCache(WKBundlePageRef page)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should deprecate and eventually remove these too.

@szewai szewai added the merge-queue Applied to send a pull request to merge-queue label Feb 21, 2024
https://bugs.webkit.org/show_bug.cgi?id=269629
rdar://123123740

Reviewed by Alex Christensen.

Also, clean up AppCache data left on disk when WebsiteDataStore resolves directories.

* Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheForMainRequest):
(WebCore::ApplicationCacheGroup::fallbackCacheForMainRequest):
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::didReachMaxAppCacheSize):
(WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota):
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::reachedMaxAppCacheSize):
(WebCore::ChromeClient::reachedApplicationCacheOriginQuota):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::Page):
* Source/WebCore/page/Page.h:
(WebCore::Page::applicationCacheStorage):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setApplicationCacheOriginQuota):
* Source/WebKit/Shared/WebProcessDataStoreParameters.h:
* Source/WebKit/Shared/WebProcessDataStoreParameters.serialization.in:
* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::exceededDatabaseQuota):
(API::UIClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationCopyApplicationCacheDirectory): Deleted.
(WKContextConfigurationSetApplicationCacheDirectory): Deleted.
* Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::removeData):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedCacheStorageDirectory const):
(WebKit::WebsiteDataStore::applicationCacheFlatFileSubdirectoryName const): Deleted.
(WebKit::WebsiteDataStore::resolvedApplicationCacheDirectory const): Deleted.
* Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp:
(WebKit::WebProcessProxy::platformGetLaunchOptions):
* Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
(API::InjectedBundle::PageUIClient::didReachApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageClearApplicationCache):
(WKBundlePageClearApplicationCacheForOrigin):
(WKBundlePageSetAppCacheMaximumSize):
(WKBundlePageGetAppCacheUsageForOrigin):
(WKBundlePageCopyOriginsWithApplicationCache):
(WKBundlePageSetApplicationCacheOriginQuota): Deleted.
(WKBundlePageResetApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp:
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* Source/WebKit/WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didFailResourceLoad):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::reachedMaxAppCacheSize): Deleted.
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::m_unifiedTextReplacementController):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
(WebKit::WebProcess::didClose):
* Source/WebKit/WebProcess/WebProcess.h:
(WebKit::WebProcess::applicationCacheStorage): Deleted.
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm:
(TEST):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::disallowIncreaseForApplicationCacheQuota): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::shouldDisallowIncreaseForApplicationCacheQuota): Deleted.

Canonical link: https://commits.webkit.org/275114@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Remove-ApplicationCache-code-from-WebKit branch from 05f7af7 to bcbd49c Compare February 21, 2024 19:02
@webkit-commit-queue
Copy link
Collaborator

Committed 275114@main (bcbd49c): https://commits.webkit.org/275114@main

Reviewed commits have been landed. Closing PR #24669 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit bcbd49c into WebKit:main Feb 21, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
6 participants