Title: [290304] trunk/Source
Revision
290304
Author
[email protected]
Date
2022-02-22 07:33:34 -0800 (Tue, 22 Feb 2022)

Log Message

Move service worker and push API preference from RuntimeEnabledFeatures to Settings
https://bugs.webkit.org/show_bug.cgi?id=236989

Reviewed by Youenn Fablet.

Move service worker and push API preference from RuntimeEnabledFeatures to Settings, since RuntimeEnabledFeatures is deprecated.

Source/WebCore:

* Modules/push-api/PushEvent.idl:
* Modules/push-api/PushManager.idl:
* Modules/push-api/PushMessageData.idl:
* Modules/push-api/PushSubscription.idl:
* Modules/push-api/PushSubscriptionChangeEvent.idl:
* Modules/push-api/PushSubscriptionOptions.idl:
* Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl:
* Modules/push-api/ServiceWorkerRegistration+PushAPI.idl:
* dom/Document.cpp:
(WebCore::Document::suspend):
(WebCore::Document::resume):
(WebCore::Document::finishedParsing):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::matchRegistration):
(WebCore::DocumentLoader::responseReceived):
(WebCore::DocumentLoader::commitData):
(WebCore::DocumentLoader::unregisterReservedServiceWorkerClient):
(WebCore::DocumentLoader::loadMainResource):
* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::serviceWorker):
* page/NavigatorServiceWorker.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::pushAPIEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setPushAPIEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::serviceWorkerEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setServiceWorkerEnabled): Deleted.
* workers/service/ExtendableEvent.idl:
* workers/service/ExtendableMessageEvent.idl:
* workers/service/FetchEvent.idl:
* workers/service/ServiceWorker.idl:
* workers/service/ServiceWorkerClient.idl:
* workers/service/ServiceWorkerClients.idl:
* workers/service/ServiceWorkerContainer.idl:
* workers/service/ServiceWorkerGlobalScope.idl:
* workers/service/ServiceWorkerRegistration.idl:
* workers/service/ServiceWorkerWindowClient.idl:

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _serviceWorkersEnabled:]):
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateThrottleState):
(WebKit::WebPage::updatePreferences):

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (290303 => 290304)


--- trunk/Source/WTF/ChangeLog	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WTF/ChangeLog	2022-02-22 15:33:34 UTC (rev 290304)
@@ -1,3 +1,15 @@
+2022-02-22  Chris Dumez  <[email protected]>
+
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings
+        https://bugs.webkit.org/show_bug.cgi?id=236989
+
+        Reviewed by Youenn Fablet.
+
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings, since RuntimeEnabledFeatures is deprecated.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+        * Scripts/Preferences/WebPreferencesInternal.yaml:
+
 2022-02-22  Asumu Takikawa  <[email protected]>
 
         Initial support for Wasm/ESM-integration in the WebCore module loader

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (290303 => 290304)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-22 15:33:34 UTC (rev 290304)
@@ -1118,7 +1118,6 @@
   condition: ENABLE(SERVICE_WORKER)
   humanReadableName: "Push API"
   humanReadableDescription: "Enable Push API"
-  webcoreBinding: RuntimeEnabledFeatures
   defaultValue:
     WebCore:
       default: false

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (290303 => 290304)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2022-02-22 15:33:34 UTC (rev 290304)
@@ -804,8 +804,6 @@
   type: bool
   humanReadableName: "Service Workers"
   humanReadableDescription: "Enable Service Workers"
-  webcoreBinding: RuntimeEnabledFeatures
-  webcoreName: serviceWorkerEnabled
   condition: ENABLE(SERVICE_WORKER)
   defaultValue:
     WebKitLegacy:
@@ -813,6 +811,8 @@
     WebKit:
       "ENABLE(EXPERIMENTAL_FEATURES) || PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)": true
       default: false
+    WebCore:
+      default: false
 
 SimpleLineLayoutEnabled:
   type: bool

Modified: trunk/Source/WebCore/ChangeLog (290303 => 290304)


