Diff
Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-26 01:51:02 UTC (rev 291914)
@@ -1,5 +1,9 @@
2022-03-22 Alan Coon <[email protected]>
+ Revert r289292. rdar://problem/90113314
+
+2022-03-22 Alan Coon <[email protected]>
+
Revert r290708. rdar://problem/90113314
2022-03-25 Alex Christensen <[email protected]>
Modified: branches/safari-613-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (291913 => 291914)
--- branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2022-03-26 01:50:56 UTC (rev 291913)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2022-03-26 01:51:02 UTC (rev 291914)
@@ -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) {