Title: [258604] branches/safari-610.1.7-branch
Revision
258604
Author
[email protected]
Date
2020-03-17 15:44:39 -0700 (Tue, 17 Mar 2020)

Log Message

Cherry-pick r258359. rdar://problem/60517387

    [macOS] _AXSApplicationAccessibilityEnabled should not be called
    https://bugs.webkit.org/show_bug.cgi?id=208953

    Reviewed by Brent Fulgham.

    Source/WebCore:

    The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
    exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
    function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
    partially reverts this behavior.

    API test: WebKit.IsRemoteUIAppForAccessibility

    * testing/Internals.cpp:
    (WebCore::Internals::isRemoteUIAppForAccessibility):
    * testing/Internals.h:
    * testing/Internals.idl:
    * testing/Internals.mm:
    (WebCore::Internals::isRemoteUIAppForAccessibility):

    Source/WebCore/PAL:

    Declare method to check if the process is a remote UI app for accessibility.

    * pal/spi/cocoa/NSAccessibilitySPI.h:

    Source/WebKit:

    On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
    kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.

    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
    (WebKit::WebProcessPool::platformInitializeWebProcess):
    (WebKit::WebProcessPool::registerNotificationObservers):
    (WebKit::WebProcessPool::unregisterNotificationObservers):
    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
    (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
    * WebProcess/cocoa/WebProcessCocoa.mm:
    (WebKit::WebProcess::platformInitializeProcess):
    (WebKit::WebProcess::unblockAccessibilityServer):

    Tools:

    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258359 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-610.1.7-branch/Source/WebCore/ChangeLog (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/ChangeLog	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/ChangeLog	2020-03-17 22:44:39 UTC (rev 258604)
@@ -1,3 +1,77 @@
+2020-03-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r258359. rdar://problem/60517387
+
+    [macOS] _AXSApplicationAccessibilityEnabled should not be called
+    https://bugs.webkit.org/show_bug.cgi?id=208953
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
+    exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
+    function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
+    partially reverts this behavior.
+    
+    API test: WebKit.IsRemoteUIAppForAccessibility
+    
+    * testing/Internals.cpp:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    * testing/Internals.mm:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    
+    Source/WebCore/PAL:
+    
+    Declare method to check if the process is a remote UI app for accessibility.
+    
+    * pal/spi/cocoa/NSAccessibilitySPI.h:
+    
+    Source/WebKit:
+    
+    On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
+    kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::platformInitializeWebProcess):
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    (WebKit::WebProcessPool::unregisterNotificationObservers):
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    (WebKit::WebProcess::unblockAccessibilityServer):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-12  Per Arne Vollan  <[email protected]>
+
+            [macOS] _AXSApplicationAccessibilityEnabled should not be called
+            https://bugs.webkit.org/show_bug.cgi?id=208953
+
+            Reviewed by Brent Fulgham.
+
+            The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
+            exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
+            function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
+            partially reverts this behavior.
+
+            API test: WebKit.IsRemoteUIAppForAccessibility
+
+            * testing/Internals.cpp:
+            (WebCore::Internals::isRemoteUIAppForAccessibility):
+            * testing/Internals.h:
+            * testing/Internals.idl:
+            * testing/Internals.mm:
+            (WebCore::Internals::isRemoteUIAppForAccessibility):
+
 2020-03-13  Kocsen Chung  <[email protected]>
 
         Cherry-pick r258399. rdar://problem/60422524

Modified: branches/safari-610.1.7-branch/Source/WebCore/PAL/ChangeLog (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/PAL/ChangeLog	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/PAL/ChangeLog	2020-03-17 22:44:39 UTC (rev 258604)
@@ -1,3 +1,67 @@
+2020-03-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r258359. rdar://problem/60517387
+
+    [macOS] _AXSApplicationAccessibilityEnabled should not be called
+    https://bugs.webkit.org/show_bug.cgi?id=208953
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
+    exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
+    function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
+    partially reverts this behavior.
+    
+    API test: WebKit.IsRemoteUIAppForAccessibility
+    
+    * testing/Internals.cpp:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    * testing/Internals.mm:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    
+    Source/WebCore/PAL:
+    
+    Declare method to check if the process is a remote UI app for accessibility.
+    
+    * pal/spi/cocoa/NSAccessibilitySPI.h:
+    
+    Source/WebKit:
+    
+    On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
+    kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::platformInitializeWebProcess):
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    (WebKit::WebProcessPool::unregisterNotificationObservers):
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    (WebKit::WebProcess::unblockAccessibilityServer):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-12  Per Arne Vollan  <[email protected]>
+
+            [macOS] _AXSApplicationAccessibilityEnabled should not be called
+            https://bugs.webkit.org/show_bug.cgi?id=208953
+
+            Reviewed by Brent Fulgham.
+
+            Declare method to check if the process is a remote UI app for accessibility.
+
+            * pal/spi/cocoa/NSAccessibilitySPI.h:
+
 2020-03-08  Per Arne Vollan  <[email protected]>
 
         [iOS] Mapping to UTI from tag and tag class should be performed in the UI process

Modified: branches/safari-610.1.7-branch/Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h	2020-03-17 22:44:39 UTC (rev 258604)
@@ -35,6 +35,7 @@
 
 @interface NSAccessibilityRemoteUIElement : NSObject
 
++ (BOOL)isRemoteUIApp;
 + (void)setRemoteUIApp:(BOOL)flag;
 + (NSData *)remoteTokenForLocalUIElement:(id)localUIElement;
 + (void)registerRemoteUIProcessIdentifier:(pid_t)pid;

Modified: branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.cpp (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.cpp	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.cpp	2020-03-17 22:44:39 UTC (rev 258604)
@@ -5506,6 +5506,11 @@
 {
     return emptyString();
 }
+
+bool Internals::isRemoteUIAppForAccessibility()
+{
+    return false;
+}
 #endif
 
 String Internals::mediaMIMETypeForExtension(const String& extension)

Modified: branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.h (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.h	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.h	2020-03-17 22:44:39 UTC (rev 258604)
@@ -949,6 +949,8 @@
 
     String focusRingColor();
 
+    bool isRemoteUIAppForAccessibility();
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;

Modified: branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.idl (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.idl	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.idl	2020-03-17 22:44:39 UTC (rev 258604)
@@ -856,4 +856,6 @@
     DOMString getUTIFromTag(DOMString tagClass, DOMString tag, DOMString conformingToUTI);
 
     boolean supportsPictureInPicture();
+
+    boolean isRemoteUIAppForAccessibility();
 };

Modified: branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.mm (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.mm	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebCore/testing/Internals.mm	2020-03-17 22:44:39 UTC (rev 258604)
@@ -36,6 +36,7 @@
 #import "Range.h"
 #import "UTIUtilities.h"
 #import <AVFoundation/AVPlayer.h>
+#import <pal/spi/cocoa/NSAccessibilitySPI.h>
 #import <wtf/cocoa/NSURLExtras.h>
 
 #if PLATFORM(IOS_FAMILY)
@@ -111,4 +112,13 @@
     return UTIFromTag(tagClass, tag, conformingToUTI);
 }
 
+bool Internals::isRemoteUIAppForAccessibility()
+{
+#if PLATFORM(MAC)
+    return [NSAccessibilityRemoteUIElement isRemoteUIApp];
+#else
+    return false;
+#endif
 }
+
+}

Modified: branches/safari-610.1.7-branch/Source/WebKit/ChangeLog (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebKit/ChangeLog	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebKit/ChangeLog	2020-03-17 22:44:39 UTC (rev 258604)
@@ -1,5 +1,78 @@
 2020-03-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r258359. rdar://problem/60517387
+
+    [macOS] _AXSApplicationAccessibilityEnabled should not be called
+    https://bugs.webkit.org/show_bug.cgi?id=208953
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
+    exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
+    function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
+    partially reverts this behavior.
+    
+    API test: WebKit.IsRemoteUIAppForAccessibility
+    
+    * testing/Internals.cpp:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    * testing/Internals.mm:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    
+    Source/WebCore/PAL:
+    
+    Declare method to check if the process is a remote UI app for accessibility.
+    
+    * pal/spi/cocoa/NSAccessibilitySPI.h:
+    
+    Source/WebKit:
+    
+    On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
+    kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::platformInitializeWebProcess):
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    (WebKit::WebProcessPool::unregisterNotificationObservers):
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    (WebKit::WebProcess::unblockAccessibilityServer):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-12  Per Arne Vollan  <[email protected]>
+
+            [macOS] _AXSApplicationAccessibilityEnabled should not be called
+            https://bugs.webkit.org/show_bug.cgi?id=208953
+
+            Reviewed by Brent Fulgham.
+
+            On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
+            kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
+
+            * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+            (WebKit::WebProcessPool::platformInitializeWebProcess):
+            (WebKit::WebProcessPool::registerNotificationObservers):
+            (WebKit::WebProcessPool::unregisterNotificationObservers):
+            * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+            (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
+            * WebProcess/cocoa/WebProcessCocoa.mm:
+            (WebKit::WebProcess::platformInitializeProcess):
+            (WebKit::WebProcess::unblockAccessibilityServer):
+
+2020-03-17  Alan Coon  <[email protected]>
+
         Cherry-pick r258557. rdar://problem/60517387
 
     [Cocoa] Disable CF prefs direct mode

Modified: branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-03-17 22:44:39 UTC (rev 258604)
@@ -118,10 +118,6 @@
 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 {
@@ -454,8 +450,8 @@
             SandboxExtension::createHandleForMachLookup(services[i], WTF::nullopt, parameters.mediaExtensionHandles[i]);
     }
 
-#if ENABLE(CFPREFS_DIRECT_MODE)
-    if (libAccessibilityLibrary() && _AXSApplicationAccessibilityEnabled()) {
+#if ENABLE(CFPREFS_DIRECT_MODE) && PLATFORM(IOS_FAMILY)
+    if (_AXSApplicationAccessibilityEnabled()) {
         SandboxExtension::Handle preferencesExtensionHandle;
         SandboxExtension::createHandleForMachLookup("com.apple.cfprefsd.daemon", WTF::nullopt, preferencesExtensionHandle);
         parameters.preferencesExtensionHandle = WTFMove(preferencesExtensionHandle);
@@ -665,15 +661,13 @@
     CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, remoteWebInspectorEnabledCallback, static_cast<CFStringRef>(CFSTR(WIRServiceEnabledNotification)), nullptr, CFNotificationSuspensionBehaviorCoalesce);
 #endif
 #endif // PLATFORM(IOS)
+    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();
+        }
+    }];
 #endif // !PLATFORM(IOS_FAMILY)
-    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()
@@ -697,9 +691,8 @@
     CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, CFSTR(WIRServiceEnabledNotification), nullptr);
 #endif
 #endif // PLATFORM(IOS)
