Title: [229037] trunk/Source/WebKit
Revision
229037
Author
[email protected]
Date
2018-02-26 12:44:50 -0800 (Mon, 26 Feb 2018)

Log Message

Release assertion in WebPage::updatePreferences
https://bugs.webkit.org/show_bug.cgi?id=183075

Reviewed by Youenn Fablet and Chris Dumez.

Replaced the release assertion added in r228589 with a more graceful disabling of the feature when the entitlement is missing.

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::didReceiveMessage): Added an early exit with an entitlement check to disable the feature.
(WebKit::StorageProcess::initializeWebsiteDataStore): Ditto.
(WebKit::StorageProcess::createStorageToWebProcessConnection): Replaced the release assertion with a debug assertion.
(WebKit::StorageProcess::swServerForSession): Removed the assertion. This code can be reached when the service worker is disabled.
(WebKit::StorageProcess::registerSWServerConnection): Replaced the release assertion with a debug assertion.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Disable the feature instead of crashing when the entitlement is missing.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (229036 => 229037)


--- trunk/Source/WebKit/ChangeLog	2018-02-26 20:42:39 UTC (rev 229036)
+++ trunk/Source/WebKit/ChangeLog	2018-02-26 20:44:50 UTC (rev 229037)
@@ -1,3 +1,21 @@
+2018-02-26  Ryosuke Niwa  <[email protected]>
+
+        Release assertion in WebPage::updatePreferences
+        https://bugs.webkit.org/show_bug.cgi?id=183075
+
+        Reviewed by Youenn Fablet and Chris Dumez.
+
+        Replaced the release assertion added in r228589 with a more graceful disabling of the feature when the entitlement is missing.
+
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::didReceiveMessage): Added an early exit with an entitlement check to disable the feature.
+        (WebKit::StorageProcess::initializeWebsiteDataStore): Ditto.
+        (WebKit::StorageProcess::createStorageToWebProcessConnection): Replaced the release assertion with a debug assertion.
+        (WebKit::StorageProcess::swServerForSession): Removed the assertion. This code can be reached when the service worker is disabled.
+        (WebKit::StorageProcess::registerSWServerConnection): Replaced the release assertion with a debug assertion.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences): Disable the feature instead of crashing when the entitlement is missing.
+
 2018-02-26  Chris Dumez  <[email protected]>
 
         Regression(r223431): Crash under didReceiveChallenge in NetworkSessionCocoa

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (229036 => 229037)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-02-26 20:42:39 UTC (rev 229036)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-02-26 20:44:50 UTC (rev 229037)
@@ -146,10 +146,13 @@
 
 #if ENABLE(SERVICE_WORKER)
     if (decoder.messageReceiverName() == Messages::WebSWServerToContextConnection::messageReceiverName()) {
+        ASSERT(parentProcessHasServiceWorkerEntitlement());
+        if (!parentProcessHasServiceWorkerEntitlement())
+            return;
         if (auto* swConnection = SWServerToContextConnection::globalServerToContextConnection()) {
             auto* webSWConnection = static_cast<WebSWServerToContextConnection*>(swConnection);
             webSWConnection->didReceiveMessage(connection, decoder);
-            return;        
+            return;
         }
     }
 #endif
@@ -190,6 +193,9 @@
     }
 #endif
 #if ENABLE(SERVICE_WORKER)
+    if (!parentProcessHasServiceWorkerEntitlement())
+        return;
+
     addResult = m_swDatabasePaths.ensure(parameters.sessionID, [path = parameters.serviceWorkerRegistrationDirectory] {
         return path;
     });
@@ -260,7 +266,7 @@
 
 #if ENABLE(SERVICE_WORKER)
     if (isServiceWorkerProcess && !m_storageToWebProcessConnections.isEmpty()) {
-        RELEASE_ASSERT(parentProcessHasServiceWorkerEntitlement());
+        ASSERT(parentProcessHasServiceWorkerEntitlement());
         ASSERT(m_waitingForServerToContextProcessConnection);
         m_serverToContextConnection = WebSWServerToContextConnection::create(m_storageToWebProcessConnections.last()->connection());
         m_waitingForServerToContextProcessConnection = false;
@@ -411,7 +417,6 @@
 #if ENABLE(SERVICE_WORKER)
 SWServer& StorageProcess::swServerForSession(PAL::SessionID sessionID)
 {
-    RELEASE_ASSERT(parentProcessHasServiceWorkerEntitlement());
     ASSERT(sessionID.isValid());
     auto result = m_swServers.add(sessionID, nullptr);
     if (!result.isNewEntry) {
@@ -500,7 +505,7 @@
 
 void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)
 {
-    RELEASE_ASSERT(parentProcessHasServiceWorkerEntitlement());
+    ASSERT(parentProcessHasServiceWorkerEntitlement());
     ASSERT(!m_swServerConnections.contains(connection.identifier()));
     m_swServerConnections.add(connection.identifier(), &connection);
     swOriginStoreForSession(connection.sessionID()).registerSWServerConnection(connection);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (229036 => 229037)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-02-26 20:42:39 UTC (rev 229036)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-02-26 20:44:50 UTC (rev 229037)
@@ -3180,8 +3180,13 @@
 #endif
 #endif
 
-    if (store.getBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey()))
-        RELEASE_ASSERT(parentProcessHasServiceWorkerEntitlement());
+#if ENABLE(SERVICE_WORKER)
+    if (store.getBoolValueForKey(WebPreferencesKey::serviceWorkersEnabledKey())) {
+        ASSERT(parentProcessHasServiceWorkerEntitlement());
+        if (!parentProcessHasServiceWorkerEntitlement())
+            RuntimeEnabledFeatures::sharedFeatures().setServiceWorkerEnabled(false);
+    }
+#endif
 
     if (m_drawingArea)
         m_drawingArea->updatePreferences(store);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to