Title: [284582] trunk/Source/WebKit
Revision
284582
Author
[email protected]
Date
2021-10-20 16:07:14 -0700 (Wed, 20 Oct 2021)

Log Message

Launch Services database is not always sent to GPUP
https://bugs.webkit.org/show_bug.cgi?id=232047
<rdar://problem/84480229>

Reviewed by Brent Fulgham.

Currently, the XPC endpoint for receiving the Launch Services database is being sent to GPUP in GPUProcessProxy::addSession.
If GPUP has not finished launching at that point, the endpoint will not be sent on the first page load. This is addressed by
sending the XPC endpoint in GPUProcessProxy::didFinishLaunching, since the XPC connection over which the XPC endpoint is
being sent is available then.

* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::didFinishLaunching):
(WebKit::GPUProcessProxy::addSession):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess const):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (284581 => 284582)


--- trunk/Source/WebKit/ChangeLog	2021-10-20 23:05:19 UTC (rev 284581)
+++ trunk/Source/WebKit/ChangeLog	2021-10-20 23:07:14 UTC (rev 284582)
@@ -1,3 +1,24 @@
+2021-10-20  Per Arne Vollan <[email protected]>
+
+        Launch Services database is not always sent to GPUP
+        https://bugs.webkit.org/show_bug.cgi?id=232047
+        <rdar://problem/84480229>
+
+        Reviewed by Brent Fulgham.
+
+        Currently, the XPC endpoint for receiving the Launch Services database is being sent to GPUP in GPUProcessProxy::addSession.
+        If GPUP has not finished launching at that point, the endpoint will not be sent on the first page load. This is addressed by
+        sending the XPC endpoint in GPUProcessProxy::didFinishLaunching, since the XPC connection over which the XPC endpoint is
+        being sent is available then.
+
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::didFinishLaunching):
+        (WebKit::GPUProcessProxy::addSession):
+        * UIProcess/GPU/GPUProcessProxy.h:
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess const):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+
 2021-10-20  John Pascoe  <[email protected]>
 
         Fix crash when calling setUsernameForLocalCredentialWithID

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (284581 => 284582)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-10-20 23:05:19 UTC (rev 284581)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp	2021-10-20 23:07:14 UTC (rev 284582)
@@ -432,6 +432,14 @@
     if (xpc_connection_t connection = this->connection()->xpcConnection())
         m_throttler.didConnectToProcess(xpc_connection_get_pid(connection));
 #endif
+
+#if PLATFORM(COCOA)
+    auto it = m_sessionIDs.begin();
+    if (it != m_sessionIDs.end()) {
+        auto webSiteDataStore = WebsiteDataStore::existingDataStoreForSessionID(*m_sessionIDs.begin());
+        m_hasSentLaunchServicesDatabase = webSiteDataStore->sendNetworkProcessXPCEndpointToProcess(*this);
+    }
+#endif
 }
 
 void GPUProcessProxy::updateProcessAssertion()
@@ -498,7 +506,8 @@
     m_sessionIDs.add(store.sessionID());
 
 #if PLATFORM(COCOA)
-    store.sendNetworkProcessXPCEndpointToProcess(*this);
+    if (!m_hasSentLaunchServicesDatabase)
+        m_hasSentLaunchServicesDatabase = store.sendNetworkProcessXPCEndpointToProcess(*this);
 #endif
 }
 

Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (284581 => 284582)


--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-10-20 23:05:19 UTC (rev 284581)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h	2021-10-20 23:07:14 UTC (rev 284582)
@@ -146,6 +146,7 @@
     bool m_hasSentTCCDSandboxExtension { false };
     bool m_hasSentCameraSandboxExtension { false };
     bool m_hasSentMicrophoneSandboxExtension { false };
+    bool m_hasSentLaunchServicesDatabase { false };
 #endif
     HashSet<PAL::SessionID> m_sessionIDs;
 };

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (284581 => 284582)


--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-10-20 23:05:19 UTC (rev 284581)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-10-20 23:07:14 UTC (rev 284582)
@@ -598,17 +598,18 @@
     return WTF::hasEntitlement(networkProcess().connection()->xpcConnection(), entitlement.utf8().data());
 }
 
-void WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy& process) const
+bool WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy& process) const
 {
     if (process.state() != AuxiliaryProcessProxy::State::Running)
-        return;
+        return false;
     auto* connection = process.connection();
     if (!connection)
-        return;
+        return false;
     auto message = networkProcess().xpcEndpointMessage();
     if (!message)
-        return;
+        return false;
     xpc_connection_send_message(connection->xpcConnection(), message);
+    return true;
 }
 
 void WebsiteDataStore::sendNetworkProcessXPCEndpointToAllProcesses()

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (284581 => 284582)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2021-10-20 23:05:19 UTC (rev 284581)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2021-10-20 23:07:14 UTC (rev 284582)
@@ -280,7 +280,7 @@
     void dispatchOnQueue(Function<void()>&&);
 
 #if PLATFORM(COCOA)
-    void sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy&) const;
+    bool sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy&) const;
     void sendNetworkProcessXPCEndpointToAllProcesses();
     
     static bool useNetworkLoader();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to