+    [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
 #endif // !PLATFORM(IOS_FAMILY)
-    if (m_accessibilityEnabledObserver.get())
-        [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
 }
 
 static CFURLStorageSessionRef privateBrowsingSession()

Modified: branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-03-17 22:44:39 UTC (rev 258604)
@@ -46,10 +46,6 @@
 
 namespace WebKit {
 
-#if PLATFORM(MAC)
-SOFT_LINK_LIBRARY_OPTIONAL(libAccessibility)
-#endif
-
 static const Seconds unexpectedActivityDuration = 10_s;
 
 const HashSet<String>& WebProcessProxy::platformPathsWithAssumedReadAccess()
@@ -234,12 +230,10 @@
 {
     if (m_hasSentMessageToUnblockAccessibilityServer)
         return;
-#if PLATFORM(MAC)
-    if (!WebKit::libAccessibilityLibrary())
+#if PLATFORM(IOS_FAMILY)
+    if (!_AXSApplicationAccessibilityEnabled())
         return;
 #endif
-    if (!_AXSApplicationAccessibilityEnabled())
-        return;
     if (!processIdentifier())
         return;
     if (!canSendMessage())

Modified: branches/safari-610.1.7-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (258603 => 258604)


--- branches/safari-610.1.7-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-03-17 22:44:39 UTC (rev 258604)
@@ -582,10 +582,6 @@
     else
         m_processType = ProcessType::WebContent;
 
-#if PLATFORM(MAC)
-    registerWithAccessibility();
-#endif
-
 #if USE(OS_STATE)
     registerWithStateDumper();
 #endif
@@ -1034,9 +1030,8 @@
 #if PLATFORM(IOS_FAMILY)
     bool ok = SandboxExtension::consumePermanently(handle);
     ASSERT_UNUSED(ok, ok);
-    
+#endif
     registerWithAccessibility();
-#endif
 }
 
 

Modified: branches/safari-610.1.7-branch/Tools/ChangeLog (258603 => 258604)


--- branches/safari-610.1.7-branch/Tools/ChangeLog	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Tools/ChangeLog	2020-03-17 22:44:39 UTC (rev 258604)
@@ -1,3 +1,65 @@
+2020-03-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r258359. rdar://problem/60517387
+
+    [macOS] _AXSApplicationAccessibilityEnabled should not be called
+    https://bugs.webkit.org/show_bug.cgi?id=208953
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
+    exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
+    function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
+    partially reverts this behavior.
+    
+    API test: WebKit.IsRemoteUIAppForAccessibility
+    
+    * testing/Internals.cpp:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    * testing/Internals.mm:
+    (WebCore::Internals::isRemoteUIAppForAccessibility):
+    
+    Source/WebCore/PAL:
+    
+    Declare method to check if the process is a remote UI app for accessibility.
+    
+    * pal/spi/cocoa/NSAccessibilitySPI.h:
+    
+    Source/WebKit:
+    
+    On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
+    kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::platformInitializeWebProcess):
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    (WebKit::WebProcessPool::unregisterNotificationObservers):
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    (WebKit::WebProcess::unblockAccessibilityServer):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-12  Per Arne Vollan  <[email protected]>
+
+            [macOS] _AXSApplicationAccessibilityEnabled should not be called
+            https://bugs.webkit.org/show_bug.cgi?id=208953
+
+            Reviewed by Brent Fulgham.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+
 2020-03-13  Kocsen Chung  <[email protected]>
 
         Cherry-pick r258399. rdar://problem/60422524

Modified: branches/safari-610.1.7-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (258603 => 258604)


--- branches/safari-610.1.7-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-03-17 22:29:03 UTC (rev 258603)
+++ branches/safari-610.1.7-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-03-17 22:44:39 UTC (rev 258604)
@@ -1019,6 +1019,7 @@
 		E3C21A7C21B25CA2003B31A3 /* URLExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3C21A7B21B25CA2003B31A3 /* URLExtras.mm */; };
 		E3CAAA4C2415505100CED2E2 /* UTIFromTag.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3CAAA4B2415505100CED2E2 /* UTIFromTag.mm */; };
 		E3DEA8111F0A589000CBC2E8 /* ThreadGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DEA8101F0A588000CBC2E8 /* ThreadGroup.cpp */; };
