Title: [288161] trunk/Source/WebKit
Revision
288161
Author
[email protected]
Date
2022-01-18 16:25:40 -0800 (Tue, 18 Jan 2022)

Log Message

Unreviewed, reverting r288019.
https://bugs.webkit.org/show_bug.cgi?id=235341

Introduced debug assert

Reverted changeset:

"Inject Launch Services database before NSApplication is
initialized"
https://bugs.webkit.org/show_bug.cgi?id=235186
https://commits.webkit.org/r288019

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (288160 => 288161)


--- trunk/Source/WebKit/ChangeLog	2022-01-19 00:15:29 UTC (rev 288160)
+++ trunk/Source/WebKit/ChangeLog	2022-01-19 00:25:40 UTC (rev 288161)
@@ -1,3 +1,17 @@
+2022-01-18  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r288019.
+        https://bugs.webkit.org/show_bug.cgi?id=235341
+
+        Introduced debug assert
+
+        Reverted changeset:
+
+        "Inject Launch Services database before NSApplication is
+        initialized"
+        https://bugs.webkit.org/show_bug.cgi?id=235186
+        https://commits.webkit.org/r288019
+
 2022-01-18  ChangSeok Oh  <[email protected]>
 
         [GTK] Implement native form validation bubbles for GTK4

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (288160 => 288161)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2022-01-19 00:15:29 UTC (rev 288160)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2022-01-19 00:25:40 UTC (rev 288161)
@@ -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: trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h (288160 => 288161)


--- trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h	2022-01-19 00:15:29 UTC (rev 288160)
+++ trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.h	2022-01-19 00:25:40 UTC (rev 288161)
@@ -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: trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm (288160 => 288161)


--- trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm	2022-01-19 00:15:29 UTC (rev 288160)
+++ trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm	2022-01-19 00:25:40 UTC (rev 288161)
@@ -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: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (288160 => 288161)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2022-01-19 00:15:29 UTC (rev 288160)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2022-01-19 00:25:40 UTC (rev 288161)
@@ -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) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to