Diff
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/ChangeLog (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/ChangeLog 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/ChangeLog 2022-03-30 18:44:17 UTC (rev 292112)
@@ -3845,69 +3845,6 @@
2022-02-07 Russell Epstein <[email protected]>
- Cherry-pick r288387. rdar://problem/87468788
-
- Inject Launch Services database before NSApplication is initialized
- https://bugs.webkit.org/show_bug.cgi?id=235186
- <rdar://87468788>
-
- Reviewed by Chris Dumez.
-
- To avoid the main thread getting stuck, the Launch Services database should be injected before NSApplication
- is initialized, since the initialization now depends on the database. To make sure also prewarmed WebContent
- processes are receiving the Launch Services database, the WebsiteDataStore method
- sendNetworkProcessXPCEndpointToProcess is moved to the class NetworkProcessProxy, since prewarmed processes
- will not have a data store initially. This allows us to simplify the code, since we are no longer depending
- on having a Website data store before sending the XPC endpoint.
-
- * UIProcess/WebProcessProxy.cpp:
- (WebKit::WebProcessProxy::didFinishLaunching):
- * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
- (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess):
- (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess const): Deleted.
- * UIProcess/WebsiteData/WebsiteDataStore.h:
- * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
- (WebKit::WebPage::platformDidReceiveLoadParameters):
- * WebProcess/cocoa/LaunchServicesDatabaseManager.h:
- * WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
- (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate):
- * WebProcess/cocoa/WebProcessCocoa.mm:
- (WebKit::WebProcess::platformInitializeWebProcess):
-
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2022-01-21 Per Arne Vollan <[email protected]>
-
- Inject Launch Services database before NSApplication is initialized
- https://bugs.webkit.org/show_bug.cgi?id=235186
- <rdar://87468788>
-
- Reviewed by Chris Dumez.
-
- To avoid the main thread getting stuck, the Launch Services database should be injected before NSApplication
- is initialized, since the initialization now depends on the database. To make sure also prewarmed WebContent
- processes are receiving the Launch Services database, the WebsiteDataStore method
- sendNetworkProcessXPCEndpointToProcess is moved to the class NetworkProcessProxy, since prewarmed processes
- will not have a data store initially. This allows us to simplify the code, since we are no longer depending
- on having a Website data store before sending the XPC endpoint.
-
- * UIProcess/WebProcessProxy.cpp:
- (WebKit::WebProcessProxy::didFinishLaunching):
- * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
- (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess):
- (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess const): Deleted.
- * UIProcess/WebsiteData/WebsiteDataStore.h:
- * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
- (WebKit::WebPage::platformDidReceiveLoadParameters):
- * WebProcess/cocoa/LaunchServicesDatabaseManager.h:
- * WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
- (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate):
- * WebProcess/cocoa/WebProcessCocoa.mm:
- (WebKit::WebProcess::platformInitializeWebProcess):
-
-2022-02-07 Russell Epstein <[email protected]>
-
Cherry-pick r288296. rdar://problem/88593227
Disable fallback path to WebRTC platform sockets
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-30 18:44:17 UTC (rev 292112)
@@ -441,8 +441,15 @@
#endif
#if PLATFORM(COCOA)
- if (auto networkProcess = NetworkProcessProxy::defaultNetworkProcess())
- networkProcess->sendXPCEndpointToProcess(*this);
+ // Use any session ID to get any Website data store. It is OK to use any Website data store,
+ // since we are using it to access any Networking process, which all have the XPC endpoint.
+ // The XPC endpoint is used to receive the Launch Services database from the Network process.
+ if (m_sessionIDs.isEmpty())
+ return;
+ auto store = WebsiteDataStore::existingDataStoreForSessionID(*m_sessionIDs.begin());
+ if (!store)
+ return;
+ m_hasSentNetworkProcessXPCEndpoint = store->sendNetworkProcessXPCEndpointToProcess(*this);
#endif
beginResponsivenessChecks();
@@ -510,6 +517,11 @@
send(Messages::GPUProcess::AddSession { store.sessionID(), gpuProcessSessionParameters(store) }, 0);
m_sessionIDs.add(store.sessionID());
+
+#if PLATFORM(COCOA)
+ if (!m_hasSentNetworkProcessXPCEndpoint)
+ m_hasSentNetworkProcessXPCEndpoint = store.sendNetworkProcessXPCEndpointToProcess(*this);
+#endif
}
void GPUProcessProxy::removeSession(PAL::SessionID sessionID)
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-30 18:44:17 UTC (rev 292112)
@@ -151,6 +151,7 @@
bool m_hasSentTCCDSandboxExtension { false };
bool m_hasSentCameraSandboxExtension { false };
bool m_hasSentMicrophoneSandboxExtension { false };
+ bool m_hasSentNetworkProcessXPCEndpoint { false };
#endif
#if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2022-03-30 18:44:17 UTC (rev 292112)
@@ -271,7 +271,6 @@
API::CustomProtocolManagerClient& customProtocolManagerClient() { return m_customProtocolManagerClient.get(); }
#if PLATFORM(COCOA)
- bool sendXPCEndpointToProcess(AuxiliaryProcessProxy&);
xpc_object_t xpcEndpointMessage() const { return m_endpointMessage.get(); }
#endif
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm 2022-03-30 18:44:17 UTC (rev 292112)
@@ -53,14 +53,8 @@
if (messageName == LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseXPCEndpointMessageName) {
m_networkProcess->m_endpointMessage = event;
- for (auto& processPool : WebProcessPool::allProcessPools()) {
- for (auto& process : processPool->processes())
- m_networkProcess->sendXPCEndpointToProcess(process);
- }
-#if ENABLE(GPU_PROCESS)
- if (auto gpuProcess = GPUProcessProxy::singletonIfCreated())
- m_networkProcess->sendXPCEndpointToProcess(*gpuProcess);
-#endif
+ for (auto& dataStore : copyToVectorOf<Ref<WebsiteDataStore>>(m_networkProcess->m_websiteDataStores))
+ dataStore->sendNetworkProcessXPCEndpointToAllProcesses();
}
return true;
@@ -71,18 +65,4 @@
{
}
-bool NetworkProcessProxy::sendXPCEndpointToProcess(AuxiliaryProcessProxy& process)
-{
- if (process.state() != AuxiliaryProcessProxy::State::Running)
- return false;
- auto* connection = process.connection();
- if (!connection)
- return false;
- auto message = xpcEndpointMessage();
- if (!message)
- return false;
- xpc_connection_send_message(connection->xpcConnection(), message);
- return true;
}
-
-}
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2022-03-30 18:44:17 UTC (rev 292112)
@@ -349,6 +349,13 @@
ASSERT(!m_websiteDataStore);
WEBPROCESSPROXY_RELEASE_LOG(Process, "setWebsiteDataStore() dataStore=%p, sessionID=%" PRIu64, &dataStore, dataStore.sessionID().toUInt64());
m_websiteDataStore = &dataStore;
+#if PLATFORM(COCOA)
+ dataStore.sendNetworkProcessXPCEndpointToProcess(*this);
+#if ENABLE(GPU_PROCESS)
+ if (GPUProcessProxy::singletonIfCreated())
+ dataStore.sendNetworkProcessXPCEndpointToProcess(*GPUProcessProxy::singletonIfCreated());
+#endif
+#endif
updateRegistrationWithDataStore();
send(Messages::WebProcess::SetWebsiteDataStoreParameters(processPool().webProcessDataStoreParameters(*this, dataStore)), 0);
@@ -1048,8 +1055,8 @@
}
#if PLATFORM(COCOA)
- if (auto networkProcess = NetworkProcessProxy::defaultNetworkProcess())
- networkProcess->sendXPCEndpointToProcess(*this);
+ if (m_websiteDataStore)
+ m_websiteDataStore->sendNetworkProcessXPCEndpointToProcess(*this);
#endif
RELEASE_ASSERT(!m_webConnection);
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2022-03-30 18:44:17 UTC (rev 292112)
@@ -616,4 +616,28 @@
return WTF::hasEntitlement(networkProcess().connection()->xpcConnection(), entitlement.utf8().data());
}
+bool WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy& process) const
+{
+ if (process.state() != AuxiliaryProcessProxy::State::Running)
+ return false;
+ auto* connection = process.connection();
+ if (!connection)
+ return false;
+ auto message = networkProcess().xpcEndpointMessage();
+ if (!message)
+ return false;
+ xpc_connection_send_message(connection->xpcConnection(), message);
+ return true;
}
+
+void WebsiteDataStore::sendNetworkProcessXPCEndpointToAllProcesses()
+{
+ for (auto& process : m_processes)
+ sendNetworkProcessXPCEndpointToProcess(process);
+#if ENABLE(GPU_PROCESS)
+ if (GPUProcessProxy::singletonIfCreated())
+ sendNetworkProcessXPCEndpointToProcess(*GPUProcessProxy::singletonIfCreated());
+#endif
+}
+
+}
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2022-03-30 18:44:17 UTC (rev 292112)
@@ -278,6 +278,9 @@
void dispatchOnQueue(Function<void()>&&);
#if PLATFORM(COCOA)
+ bool sendNetworkProcessXPCEndpointToProcess(AuxiliaryProcessProxy&) const;
+ void sendNetworkProcessXPCEndpointToAllProcesses();
+
static bool useNetworkLoader();
#endif
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-03-30 18:44:17 UTC (rev 292112)
@@ -27,6 +27,7 @@
#import "WebPage.h"
#import "InsertTextOptions.h"
+#import "LaunchServicesDatabaseManager.h"
#import "LoadParameters.h"
#import "PluginView.h"
#import "UserMediaCaptureManager.h"
@@ -76,6 +77,21 @@
void WebPage::platformDidReceiveLoadParameters(const LoadParameters& parameters)
{
+#if HAVE(LSDATABASECONTEXT)
+ static bool hasWaitedForLaunchServicesDatabase = false;
+ if (!hasWaitedForLaunchServicesDatabase) {
+ auto startTime = WallTime::now();
+ bool databaseUpdated = LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate(5_s);
+ auto elapsedTime = WallTime::now() - startTime;
+ if (elapsedTime.value() > 0.5)
+ RELEASE_LOG(Loading, "Waiting for Launch Services database update took %f seconds", elapsedTime.value());
+ ASSERT_UNUSED(databaseUpdated, databaseUpdated);
+ if (!databaseUpdated)
+ RELEASE_LOG_ERROR(Loading, "Timed out waiting for Launch Services database update.");
+ hasWaitedForLaunchServicesDatabase = true;
+ }
+#endif
+
m_dataDetectionContext = parameters.dataDetectionContext;
consumeNetworkExtensionSandboxExtensions(parameters.networkExtensionSandboxExtensionHandles);
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h 2022-03-30 18:44:17 UTC (rev 292112)
@@ -35,14 +35,12 @@
public:
static LaunchServicesDatabaseManager& singleton();
- void waitForDatabaseUpdate();
+ bool waitForDatabaseUpdate(Seconds);
private:
void handleEvent(xpc_object_t) override;
void didConnect() override;
- bool waitForDatabaseUpdate(Seconds);
-
std::atomic<bool> m_hasReceivedLaunchServicesDatabase { false };
BinarySemaphore m_semaphore;
};
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm 2022-03-30 18:44:17 UTC (rev 292112)
@@ -27,7 +27,6 @@
#import "LaunchServicesDatabaseManager.h"
#import "LaunchServicesDatabaseXPCConstants.h"
-#import "Logging.h"
#import "XPCEndpoint.h"
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <wtf/cocoa/Entitlements.h>
@@ -82,16 +81,4 @@
return m_semaphore.waitFor(timeout);
}
-void LaunchServicesDatabaseManager::waitForDatabaseUpdate()
-{
- auto startTime = MonotonicTime::now();
- bool databaseUpdated = waitForDatabaseUpdate(5_s);
- auto elapsedTime = MonotonicTime::now() - startTime;
- if (elapsedTime > 0.5_s)
- RELEASE_LOG_ERROR(Loading, "Waiting for Launch Services database update took %f seconds", elapsedTime.value());
- ASSERT_UNUSED(databaseUpdated, databaseUpdated);
- if (!databaseUpdated)
- RELEASE_LOG_ERROR(Loading, "Timed out waiting for Launch Services database update.");
}
-
-}
Modified: branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (292111 => 292112)
--- branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2022-03-30 18:44:11 UTC (rev 292111)
+++ branches/safari-613.2.4.0-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2022-03-30 18:44:17 UTC (rev 292112)
@@ -28,7 +28,6 @@
#import "AccessibilitySupportSPI.h"
#import "GPUProcessConnectionParameters.h"
-#import "LaunchServicesDatabaseManager.h"
#import "LegacyCustomProtocolManager.h"
#import "LogInitialization.h"
#import "Logging.h"
@@ -327,12 +326,6 @@
method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
#endif
-#if HAVE(LSDATABASECONTEXT)
- // On Mac, this needs to be called before NSApplication is being initialized.
- // The NSApplication initialization is being done in [NSApplication _accessibilityInitialize]
- LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate();
-#endif
-
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_NSRUNLOOP)
RefPtr<SandboxExtension> launchServicesExtension;
if (parameters.launchServicesExtensionHandle) {