Title: [265469] branches/safari-610.1.25.10-branch
Revision
265469
Author
[email protected]
Date
2020-08-10 16:47:53 -0700 (Mon, 10 Aug 2020)

Log Message

Cherry-pick r265264. rdar://problem/66644041

    [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
    https://bugs.webkit.org/show_bug.cgi?id=215112
    Source/WebCore/PAL:

    Reviewed by Youenn Fablet.

    Declare NSApplication methods to enable enhanced accessibility user interface, and check if it is enabled.

    * pal/spi/mac/NSApplicationSPI.h:

    Source/WebKit:

    <rdar://problem/66498397>

    Reviewed by Youenn Fablet.

    As a security mitigation, return early when handling this notification if Accessibility is not enabled.

    API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification

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

    Tools:

    Reviewed by Youenn Fablet.

    Added test WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification.

    * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
    (TEST):

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

Modified Paths

Diff

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/PAL/ChangeLog (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Source/WebCore/PAL/ChangeLog	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/PAL/ChangeLog	2020-08-10 23:47:53 UTC (rev 265469)
@@ -1,5 +1,55 @@
 2020-08-10  Alan Coon  <[email protected]>
 
+        Cherry-pick r265264. rdar://problem/66644041
+
+    [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+    https://bugs.webkit.org/show_bug.cgi?id=215112
+    Source/WebCore/PAL:
+    
+    Reviewed by Youenn Fablet.
+    
+    Declare NSApplication methods to enable enhanced accessibility user interface, and check if it is enabled.
+    
+    * pal/spi/mac/NSApplicationSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/66498397>
+    
+    Reviewed by Youenn Fablet.
+    
+    As a security mitigation, return early when handling this notification if Accessibility is not enabled.
+    
+    API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    
+    Tools:
+    
+    Reviewed by Youenn Fablet.
+    
+    Added test WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification.
+    
+    * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
+    (TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-04  Per Arne Vollan  <[email protected]>
+
+            [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+            https://bugs.webkit.org/show_bug.cgi?id=215112
+
+            Reviewed by Youenn Fablet.
+
+            Declare NSApplication methods to enable enhanced accessibility user interface, and check if it is enabled.
+
+            * pal/spi/mac/NSApplicationSPI.h:
+
+2020-08-10  Alan Coon  <[email protected]>
+
         Cherry-pick r265215. rdar://problem/66643571
 
     Finalize the list of MobileGestalt queries needed to populate the in-memory cache in the WebContent process

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h	2020-08-10 23:47:53 UTC (rev 265469)
@@ -32,6 +32,9 @@
 + (void)_accessibilityInitialize;
 + (void)_preventDockConnections;
 
+- (void)accessibilitySetEnhancedUserInterfaceAttribute:(id)value;
+- (id)accessibilityEnhancedUserInterfaceAttribute;
+
 // Conditionally define this only for !USE_APPLE_INTERNAL_SDK when <rdar://problem/63864711> is fixed.
 @property (copy, setter=_setAccentColor:) NSColor *_accentColor;
 

Modified: branches/safari-610.1.25.10-branch/Source/WebKit/ChangeLog (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Source/WebKit/ChangeLog	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Source/WebKit/ChangeLog	2020-08-10 23:47:53 UTC (rev 265469)
@@ -1,5 +1,59 @@
 2020-08-10  Alan Coon  <[email protected]>
 
+        Cherry-pick r265264. rdar://problem/66644041
+
+    [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+    https://bugs.webkit.org/show_bug.cgi?id=215112
+    Source/WebCore/PAL:
+    
+    Reviewed by Youenn Fablet.
+    
+    Declare NSApplication methods to enable enhanced accessibility user interface, and check if it is enabled.
+    
+    * pal/spi/mac/NSApplicationSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/66498397>
+    
+    Reviewed by Youenn Fablet.
+    
+    As a security mitigation, return early when handling this notification if Accessibility is not enabled.
+    
+    API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    
+    Tools:
+    
+    Reviewed by Youenn Fablet.
+    
+    Added test WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification.
+    
+    * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
+    (TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-04  Per Arne Vollan  <[email protected]>
+
+            [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+            https://bugs.webkit.org/show_bug.cgi?id=215112
+            <rdar://problem/66498397>
+
+            Reviewed by Youenn Fablet.
+
+            As a security mitigation, return early when handling this notification if Accessibility is not enabled.
+
+            API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification
+
+            * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+            (WebKit::WebProcessPool::registerNotificationObservers):
+
+2020-08-10  Alan Coon  <[email protected]>
+
         Cherry-pick r265238. rdar://problem/66645891
 
     Allow -accessoryDone to blur the focused element on iPad when AutoFilling strong passwords

Modified: branches/safari-610.1.25.10-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-08-10 23:47:53 UTC (rev 265469)
@@ -78,6 +78,7 @@
 
 #if PLATFORM(MAC)
 #import <QuartzCore/CARemoteLayerServer.h>
+#import <pal/spi/mac/NSApplicationSPI.h>
 #else
 #import "UIKitSPI.h"
 #endif
@@ -638,11 +639,13 @@
 #if !PLATFORM(IOS_FAMILY)
     // Listen for enhanced accessibility changes and propagate them to the WebProcess.
     m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
+        setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]);
 #if ENABLE(CFPREFS_DIRECT_MODE)
+        if (![[NSApp accessibilityEnhancedUserInterfaceAttribute] boolValue])
+            return;
         for (auto& process : m_processes)
             process->unblockPreferenceServiceIfNeeded();
 #endif
-        setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]);
     }];
 
     m_automaticTextReplacementNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSSpellCheckerDidChangeAutomaticTextReplacementNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) {
@@ -697,6 +700,8 @@
 
 #if PLATFORM(IOS_FAMILY)
     m_accessibilityEnabledObserver = [[NSNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) {
+        if (!_AXSApplicationAccessibilityEnabled())
+            return;
         for (size_t i = 0; i < m_processes.size(); ++i) {
 #if ENABLE(CFPREFS_DIRECT_MODE)
             m_processes[i]->unblockPreferenceServiceIfNeeded();

Modified: branches/safari-610.1.25.10-branch/Tools/ChangeLog (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Tools/ChangeLog	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Tools/ChangeLog	2020-08-10 23:47:53 UTC (rev 265469)
@@ -1,5 +1,56 @@
 2020-08-10  Alan Coon  <[email protected]>
 
+        Cherry-pick r265264. rdar://problem/66644041
+
+    [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+    https://bugs.webkit.org/show_bug.cgi?id=215112
+    Source/WebCore/PAL:
+    
+    Reviewed by Youenn Fablet.
+    
+    Declare NSApplication methods to enable enhanced accessibility user interface, and check if it is enabled.
+    
+    * pal/spi/mac/NSApplicationSPI.h:
+    
+    Source/WebKit:
+    
+    <rdar://problem/66498397>
+    
+    Reviewed by Youenn Fablet.
+    
+    As a security mitigation, return early when handling this notification if Accessibility is not enabled.
+    
+    API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification
+    
+    * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+    (WebKit::WebProcessPool::registerNotificationObservers):
+    
+    Tools:
+    
+    Reviewed by Youenn Fablet.
+    
+    Added test WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification.
+    
+    * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
+    (TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-04  Per Arne Vollan  <[email protected]>
+
+            [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification
+            https://bugs.webkit.org/show_bug.cgi?id=215112
+
+            Reviewed by Youenn Fablet.
+
+            Added test WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification.
+
+            * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
+            (TEST):
+
+2020-08-10  Alan Coon  <[email protected]>
+
         Cherry-pick r265238. rdar://problem/66645891
 
     Allow -accessoryDone to blur the focused element on iPad when AutoFilling strong passwords

Modified: branches/safari-610.1.25.10-branch/Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm (265468 => 265469)


--- branches/safari-610.1.25.10-branch/Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm	2020-08-10 23:47:50 UTC (rev 265468)
+++ branches/safari-610.1.25.10-branch/Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm	2020-08-10 23:47:53 UTC (rev 265469)
@@ -33,6 +33,10 @@
 #import <pal/spi/cocoa/NSAccessibilitySPI.h>
 #import <wtf/SoftLinking.h>
 
+#if PLATFORM(MAC)
+#import <pal/spi/mac/NSApplicationSPI.h>
+#endif
+
 SOFT_LINK_LIBRARY(libAccessibility)
 SOFT_LINK_CONSTANT(libAccessibility, kAXSApplicationAccessibilityEnabledNotification, CFStringRef);
 
@@ -59,15 +63,39 @@
 
     [webView synchronouslyLoadTestPageNamed:@"simple"];
 
-    [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil userInfo:nil];
+    [NSApp accessibilitySetEnhancedUserInterfaceAttribute:@(YES)];
 
     auto sandboxAccess = [&] {
         return [webView stringByEvaluatingJavaScript:@"window.internals.hasSandboxMachLookupAccessToGlobalName('com.apple.WebKit.WebContent', 'com.apple.cfprefsd.daemon')"].boolValue;
     };
 
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+
     ASSERT_TRUE(sandboxAccess());
+
+    [NSApp accessibilitySetEnhancedUserInterfaceAttribute:@(NO)];
 }
 
+TEST(WebKit, AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification)
+{
+    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]);
+
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+    [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil userInfo:nil];
+
+    auto sandboxAccess = [&] {
+        return [webView stringByEvaluatingJavaScript:@"window.internals.hasSandboxMachLookupAccessToGlobalName('com.apple.WebKit.WebContent', 'com.apple.cfprefsd.daemon')"].boolValue;
+    };
+
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+    ASSERT_TRUE(!sandboxAccess());
+}
+
 #if PLATFORM(IOS_FAMILY)
 TEST(WebKit, AccessibilityHasFrontboardServiceAccess)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to