+		E3F8AB92241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */; };
 		E5036F78211BC25400BFDBE2 /* color-drop.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E5036F77211BC22800BFDBE2 /* color-drop.html */; };
 		ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = ECA680CD1E68CC0900731D20 /* StringUtilities.mm */; };
 		F402F56C23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = F402F56B23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm */; };
@@ -2621,6 +2622,7 @@
 		E3C21A7B21B25CA2003B31A3 /* URLExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = URLExtras.mm; sourceTree = "<group>"; };
 		E3CAAA4B2415505100CED2E2 /* UTIFromTag.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIFromTag.mm; sourceTree = "<group>"; };
 		E3DEA8101F0A588000CBC2E8 /* ThreadGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGroup.cpp; sourceTree = "<group>"; };
+		E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityRemoteUIApp.mm; sourceTree = "<group>"; };
 		E40019301ACE9B5C001B0A2A /* BloomFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BloomFilter.cpp; sourceTree = "<group>"; };
 		E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
 		E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Deque.cpp; sourceTree = "<group>"; };
@@ -2911,6 +2913,7 @@
 		0F139E741A423A4600F590F5 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
+				E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */,
 				C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */,
 				C1692DC923D10DAE006E88F7 /* Battery.mm */,
 				C13D82D82416F13200A62793 /* EnableAccessibility.mm */,
