Skip to content

Commit

Permalink
Disable ApplicationCache with linkedOnOrAfter check
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=224629

Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-16
Reviewed by Brady Eidson.

Source/WebCore:

ApplicationCache has been deprecated for two years in WebKit with a message to developers since r227225.

Firefox removed support in https://bugzilla.mozilla.org/show_bug.cgi?id=1619673 which shipped with Firefox 84 on Dec 15, 2020.

Chrome removed support in https://bugs.chromium.org/p/chromium/issues/detail?id=582750 by default in Chrome 85 on August 25, 2020
but they have a reverse origin trial program running right now so that some origins have it working, but they are planning to remove
even that support October 2021.

We have kept it working for a reason related to rdar://38505756, specifically the 4th and 5th comment in that bug.
That reason is now passed.

This patch removes support for new apps but keeps it working for 3rd party apps linked with existing SDKs.  Once those apps update
to a new SDK, they will be unable to use ApplicationCache.  They will need to migrate to use fetch service workers instead.

* platform/cocoa/VersionChecks.h:

Source/WebKit:

* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultOfflineWebApplicationCacheEnabled):
* Shared/WebPreferencesDefaultValues.h:

Source/WTF:

* Scripts/Preferences/WebPreferences.yaml:

Tools:

* TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):

Canonical link: https://commits.webkit.org/236651@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Christensen authored and webkit-commit-queue committed Apr 16, 2021
1 parent 4ddb743 commit 6012498
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Source/WTF/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2021-04-16 Alex Christensen <achristensen@webkit.org>

Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629

Reviewed by Brady Eidson.

* Scripts/Preferences/WebPreferences.yaml:

2021-04-16 Alex Christensen <achristensen@webkit.org>

Reduce maximum HashTable entry size to 128 bytes
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/Scripts/Preferences/WebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ OfflineWebApplicationCacheEnabled:
WebKitLegacy:
default: false
WebKit:
default: true
default: WebKit::defaultOfflineWebApplicationCacheEnabled()
WebCore:
default: false

Expand Down
23 changes: 23 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2021-04-16 Alex Christensen <achristensen@webkit.org>

Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629

Reviewed by Brady Eidson.

ApplicationCache has been deprecated for two years in WebKit with a message to developers since r227225.

Firefox removed support in https://bugzilla.mozilla.org/show_bug.cgi?id=1619673 which shipped with Firefox 84 on Dec 15, 2020.

Chrome removed support in https://bugs.chromium.org/p/chromium/issues/detail?id=582750 by default in Chrome 85 on August 25, 2020
but they have a reverse origin trial program running right now so that some origins have it working, but they are planning to remove
even that support October 2021.

We have kept it working for a reason related to rdar://38505756, specifically the 4th and 5th comment in that bug.
That reason is now passed.

This patch removes support for new apps but keeps it working for 3rd party apps linked with existing SDKs. Once those apps update
to a new SDK, they will be unable to use ApplicationCache. They will need to migrate to use fetch service workers instead.

* platform/cocoa/VersionChecks.h:

2021-04-16 Commit Queue <commit-queue@webkit.org>

Unreviewed, reverting r273733.
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/platform/cocoa/VersionChecks.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum class SDKVersion : uint32_t {
FirstWithDOMWindowReuseRestriction = DYLD_IOS_VERSION_14_5,
FirstWithSharedNetworkProcess = DYLD_IOS_VERSION_14_5,
FirstWithBlankViewOnJSPrompt = DYLD_IOS_VERSION_14_5,
FirstWithApplicationCacheDisabledByDefault = DYLD_IOS_VERSION_15_0,
#elif PLATFORM(MAC)
FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
Expand All @@ -94,6 +95,7 @@ enum class SDKVersion : uint32_t {
FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_11_3,
FirstWithBlankViewOnJSPrompt = DYLD_MACOSX_VERSION_11_3,
FirstWithApplicationCacheDisabledByDefault = DYLD_MACOSX_VERSION_12_00,
#endif
};

Expand Down
11 changes: 11 additions & 0 deletions Source/WebKit/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2021-04-16 Alex Christensen <achristensen@webkit.org>

Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629

Reviewed by Brady Eidson.

* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultOfflineWebApplicationCacheEnabled):
* Shared/WebPreferencesDefaultValues.h:

