Title: [229039] branches/safari-605-branch/Source/WebKit

Diff

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (229038 => 229039)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-02-26 21:02:14 UTC (rev 229038)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-02-26 21:02:18 UTC (rev 229039)
@@ -1,5 +1,27 @@
 2018-02-26  Jason Marcell  <[email protected]>
 
+        Cherry-pick r229037. rdar://problem/37912529
+
+    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  Jason Marcell  <[email protected]>
+
         Cherry-pick r229031. rdar://problem/37912128
 
     2018-02-26  Chris Dumez  <[email protected]>

Modified: branches/safari-605-branch/Source/WebKit/StorageProcess/StorageProcess.cpp (229038 => 229039)


--- branches/safari-605-branch/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-02-26 21:02:14 UTC (rev 229038)
+++ branches/safari-605-branch/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-02-26 21:02:18 UTC (rev 229039)
@@ -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: branches/safari-605-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (229038 => 229039)


--- branches/safari-605-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-02-26 21:02:14 UTC (rev 229038)
+++ branches/safari-605-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-02-26 21:02:18 UTC (rev 229039)
@@ -3163,8 +3163,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