Title: [262603] trunk/Source/WebKit
Revision
262603
Author
you...@apple.com
Date
2020-06-05 00:14:15 -0700 (Fri, 05 Jun 2020)

Log Message

Generate code to set the runtime settings for a service worker process
https://bugs.webkit.org/show_bug.cgi?id=212467

Reviewed by Alex Christensen.

Split the code generated to handle web preference changes to have one method for process wide flags and one for page settings.
Make the process wide flag method static and reuse it in WebSWContextManagerConnection.
Covered by existing tests.

* Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::updatePreferencesStore):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (262602 => 262603)


--- trunk/Source/WebKit/ChangeLog	2020-06-05 06:19:01 UTC (rev 262602)
+++ trunk/Source/WebKit/ChangeLog	2020-06-05 07:14:15 UTC (rev 262603)
@@ -1,3 +1,21 @@
+2020-06-05  Youenn Fablet  <you...@apple.com>
+
+        Generate code to set the runtime settings for a service worker process
+        https://bugs.webkit.org/show_bug.cgi?id=212467
+
+        Reviewed by Alex Christensen.
+
+        Split the code generated to handle web preference changes to have one method for process wide flags and one for page settings.
+        Make the process wide flag method static and reuse it in WebSWContextManagerConnection.
+        Covered by existing tests.
+
+        * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        * WebProcess/WebPage/WebPage.h:
+
 2020-06-04  David Kilzer  <ddkil...@apple.com>
 
         [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy

Modified: trunk/Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb (262602 => 262603)


--- trunk/Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb	2020-06-05 06:19:01 UTC (rev 262602)
+++ trunk/Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb	2020-06-05 07:14:15 UTC (rev 262603)
@@ -37,7 +37,7 @@
 
 namespace WebKit {
 
-void WebPage::updatePreferencesGenerated(const WebPreferencesStore& store)
+void WebPage::updateSettingsGenerated(const WebPreferencesStore& store)
 {
     WebCore::Settings& settings = m_page->settings();
 
@@ -50,7 +50,10 @@
 #endif
 <%- end -%>
 <%- end -%>
+}
 
+void WebPage::updatePreferencesGenerated(const WebPreferencesStore& store)
+{
 <%- for @pref in @preferencesBoundToDeprecatedGlobalSettings do -%>
 <%- if @pref.condition -%>
 #if <%= @pref.condition %>

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (262602 => 262603)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2020-06-05 06:19:01 UTC (rev 262602)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2020-06-05 07:14:15 UTC (rev 262603)
@@ -41,6 +41,7 @@
 #include "WebDatabaseProvider.h"
 #include "WebDocumentLoader.h"
 #include "WebFrameLoaderClient.h"
+#include "WebPage.h"
 #include "WebPreferencesKeys.h"
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
@@ -119,19 +120,7 @@
 
 void WebSWContextManagerConnection::updatePreferencesStore(const WebPreferencesStore& store)
 {
-    // FIXME: We should generate that code as done for web pages in WebPage::updatePreferencesGenerated.
-    RuntimeEnabledFeatures::sharedFeatures().setServiceWorkerEnabled(true);
-    RuntimeEnabledFeatures::sharedFeatures().setCacheAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::cacheAPIEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setUserTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::userTimingEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setPaintTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::paintTimingEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::resourceTimingEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIKeepAliveEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setRestrictedHTTPResponseAccess(store.getBoolValueForKey(WebPreferencesKey::restrictedHTTPResponseAccessKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setServerTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::serverTimingEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(store.getBoolValueForKey(WebPreferencesKey::isSecureContextAttributeEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setSecureContextChecksEnabled(store.getBoolValueForKey(WebPreferencesKey::secureContextChecksEnabledKey()));
-    RuntimeEnabledFeatures::sharedFeatures().setReadableByteStreamAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::readableByteStreamAPIEnabledKey()));
+    WebPage::updatePreferencesGenerated(store);
 
     m_storageBlockingPolicy = static_cast<SecurityOrigin::StorageBlockingPolicy>(store.getUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey()));
     setShouldUseShortTimeout(store.getBoolValueForKey(WebPreferencesKey::shouldUseServiceWorkerShortTimeoutKey()));

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (262602 => 262603)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-06-05 06:19:01 UTC (rev 262602)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-06-05 07:14:15 UTC (rev 262603)
@@ -3632,6 +3632,7 @@
 void WebPage::updatePreferences(const WebPreferencesStore& store)
 {
     updatePreferencesGenerated(store);
+    updateSettingsGenerated(store);
 
     Settings& settings = m_page->settings();
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (262602 => 262603)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-06-05 06:19:01 UTC (rev 262602)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-06-05 07:14:15 UTC (rev 262603)
@@ -1339,6 +1339,8 @@
     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
 #endif
 
+    static void updatePreferencesGenerated(const WebPreferencesStore&);
+
 private:
     WebPage(WebCore::PageIdentifier, WebPageCreationParameters&&);
 
@@ -1531,7 +1533,7 @@
 
     void preferencesDidChange(const WebPreferencesStore&);
     void updatePreferences(const WebPreferencesStore&);
-    void updatePreferencesGenerated(const WebPreferencesStore&);
+    void updateSettingsGenerated(const WebPreferencesStore&);
 
 #if PLATFORM(IOS_FAMILY)
     bool parentProcessHasServiceWorkerEntitlement() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to