--- trunk/Source/WebCore/ChangeLog	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/ChangeLog	2022-02-22 15:33:34 UTC (rev 290304)
@@ -1,3 +1,49 @@
+2022-02-22  Chris Dumez  <[email protected]>
+
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings
+        https://bugs.webkit.org/show_bug.cgi?id=236989
+
+        Reviewed by Youenn Fablet.
+
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings, since RuntimeEnabledFeatures is deprecated.
+
+        * Modules/push-api/PushEvent.idl:
+        * Modules/push-api/PushManager.idl:
+        * Modules/push-api/PushMessageData.idl:
+        * Modules/push-api/PushSubscription.idl:
+        * Modules/push-api/PushSubscriptionChangeEvent.idl:
+        * Modules/push-api/PushSubscriptionOptions.idl:
+        * Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl:
+        * Modules/push-api/ServiceWorkerRegistration+PushAPI.idl:
+        * dom/Document.cpp:
+        (WebCore::Document::suspend):
+        (WebCore::Document::resume):
+        (WebCore::Document::finishedParsing):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::matchRegistration):
+        (WebCore::DocumentLoader::responseReceived):
+        (WebCore::DocumentLoader::commitData):
+        (WebCore::DocumentLoader::unregisterReservedServiceWorkerClient):
+        (WebCore::DocumentLoader::loadMainResource):
+        * page/NavigatorBase.cpp:
+        (WebCore::NavigatorBase::serviceWorker):
+        * page/NavigatorServiceWorker.idl:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::pushAPIEnabled const): Deleted.
+        (WebCore::RuntimeEnabledFeatures::setPushAPIEnabled): Deleted.
+        (WebCore::RuntimeEnabledFeatures::serviceWorkerEnabled const): Deleted.
+        (WebCore::RuntimeEnabledFeatures::setServiceWorkerEnabled): Deleted.
+        * workers/service/ExtendableEvent.idl:
+        * workers/service/ExtendableMessageEvent.idl:
+        * workers/service/FetchEvent.idl:
+        * workers/service/ServiceWorker.idl:
+        * workers/service/ServiceWorkerClient.idl:
+        * workers/service/ServiceWorkerClients.idl:
+        * workers/service/ServiceWorkerContainer.idl:
+        * workers/service/ServiceWorkerGlobalScope.idl:
+        * workers/service/ServiceWorkerRegistration.idl:
+        * workers/service/ServiceWorkerWindowClient.idl:
+
 2022-02-22  Marcos Caceres  <[email protected]>
 
         Permission API: handle non-fully active documents

Modified: trunk/Source/WebCore/Modules/push-api/PushEvent.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushEvent.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushEvent.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     ExportMacro=WEBCORE_EXPORT,
     Exposed=ServiceWorker,
     JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/Modules/push-api/PushManager.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushManager.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -27,7 +27,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     SecureContext,
     Exposed=(Window,Worker),
 ] interface PushManager {

Modified: trunk/Source/WebCore/Modules/push-api/PushMessageData.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushMessageData.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushMessageData.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     Exposed=ServiceWorker,
 ] interface PushMessageData {
     ArrayBuffer arrayBuffer();

Modified: trunk/Source/WebCore/Modules/push-api/PushSubscription.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushSubscription.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -27,7 +27,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     ExportMacro=WEBCORE_EXPORT,
     SecureContext,
     Exposed=(Window,Worker),

Modified: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     ExportMacro=WEBCORE_EXPORT,
     Exposed=ServiceWorker,
     JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -27,7 +27,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     SecureContext,
     Exposed=(Window,Worker),
 ] interface PushSubscriptionOptions {

Modified: trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled&PushAPIEnabled
+    EnabledBySetting=ServiceWorkersEnabled&PushAPIEnabled
 ] partial interface ServiceWorkerGlobalScope {
     attribute EventHandler onpush;
     attribute EventHandler onpushsubscriptionchange;

Modified: trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl (290303 => 290304)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -27,7 +27,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=PushAPIEnabled,
+    EnabledBySetting=PushAPIEnabled,
     ImplementedBy=ServiceWorkerRegistrationPushAPI
 ] partial interface ServiceWorkerRegistration {
     readonly attribute PushManager pushManager;

Modified: trunk/Source/WebCore/dom/Document.cpp (290303 => 290304)


--- trunk/Source/WebCore/dom/Document.cpp	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-02-22 15:33:34 UTC (rev 290304)
@@ -5648,7 +5648,7 @@
 #endif
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && reason == ReasonForSuspension::BackForwardCache)
+    if (settings().serviceWorkersEnabled() && reason == ReasonForSuspension::BackForwardCache)
         setServiceWorkerConnection(nullptr);
 #endif
 
