Title: [230971] trunk/Source
Revision
230971
Author
[email protected]
Date
2018-04-24 14:27:01 -0700 (Tue, 24 Apr 2018)

Log Message

AX: soft link libAccessibility.dylb
https://bugs.webkit.org/show_bug.cgi?id=184919

Reviewed by Chris Fleizach.

Source/WebKit:

Make sure we soft link the library so that it won't crash
if it's missing in the system.

* Configurations/WebKit.xcconfig:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _updateAccessibilityEventsEnabled]):

Source/WTF:

* wtf/cocoa/SoftLinking.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (230970 => 230971)


--- trunk/Source/WTF/ChangeLog	2018-04-24 20:22:51 UTC (rev 230970)
+++ trunk/Source/WTF/ChangeLog	2018-04-24 21:27:01 UTC (rev 230971)
@@ -1,3 +1,12 @@
+2018-04-24  Nan Wang  <[email protected]>
+
+        AX: soft link libAccessibility.dylb
+        https://bugs.webkit.org/show_bug.cgi?id=184919
+
+        Reviewed by Chris Fleizach.
+
+        * wtf/cocoa/SoftLinking.h:
+
 2018-04-23  Zalan Bujtas  <[email protected]>
 
         [LayoutFormattingContext] Initial commit.

Modified: trunk/Source/WTF/wtf/cocoa/SoftLinking.h (230970 => 230971)


--- trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2018-04-24 20:22:51 UTC (rev 230970)
+++ trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2018-04-24 21:27:01 UTC (rev 230971)
@@ -41,6 +41,13 @@
         return dylib; \
     }
 
+#define SOFT_LINK_LIBRARY_OPTIONAL(lib) \
+    static void* lib##Library() \
+    { \
+        static void* dylib = dlopen("/usr/lib/" #lib ".dylib", RTLD_NOW); \
+        return dylib; \
+    }
+
 #define SOFT_LINK_FRAMEWORK(framework) \
     static void* framework##Library() \
     { \

Modified: trunk/Source/WebKit/ChangeLog (230970 => 230971)


--- trunk/Source/WebKit/ChangeLog	2018-04-24 20:22:51 UTC (rev 230970)
+++ trunk/Source/WebKit/ChangeLog	2018-04-24 21:27:01 UTC (rev 230971)
@@ -1,3 +1,18 @@
+2018-04-24  Nan Wang  <[email protected]>
+
+        AX: soft link libAccessibility.dylb
+        https://bugs.webkit.org/show_bug.cgi?id=184919
+
+        Reviewed by Chris Fleizach.
+
+        Make sure we soft link the library so that it won't crash
+        if it's missing in the system.
+
+        * Configurations/WebKit.xcconfig:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        (-[WKWebView _updateAccessibilityEventsEnabled]):
+
 2018-04-24  John Wilander  <[email protected]>
 
         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check

Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (230970 => 230971)


--- trunk/Source/WebKit/Configurations/WebKit.xcconfig	2018-04-24 20:22:51 UTC (rev 230970)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig	2018-04-24 21:27:01 UTC (rev 230971)
@@ -39,14 +39,6 @@
 
 LIBRARY_SEARCH_PATHS = $(inherited) "$(LIBWEBRTC_LIBRARY_DIR)";
 
-WK_ACCESSIBILITY_LDFLAGS = $(WK_ACCESSIBILITY_LDFLAGS_$(WK_PLATFORM_NAME));
-WK_ACCESSIBILITY_LDFLAGS_iphoneos = -lAccessibility;
-WK_ACCESSIBILITY_LDFLAGS_iphonesimulator = $(WK_ACCESSIBILITY_LDFLAGS_iphoneos);
-WK_ACCESSIBILITY_LDFLAGS_watchos = $(WK_ACCESSIBILITY_LDFLAGS_iphoneos);
-WK_ACCESSIBILITY_LDFLAGS_appletvos = $(WK_ACCESSIBILITY_LDFLAGS_iphoneos);
-WK_ACCESSIBILITY_LDFLAGS_macosx = $(WK_ACCESSIBILITY_LDFLAGS$(WK_MACOS_1014));
-WK_ACCESSIBILITY_LDFLAGS_MACOS_SINCE_1014 = -lAccessibility;
-
 WK_APPKIT_LDFLAGS = $(WK_APPKIT_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_APPKIT_LDFLAGS_macosx = -framework AppKit;
 
@@ -112,7 +104,7 @@
 WK_UIKIT_LDFLAGS = $(WK_UIKIT_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_UIKIT_LDFLAGS_cocoatouch = -framework UIKit;
 
-FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_UIKIT_LDFLAGS);
+FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_UIKIT_LDFLAGS);
 
 // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols.
 UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol, -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12Policy
 ActionEEED1Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol, -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol, -Wl,__ZTVNSt3__117bad_function_callE;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (230970 => 230971)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-24 20:22:51 UTC (rev 230970)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-04-24 21:27:01 UTC (rev 230971)
@@ -207,15 +207,11 @@
 #endif // PLATFORM(MAC)
 
 #if ENABLE(ACCESSIBILITY_EVENTS)
-#if __has_include(<AccessibilitySupport.h>)
-#include <AccessibilitySupport.h>
-#else
-extern "C" {
-CFStringRef kAXSWebAccessibilityEventsEnabledNotification;
-Boolean _AXSWebAccessibilityEventsEnabled();
-}
+#include <wtf/SoftLinking.h>
+SOFT_LINK_LIBRARY_OPTIONAL(libAccessibility)
+SOFT_LINK_MAY_FAIL(libAccessibility, _AXSWebAccessibilityEventsEnabled, Boolean, (), ())
+SOFT_LINK_CONSTANT_MAY_FAIL(libAccessibility, kAXSWebAccessibilityEventsEnabledNotification, CFStringRef)
 #endif
-#endif
 
 static HashMap<WebKit::WebPageProxy*, WKWebView *>& pageToViewMap()
 {
@@ -700,7 +696,8 @@
 #endif
 
 #if ENABLE(ACCESSIBILITY_EVENTS)
-    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), accessibilityEventsEnabledChangedCallback, kAXSWebAccessibilityEventsEnabledNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
+    if (canLoadkAXSWebAccessibilityEventsEnabledNotification())
+        CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), accessibilityEventsEnabledChangedCallback, getkAXSWebAccessibilityEventsEnabledNotification(), 0, CFNotificationSuspensionBehaviorDeliverImmediately);
     [self _updateAccessibilityEventsEnabled];
 #endif
 
@@ -3073,6 +3070,8 @@
 
 - (void)_updateAccessibilityEventsEnabled
 {
+    if (!canLoad_AXSWebAccessibilityEventsEnabled())
+        return;
     _page->updateAccessibilityEventsEnabled(_AXSWebAccessibilityEventsEnabled());
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to