Title: [258284] trunk/Source
Revision
258284
Author
pvol...@apple.com
Date
2020-03-11 14:25:24 -0700 (Wed, 11 Mar 2020)

Log Message

[macOS] Crash under WebKit::WebProcessPool::platformInitialize()
https://bugs.webkit.org/show_bug.cgi?id=208945
Source/WebKit:

<rdar://problem/60330751>
        
Reviewed by Brent Fulgham.

Check that accessibility library is present before attempting to use constants from it.

No new tests, since I am unable to reproduce.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):

Source/WTF:


Reviewed by Brent Fulgham.

Add macro to optionally soft link library.

* wtf/cocoa/SoftLinking.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (258283 => 258284)


--- trunk/Source/WTF/ChangeLog	2020-03-11 21:02:10 UTC (rev 258283)
+++ trunk/Source/WTF/ChangeLog	2020-03-11 21:25:24 UTC (rev 258284)
@@ -1,3 +1,14 @@
+2020-03-11  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
+        https://bugs.webkit.org/show_bug.cgi?id=208945
+
+        Reviewed by Brent Fulgham.
+
+        Add macro to optionally soft link library.
+
+        * wtf/cocoa/SoftLinking.h:
+
 2020-03-11  Alex Christensen  <achristen...@webkit.org>
 
         Enable safe browsing warnings in Mac Catalyst WebKit

Modified: trunk/Source/WTF/wtf/cocoa/SoftLinking.h (258283 => 258284)


--- trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2020-03-11 21:02:10 UTC (rev 258283)
+++ trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2020-03-11 21:25:24 UTC (rev 258284)
@@ -42,6 +42,16 @@
         return dylib; \
     }
 
+#define SOFT_LINK_LIBRARY_OPTIONAL(lib) \
+static void* lib##Library() \
+{ \
+    static void* dylib = ^{ \
+        void *result = dlopen("/usr/lib/" #lib ".dylib", RTLD_NOW); \
+        return result; \
+    }(); \
+    return dylib; \
+}
+
 #define SOFT_LINK_FRAMEWORK(framework) \
     static void* framework##Library() \
     { \

Modified: trunk/Source/WebKit/ChangeLog (258283 => 258284)


--- trunk/Source/WebKit/ChangeLog	2020-03-11 21:02:10 UTC (rev 258283)
+++ trunk/Source/WebKit/ChangeLog	2020-03-11 21:25:24 UTC (rev 258284)
@@ -1,3 +1,19 @@
+2020-03-11  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
+        https://bugs.webkit.org/show_bug.cgi?id=208945
+        <rdar://problem/60330751>
+        
+        Reviewed by Brent Fulgham.
+
+        Check that accessibility library is present before attempting to use constants from it.
+
+        No new tests, since I am unable to reproduce.
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::registerNotificationObservers):
+        (WebKit::WebProcessPool::unregisterNotificationObservers):
+
 2020-03-11  Alex Christensen  <achristen...@webkit.org>
 
         Enable safe browsing warnings in Mac Catalyst WebKit

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (258283 => 258284)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-03-11 21:02:10 UTC (rev 258283)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-03-11 21:25:24 UTC (rev 258284)
@@ -118,6 +118,10 @@
 SOFT_LINK(BackBoardServices, BKSDisplayBrightnessGetCurrent, float, (), ());
 #endif
 
+#if PLATFORM(COCOA)
+SOFT_LINK_LIBRARY_OPTIONAL(libAccessibility)
+#endif
+
 #define WEBPROCESSPOOL_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
 
 namespace WebKit {
@@ -662,12 +666,14 @@
 #endif
 #endif // PLATFORM(IOS)
 #endif // !PLATFORM(IOS_FAMILY)
-    m_accessibilityEnabledObserver = [[NSNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) {
-        for (size_t i = 0; i < m_processes.size(); ++i) {
-            m_processes[i]->unblockPreferenceServiceIfNeeded();
-            m_processes[i]->unblockAccessibilityServerIfNeeded();
-        }
-    }];
+    if (libAccessibilityLibrary()) {
+        m_accessibilityEnabledObserver = [[NSNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) {
+            for (size_t i = 0; i < m_processes.size(); ++i) {
+                m_processes[i]->unblockPreferenceServiceIfNeeded();
+                m_processes[i]->unblockAccessibilityServerIfNeeded();
+            }
+        }];
+    }
 }
 
 void WebProcessPool::unregisterNotificationObservers()
@@ -692,7 +698,8 @@
 #endif
 #endif // PLATFORM(IOS)
 #endif // !PLATFORM(IOS_FAMILY)
-    [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
+    if (m_accessibilityEnabledObserver.get())
+        [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
 }
 
 static CFURLStorageSessionRef privateBrowsingSession()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to