@@ -5693,7 +5693,7 @@
     m_isSuspended = false;
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && reason == ReasonForSuspension::BackForwardCache)
+    if (settings().serviceWorkersEnabled() && reason == ReasonForSuspension::BackForwardCache)
         setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnection());
 #endif
 }
@@ -6170,7 +6170,7 @@
     m_cachedResourceLoader->clearPreloads(CachedResourceLoader::ClearPreloadsMode::ClearSpeculativePreloads);
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
+    if (settings().serviceWorkersEnabled()) {
         // Stop queuing service worker client messages now that the DOMContentLoaded event has been fired.
         if (RefPtr serviceWorkerContainer = this->serviceWorkerContainer())
             serviceWorkerContainer->startMessages();

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (290303 => 290304)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2022-02-22 15:33:34 UTC (rev 290304)
@@ -562,7 +562,7 @@
 
 void DocumentLoader::matchRegistration(const URL& url, SWClientConnection::RegistrationCallback&& callback)
 {
-    auto shouldTryLoadingThroughServiceWorker = !frameLoader()->isReloadingFromOrigin() && m_frame->page() && RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && url.protocolIsInHTTPFamily();
+    auto shouldTryLoadingThroughServiceWorker = !frameLoader()->isReloadingFromOrigin() && m_frame->page() && m_frame->settings().serviceWorkersEnabled() && url.protocolIsInHTTPFamily();
     if (!shouldTryLoadingThroughServiceWorker) {
         callback(std::nullopt);
         return;
@@ -882,7 +882,7 @@
 #endif
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && response.source() == ResourceResponse::Source::MemoryCache) {
+    if (m_frame && m_frame->settings().serviceWorkersEnabled() && response.source() == ResourceResponse::Source::MemoryCache) {
         matchRegistration(response.url(), [this, protectedThis = Ref { *this }, response, completionHandler = WTFMove(completionHandler)](auto&& registrationData) mutable {
             if (!m_mainDocumentError.isNull() || !m_frame) {
                 completionHandler();
@@ -1235,7 +1235,7 @@
             document.setBaseURLOverride(m_archive->mainResource()->url());
 #endif
 #if ENABLE(SERVICE_WORKER)
-        if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
+        if (m_frame && m_frame->settings().serviceWorkersEnabled()) {
             if (!document.securityOrigin().isUnique()) {
                 if (m_serviceWorkerRegistrationData && m_serviceWorkerRegistrationData->activeWorker) {
                     document.setActiveServiceWorker(ServiceWorker::getOrCreate(document, WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
@@ -2092,7 +2092,7 @@
 void DocumentLoader::unregisterReservedServiceWorkerClient()
 {
 #if ENABLE(SERVICE_WORKER)
-    if (!m_resultingClientId || !RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled())
+    if (!m_resultingClientId)
         return;
 
     auto& serviceWorkerConnection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
@@ -2117,7 +2117,7 @@
         CachingPolicy::AllowCaching);
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
+    if (m_frame && m_frame->settings().serviceWorkersEnabled()) {
         // The main navigation load will trigger the registration of the client.
         if (m_resultingClientId)
             scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);

Modified: trunk/Source/WebCore/page/NavigatorBase.cpp (290303 => 290304)


--- trunk/Source/WebCore/page/NavigatorBase.cpp	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/page/NavigatorBase.cpp	2022-02-22 15:33:34 UTC (rev 290304)
@@ -162,7 +162,7 @@
 #if ENABLE(SERVICE_WORKER)
 ServiceWorkerContainer& NavigatorBase::serviceWorker()
 {
-    ASSERT(RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled());
+    ASSERT(!scriptExecutionContext() || scriptExecutionContext()->settingsValues().serviceWorkersEnabled);
     if (!m_serviceWorkerContainer)
         m_serviceWorkerContainer = ServiceWorkerContainer::create(scriptExecutionContext(), *this).moveToUniquePtr();
     return *m_serviceWorkerContainer;

Modified: trunk/Source/WebCore/page/NavigatorServiceWorker.idl (290303 => 290304)


--- trunk/Source/WebCore/page/NavigatorServiceWorker.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/page/NavigatorServiceWorker.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -26,7 +26,7 @@
 // https://w3c.github.io/ServiceWorker/#navigator-serviceworker
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled
+    EnabledBySetting=ServiceWorkersEnabled
 ] interface mixin NavigatorServiceWorker {
     [CallWith=CurrentScriptExecutionContext, SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
 };

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (290303 => 290304)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2022-02-22 15:33:34 UTC (rev 290304)
@@ -162,13 +162,6 @@
     void setReadableByteStreamAPIEnabled(bool isEnabled) { m_isReadableByteStreamAPIEnabled = isEnabled; }
     bool readableByteStreamAPIEnabled() const { return m_isReadableByteStreamAPIEnabled; }
 
-#if ENABLE(SERVICE_WORKER)
-    bool pushAPIEnabled() const { return m_pushAPIEnabled; }
-    void setPushAPIEnabled(bool isEnabled) { m_pushAPIEnabled = isEnabled; }
-    bool serviceWorkerEnabled() const { return m_serviceWorkerEnabled; }
-    void setServiceWorkerEnabled(bool isEnabled) { m_serviceWorkerEnabled = isEnabled; }
-#endif
-
     void setCSSDisplayContentsAXSupportEnabled(bool isEnabled) { m_CSSDisplayContentsAXSupportEnabled = isEnabled; }
     bool cssDisplayContentsAXSupportEnabled() const { return m_CSSDisplayContentsAXSupportEnabled; }
 
@@ -332,11 +325,6 @@
 
     bool m_isReadableByteStreamAPIEnabled { false };
 
-#if ENABLE(SERVICE_WORKER)
-    bool m_pushAPIEnabled { false };
-    bool m_serviceWorkerEnabled { false };
-#endif
-
     bool m_CSSDisplayContentsAXSupportEnabled { false };
     bool m_CSSLogicalEnabled { false };
 

Modified: trunk/Source/WebCore/workers/service/ExtendableEvent.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ExtendableEvent.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ExtendableEvent.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     Exposed=ServiceWorker,
     ExportMacro=WEBCORE_EXPORT,
     JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     Exposed=ServiceWorker,
     JSGenerateToJSObject,
 ] interface ExtendableMessageEvent : ExtendableEvent {

Modified: trunk/Source/WebCore/workers/service/FetchEvent.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/FetchEvent.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/FetchEvent.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -26,7 +26,7 @@
 [
     Conditional=SERVICE_WORKER,
     JSCustomMarkFunction,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     ExportMacro=WEBCORE_EXPORT,
     Exposed=ServiceWorker,
     JSGenerateToNativeObject

Modified: trunk/Source/WebCore/workers/service/ServiceWorker.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorker.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -31,7 +31,7 @@
     SecureContext,
     Exposed=(Window,ServiceWorker),
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     ExportMacro=WEBCORE_EXPORT
 ] interface ServiceWorker : EventTarget {
     readonly attribute USVString scriptURL;

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -26,7 +26,7 @@
 [
     Conditional=SERVICE_WORKER,
     CustomToJSObject,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     ExportMacro=WEBCORE_EXPORT,
     Exposed=ServiceWorker,
     InterfaceName=Client,

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClients.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClients.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClients.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     Exposed=ServiceWorker,
     GenerateIsReachable=Impl,
     InterfaceName=Clients,

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -31,7 +31,7 @@
     SecureContext,
     Exposed=(Window,ServiceWorker),
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     GenerateIsReachable=ReachableFromNavigator
 ] interface ServiceWorkerContainer : EventTarget {
     readonly attribute ServiceWorker? controller;

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -27,7 +27,7 @@
     Global=(Worker,ServiceWorker),
     Exposed=ServiceWorker,
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     JSCustomMarkFunction,
     IsImmutablePrototypeExoticObject,
     IsImmutablePrototypeExoticObjectOnPrototype,

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -31,7 +31,7 @@
     SecureContext,
     Exposed=(Window,ServiceWorker),
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     GenerateIsReachable=Impl,
 ] interface ServiceWorkerRegistration : EventTarget {
     readonly attribute ServiceWorker? installing;

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerWindowClient.idl (290303 => 290304)


--- trunk/Source/WebCore/workers/service/ServiceWorkerWindowClient.idl	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerWindowClient.idl	2022-02-22 15:33:34 UTC (rev 290304)
@@ -25,7 +25,7 @@
 
 [
     Conditional=SERVICE_WORKER,
-    EnabledAtRuntime=ServiceWorkerEnabled,
+    EnabledBySetting=ServiceWorkersEnabled,
     Exposed=ServiceWorker,
     InterfaceName=WindowClient,
 ] interface ServiceWorkerWindowClient : ServiceWorkerClient {

Modified: trunk/Source/WebKit/ChangeLog (290303 => 290304)


--- trunk/Source/WebKit/ChangeLog	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebKit/ChangeLog	2022-02-22 15:33:34 UTC (rev 290304)
@@ -1,5 +1,22 @@
 2022-02-22  Chris Dumez  <[email protected]>
 
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings
+        https://bugs.webkit.org/show_bug.cgi?id=236989
+
+        Reviewed by Youenn Fablet.
+
+        Move service worker and push API preference from RuntimeEnabledFeatures to Settings, since RuntimeEnabledFeatures is deprecated.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _serviceWorkersEnabled:]):
+        * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+        (WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updateThrottleState):
+        (WebKit::WebPage::updatePreferences):
+
+2022-02-22  Chris Dumez  <[email protected]>
+
         Avoid having to iterate the whole frame tree(s) every time we need to dispatch storage events
         https://bugs.webkit.org/show_bug.cgi?id=236985
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (290303 => 290304)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-02-22 15:33:34 UTC (rev 290304)
@@ -3295,7 +3295,7 @@
 
 - (void)_serviceWorkersEnabled:(void(^)(BOOL))completionHandler
 {
-    auto enabled = [_configuration preferences]->_preferences.get()->serviceWorkersEnabled() || WebCore::RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled();
+    auto enabled = [_configuration preferences]->_preferences.get()->serviceWorkersEnabled();
     completionHandler(enabled);
 }
 

Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (290303 => 290304)


--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	2022-02-22 15:33:34 UTC (rev 290304)
@@ -56,7 +56,6 @@
 
 WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnection()
 {
-    ASSERT(RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled());
     return WebProcess::singleton().ensureNetworkProcessConnection().serviceWorkerConnection();
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (290303 => 290304)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-02-22 15:16:21 UTC (rev 290303)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-02-22 15:33:34 UTC (rev 290304)
@@ -1011,7 +1011,7 @@
         m_userActivity.start();
 
 #if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
+    if (m_page && m_page->settings().serviceWorkersEnabled()) {
         RunLoop::main().dispatch([isThrottleable] {
             WebServiceWorkerProvider::singleton().updateThrottleState(isThrottleable);
         });
@@ -4014,7 +4014,7 @@
     if (store.getBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey())) {
         ASSERT(parentProcessHasServiceWorkerEntitlement() || shouldAllowServiceWorkersForAppBoundViews);
         if (!parentProcessHasServiceWorkerEntitlement() && !shouldAllowServiceWorkersForAppBoundViews)
-            RuntimeEnabledFeatures::sharedFeatures().setServiceWorkerEnabled(false);
+            settings.setServiceWorkersEnabled(false);
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to