2021-04-16 Ada Chan <ada.chan@apple.com>

Add WKUIDelegate SPI for starting XR session
Expand Down
12 changes: 12 additions & 0 deletions Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ bool defaultAsyncOverflowScrollingEnabled()
return defaultAsyncFrameAndOverflowScrollingEnabled();
}

bool defaultOfflineWebApplicationCacheEnabled()
{
#if PLATFORM(COCOA)
static bool newSDK = linkedOnOrAfter(WebCore::SDKVersion::FirstWithApplicationCacheDisabledByDefault);
return !newSDK;
#else
// FIXME: Other platforms should consider turning this off.
// ApplicationCache is on its way to being removed from WebKit.
return true;
#endif
}

#if ENABLE(GPU_PROCESS)

bool defaultUseGPUProcessForCanvasRenderingEnabled()
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/Shared/WebPreferencesDefaultValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ bool allowsDeprecatedSynchronousXMLHttpRequestDuringUnload();

bool defaultAsyncFrameScrollingEnabled();
bool defaultAsyncOverflowScrollingEnabled();
bool defaultOfflineWebApplicationCacheEnabled();

#if ENABLE(GPU_PROCESS)
bool defaultUseGPUProcessForCanvasRenderingEnabled();
Expand Down
14 changes: 14 additions & 0 deletions Tools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2021-04-16 Alex Christensen <achristensen@webkit.org>

Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629

Reviewed by Brady Eidson.

* TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):

2021-04-16 Tyler Wilcock <twilco.o@protonmail.com>

[css-counter-styles] Parse and add feature flag for @counter-style
Expand Down
2 changes: 1 addition & 1 deletion Tools/TestWebKitAPI/Tests/WebKit/WKPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ TEST(WebKit, WKPreferencesDefaults)

EXPECT_TRUE(WKPreferencesGetJavaScriptEnabled(preference));
EXPECT_TRUE(WKPreferencesGetLoadsImagesAutomatically(preference));
EXPECT_TRUE(WKPreferencesGetOfflineWebApplicationCacheEnabled(preference));
EXPECT_FALSE(WKPreferencesGetOfflineWebApplicationCacheEnabled(preference));
EXPECT_TRUE(WKPreferencesGetLocalStorageEnabled(preference));
EXPECT_TRUE(WKPreferencesGetXSSAuditorEnabled(preference));
EXPECT_FALSE(WKPreferencesGetFrameFlatteningEnabled(preference));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#import "TestWKWebView.h"
#import <JavaScriptCore/JSCConfig.h>
#import <WebKit/WKHTTPCookieStorePrivate.h>
#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKPreferencesRef.h>
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKUserContentControllerPrivate.h>
Expand Down Expand Up @@ -658,6 +659,7 @@ TCPServer server([] (int socket) {
[webViewConfiguration setWebsiteDataStore:adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration.get()]).get()];

auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
[webView.get().configuration.preferences _setOfflineApplicationCacheIsEnabled:YES];
[webView synchronouslyLoadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://127.0.0.1:%d/index.html", server.port()]]]];

while (![fileManager fileExistsAtPath:subdirectoryPath])
Expand Down
1 change: 1 addition & 0 deletions Tools/WebKitTestRunner/TestOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const TestFeatures& TestOptions::defaults()
{ "ModernMediaControlsEnabled", true },
{ "NeedsSiteSpecificQuirks", false },
{ "NeedsStorageAccessFromFileURLsQuirk", false },
{ "OfflineWebApplicationCacheEnabled", true },
{ "OffscreenCanvasEnabled", true },
{ "PageVisibilityBasedProcessSuppressionEnabled", false },
{ "PluginsEnabled", true },
Expand Down

0 comments on commit 6012498

Please sign in to comment.