@@ -4689,6 +4692,7 @@
 				57C6244E2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm in Sources */,
 				7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */,
 				7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */,
+				E3F8AB92241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm in Sources */,
 				2E205BA41F527746005952DD /* AccessibilityTestsIOS.mm in Sources */,
 				9BD5111C1FE8E11600D2B630 /* AccessingPastedImage.mm in Sources */,
 				F45B63FE1F19D410009D38B9 /* ActionSheetTests.mm in Sources */,

Added: branches/safari-610.1.7-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityRemoteUIApp.mm (0 => 258604)


--- branches/safari-610.1.7-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityRemoteUIApp.mm	                        (rev 0)
+++ branches/safari-610.1.7-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityRemoteUIApp.mm	2020-03-17 22:44:39 UTC (rev 258604)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if PLATFORM(MAC)
+
+#if WK_HAVE_C_SPI
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+
+TEST(WebKit, IsRemoteUIAppForAccessibility)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
+    configuration.get().processPool = (WKProcessPool *)context.get();
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+
+    auto isRemoteUIApp = [&] {
+        return [webView stringByEvaluatingJavaScript:@"window.internals.isRemoteUIAppForAccessibility()"].boolValue;
+    };
+
+    ASSERT_TRUE(isRemoteUIApp);
+}
+
+#endif // WK_HAVE_C_SPI
+#endif // PLATFORM(MAC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to