RESOLVED FIXED262960
AX: Remove "com.apple.iphone.axserver-systemwide" sandbox exception
https://bugs.webkit.org/show_bug.cgi?id=262960
Summary AX: Remove "com.apple.iphone.axserver-systemwide" sandbox exception
chris fleizach
Reported 2023-10-10 09:00:12 PDT
Remove "com.apple.iphone.axserver-systemwide" sandbox exception <rdar://problem/116387615>
Attachments
Patch (42.94 KB, patch)
2023-10-10 09:06 PDT, chris fleizach
no flags
Patch (43.88 KB, patch)
2023-10-11 01:37 PDT, chris fleizach
no flags
Patch (44.45 KB, patch)
2023-10-12 07:50 PDT, chris fleizach
no flags
Patch (45.90 KB, patch)
2023-10-12 23:59 PDT, chris fleizach
no flags
Radar WebKit Bug Importer
Comment 1 2023-10-10 09:00:21 PDT
chris fleizach
Comment 2 2023-10-10 09:06:16 PDT
Tyler Wilcock
Comment 3 2023-10-10 13:40:38 PDT
Comment on attachment 468150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=468150&action=review > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:96 > + auto page = document().page(); Document::page() returns a pointer, so I think this should be auto*. > Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm:109 > + if (stringNotification.isNull()) I know you didn't change this. But I wonder if this should check isEmpty() rather than isNull(). isEmpty() checks for null or empty string, not just null. > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1712 > + auto notification = String(notificationName); Is this temporary value necessary? Or could we just pass notificationName right into relayAccessibilityNotification? I think there's an automatic NSString to String conversion. > Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:505 > + explicit AXRelayProcessSuspendedNotification(Ref<WebPage>, bool messageSuspendedAutomatically); I think WebKit style prefers: enum class MessageSuspendedAutomatically : bool { No, Yes }; Rather than using bools in these scenarios, as it's better documentation at the callsites. Also I wonder if we should use a default value? Seems like MessageSuspendedAutomatically::Yes is the more common use, and more in line with what one might expect the behavior to be by default? enum class MessageSuspendedAutomatically : bool { No, Yes }; class AXRelayProcessSuspendedNotification { public: explicit AXRelayProcessSuspendedNotification(Ref<WebPage>, MessageSuspendedAutomatically = MessageSuspendedAutomatically::Yes); Also the behavior that this flag controls feels more like "AutomaticallySend::Yes" / "AutomaticallySend::No" to me. But if you think the current name is more accurate, feel free to leave as-is. > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:261 > + IPC::DataReference dataToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([notificationData bytes]), [notificationData length]); https://developer.apple.com/documentation/foundation/nsdata/1410616-bytes?language=objc > If the length of the NSData object is 0, this property returns nil. Do we need to guard against length zero? Or is it OK to construct IPC::DataReference with nil?
chris fleizach
Comment 4 2023-10-11 01:00:08 PDT
> > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1712 > > + auto notification = String(notificationName); > > Is this temporary value necessary? Or could we just pass notificationName > right into relayAccessibilityNotification? I think there's an automatic > NSString to String conversion. > error: non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'NSString *
chris fleizach
Comment 5 2023-10-11 01:37:15 PDT
Andres Gonzalez
Comment 6 2023-10-11 07:56:37 PDT
(In reply to chris fleizach from comment #5) > Created attachment 468170 [details] > Patch diff --git a/Source/WebCore/accessibility/AXObjectCache.h b/Source/WebCore/accessibility/AXObjectCache.h index ad2b4c5d3bb3..eadcb44c2927 100644 --- a/Source/WebCore/accessibility/AXObjectCache.h +++ b/Source/WebCore/accessibility/AXObjectCache.h @@ -476,6 +476,10 @@ public: std::optional<Vector<AXID>> relatedObjectIDsFor(const AXCoreObject&, AXRelationType); void updateRelations(Element&, const QualifiedName&); +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(String& notificationName, RetainPtr<NSData> notificationData); AG: const String& ? The style checker may complain about having param names in the method declaration. Accessibility in the method name is unnecessary since this is an Accessibility class. +#endif + #if ENABLE(ACCESSIBILITY_ISOLATED_TREE) void scheduleObjectRegionsUpdate(bool scheduleImmediately = false) { m_geometryManager->scheduleObjectRegionsUpdate(scheduleImmediately); } void willUpdateObjectRegions() { m_geometryManager->willUpdateObjectRegions(); } diff --git a/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm b/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm index 5b2f9caab890..601d8bf41a92 100644 --- a/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm +++ b/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm @@ -29,8 +29,9 @@ #if ENABLE(ACCESSIBILITY) && PLATFORM(IOS_FAMILY) #import "AccessibilityObject.h" -#import "WebAccessibilityObjectWrapperIOS.h" +#import "Chrome.h" #import "RenderObject.h" +#import "WebAccessibilityObjectWrapperIOS.h" #import <wtf/RetainPtr.h> @@ -90,24 +91,30 @@ ASCIILiteral AXObjectCache::notificationPlatformName(AXNotification notification return name; } +void AXObjectCache::relayAccessibilityNotification(String& notificationName, RetainPtr<NSData> notificationData) +{ + auto* page = document().page(); + if (!page) + return; + + page->chrome().relayAccessibilityNotification(notificationName, notificationData); AG: consider the more concise : if (auto* page = document().page()) page->chrome().relayAccessibilityNotification(notificationName, notificationData); +} + void AXObjectCache::postPlatformNotification(AXCoreObject* object, AXNotification notification) { if (!object) return; - // iOS notifications must ultimately call UIKit UIAccessibilityPostNotification. - // But WebCore is not linked with UIKit. So a workaround is to override the wrapper's - // postNotification method in the system WebKitAccessibility bundle that does link UIKit. - auto notificationName = notificationPlatformName(notification); - if (notificationName.isNull()) + auto stringNotification = AXObjectCache::notificationPlatformName(notification); AG: remove AXObjectCache::. + if (stringNotification.isEmpty()) return; - auto nsNotificationName = notificationName.createNSString(); - [object->wrapper() postNotification:nsNotificationName.get()]; + auto notificationName = stringNotification.createNSString(); + [object->wrapper() accessibilityOverrideProcessNotification:notificationName.get()]; // To simulate AX notifications for LayoutTests on the simulator, call // the wrapper's accessibilityPostedNotification. - [object->wrapper() accessibilityPostedNotification:nsNotificationName.get()]; + [object->wrapper() accessibilityPostedNotification:notificationName.get()]; } void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, const AXTextStateChangeIntent&, const VisibleSelection&) diff --git a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h index 6c6bb91f80c0..ea59521d7087 100644 --- a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h +++ b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h @@ -76,7 +76,12 @@ static NSString * const UIAccessibilityAcceptedInlineTextCompletion = @"UIAccess - (BOOL)isAttachment; -- (void)postNotification:(NSString *)notificationName; +// This interacts with Accessibility system to post process some notifications. AG: is this "postprocess some" or "post some process" ? +- (void)accessibilityOverrideProcessNotification:(NSString *)notificationName; + +// This is called by the Accessibility system to relay back to the chrome. +- (void)handleNotificationRelayToChrome:(NSString *)notificationName notificationData:(NSData *)notificationData; + @end #endif // ENABLE(ACCESSIBILITY) && PLATFORM(IOS_FAMILY) diff --git a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm index ab31938694ba..a625b47a02e8 100644 --- a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm +++ b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm @@ -1687,7 +1687,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction if (result) { auto notificationName = AXObjectCache::notificationPlatformName(AXObjectCache::AXNotification::AXPageScrolled).createNSString(); - [self postNotification:notificationName.get()]; + [self accessibilityOverrideProcessNotification:notificationName.get()]; CGPoint scrollPos = [self _accessibilityScrollPosition]; NSString *testString = [NSString stringWithFormat:@"AXScroll [position: %.2f %.2f]", scrollPos.x, scrollPos.y]; @@ -1698,6 +1698,21 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction return result; } +- (void)accessibilityOverrideProcessNotification:(NSString *)notificationName +{ + // This is overriden by the Accessibility system to post-process notifications. AG: overriden -> overridden + // When it is done, it will call back into handleNotificationRelayToChrome. +} + +- (void)handleNotificationRelayToChrome:(NSString *)notificationName notificationData:(NSData *)notificationData +{ + if (![self _prepareAccessibilityCall]) + return; + + auto notification = String(notificationName); + self.axBackingObject->axObjectCache()->relayAccessibilityNotification(notification, notificationData); AG: don't need the notification temp, should be able to do : self.axBackingObject->axObjectCache()->relayAccessibilityNotification(notificationName, notificationData); or self.axBackingObject->axObjectCache()->relayAccessibilityNotification({ notificationName }, notificationData); since there is a String constructor that takes NSString. +} + - (CGRect)_accessibilityRelativeFrame { auto rect = FloatRect(snappedIntRect(self.axBackingObject->elementRect())); @@ -2046,11 +2061,6 @@ - (id)_accessibilityParentForSubview:(id)subview return nil; } -- (void)postNotification:(NSString *)notificationName -{ - // The UIKit accessibility wrapper will override and post appropriate notification. -} - // These will be used by the UIKit wrapper to calculate an appropriate description of scroll status. - (CGPoint)_accessibilityScrollPosition { diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index 07ae057e74fa..f57fa7ae0c41 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -117,6 +117,9 @@ class EmptyChromeClient : public ChromeClient { IntRect rootViewToScreen(const IntRect& r) const final { return r; } IntPoint accessibilityScreenToRootView(const IntPoint& p) const final { return p; }; IntRect rootViewToAccessibilityScreen(const IntRect& r) const final { return r; }; +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(const String&, const RetainPtr<NSData>) const final { }; AG: const RetainPtr ? We are passing RetainPtr everywhere else. In many places in the code base we pass RetainPtr by ref, i.e., const RetainPtr<T>&, but my understanding is that that is not necessary because RetainPtr is small enough that passing by value doesn't add any extra cost. +#endif void didFinishLoadingImageForElement(HTMLImageElement&) final { } diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp index afb8a706774f..93bf528d1aa7 100644 --- a/Source/WebCore/page/Chrome.cpp +++ b/Source/WebCore/page/Chrome.cpp @@ -127,6 +127,13 @@ IntRect Chrome::rootViewToAccessibilityScreen(const IntRect& rect) const return m_client->rootViewToAccessibilityScreen(rect); } +#if PLATFORM(IOS_FAMILY) +void Chrome::relayAccessibilityNotification(const String& notificationName, RetainPtr<NSData> notificationData) const +{ + return m_client->relayAccessibilityNotification(notificationName, notificationData); +} +#endif + PlatformPageClient Chrome::platformPageClient() const { return m_client->platformPageClient(); diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h index f80330581dbe..04c4e528f54f 100644 --- a/Source/WebCore/page/Chrome.h +++ b/Source/WebCore/page/Chrome.h @@ -105,6 +105,9 @@ public: IntPoint accessibilityScreenToRootView(const IntPoint&) const override; IntRect rootViewToAccessibilityScreen(const IntRect&) const override; PlatformPageClient platformPageClient() const override; +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(const String& notificationName, RetainPtr<NSData> notificationData) const override; AG: style checker may complain about param names in the declaration. +#endif void setCursor(const Cursor&) override; void setCursorHiddenUntilMouseMoves(bool) override; diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 33293f37310d..4d97eb4436d1 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -225,6 +225,9 @@ public: virtual IntRect rootViewToScreen(const IntRect&) const = 0; virtual IntPoint accessibilityScreenToRootView(const IntPoint&) const = 0; virtual IntRect rootViewToAccessibilityScreen(const IntRect&) const = 0; +#if PLATFORM(IOS_FAMILY) + virtual void relayAccessibilityNotification(const String&, RetainPtr<NSData>) const = 0; +#endif virtual void didFinishLoadingImageForElement(HTMLImageElement&) = 0; diff --git a/Source/WebCore/platform/HostWindow.h b/Source/WebCore/platform/HostWindow.h index cb652999f693..5b09629a8074 100644 --- a/Source/WebCore/platform/HostWindow.h +++ b/Source/WebCore/platform/HostWindow.h @@ -28,8 +28,13 @@ #include "GraphicsClient.h" #include "Widget.h" +#if PLATFORM(IOS_FAMILY) +OBJC_CLASS NSData; +#endif + namespace WebCore { +class DataSegment; class Cursor; AG: I think the alphabetic ordering rule applies to class forward declarations, but maybe not. using FramesPerSecond = unsigned; @@ -57,6 +62,9 @@ public: virtual IntRect rootViewToScreen(const IntRect&) const = 0; virtual IntPoint accessibilityScreenToRootView(const IntPoint&) const = 0; virtual IntRect rootViewToAccessibilityScreen(const IntRect&) const = 0; +#if PLATFORM(IOS_FAMILY) + virtual void relayAccessibilityNotification(const String&, RetainPtr<NSData>) const = 0; +#endif // Method for retrieving the native client of the page. virtual PlatformPageClient platformPageClient() const = 0; diff --git a/Source/WebKit/Platform/IPC/Connection.cpp b/Source/WebKit/Platform/IPC/Connection.cpp index 16a056308838..2c71768e45ca 100644 --- a/Source/WebKit/Platform/IPC/Connection.cpp +++ b/Source/WebKit/Platform/IPC/Connection.cpp @@ -797,8 +797,6 @@ auto Connection::waitForSyncReply(SyncRequestID syncRequestID, MessageName messa { timeout = timeoutRespectingIgnoreTimeoutsForTesting(timeout); - willSendSyncMessage(sendSyncOptions); - bool timedOut = false; while (!timedOut) { // First, check if we have any messages that we need to process. @@ -814,16 +812,12 @@ auto Connection::waitForSyncReply(SyncRequestID syncRequestID, MessageName messa ASSERT_UNUSED(syncRequestID, pendingSyncReply.syncRequestID == syncRequestID); // We found the sync reply. - if (pendingSyncReply.didReceiveReply) { - didReceiveSyncReply(sendSyncOptions); + if (pendingSyncReply.didReceiveReply) return { WTFMove(pendingSyncReply.replyDecoder) }; - } // The connection was closed. - if (!m_shouldWaitForSyncReplies) { - didReceiveSyncReply(sendSyncOptions); + if (!m_shouldWaitForSyncReplies) return Error::InvalidConnection; - } } // Processing a sync message could cause the connection to be invalidated. @@ -832,7 +826,6 @@ auto Connection::waitForSyncReply(SyncRequestID syncRequestID, MessageName messa // any more incoming messages. if (!isValid()) { RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Connection no longer valid, id=%" PRIu64, syncRequestID.toUInt64()); - didReceiveSyncReply(sendSyncOptions); return Error::InvalidConnection; } @@ -848,8 +841,6 @@ auto Connection::waitForSyncReply(SyncRequestID syncRequestID, MessageName messa RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Timed-out while waiting for reply for %s, id=%" PRIu64, description(messageName), syncRequestID.toUInt64()); #endif - didReceiveSyncReply(sendSyncOptions); - return Error::Timeout; } diff --git a/Source/WebKit/Platform/IPC/Connection.h b/Source/WebKit/Platform/IPC/Connection.h index c63bbe26d54a..fcff8198af95 100644 --- a/Source/WebKit/Platform/IPC/Connection.h +++ b/Source/WebKit/Platform/IPC/Connection.h @@ -85,11 +85,9 @@ enum class SendOption : uint8_t { }; enum class SendSyncOption : uint8_t { - // Use this to inform that this sync call will suspend this process until the user responds with input. - InformPlatformProcessWillSuspend = 1 << 0, - UseFullySynchronousModeForTesting = 1 << 1, - ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply = 1 << 2, - MaintainOrderingWithAsyncMessages = 1 << 3, + UseFullySynchronousModeForTesting = 1 << 0, + ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply = 1 << 1, + MaintainOrderingWithAsyncMessages = 1 << 2, }; enum class WaitForOption { @@ -530,9 +528,6 @@ private: void enqueueIncomingMessage(std::unique_ptr<Decoder>) WTF_REQUIRES_LOCK(m_incomingMessagesLock); size_t incomingMessagesDispatchingBatchSize() const; - void willSendSyncMessage(OptionSet<SendSyncOption>); - void didReceiveSyncReply(OptionSet<SendSyncOption>); - Timeout timeoutRespectingIgnoreTimeoutsForTesting(Timeout) const; #if PLATFORM(COCOA) @@ -899,6 +894,4 @@ private: static std::atomic<unsigned> unboundedSynchronousIPCCount; }; -void AccessibilityProcessSuspendedNotification(bool suspended); - } // namespace IPC diff --git a/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm b/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm index ee92a85292d2..f6ef30eb4717 100644 --- a/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm +++ b/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm @@ -49,25 +49,9 @@ #if PLATFORM(IOS_FAMILY) #import "ProcessAssertion.h" -#import <UIKit/UIAccessibility.h> -#if USE(APPLE_INTERNAL_SDK) -#import <AXRuntime/AXDefines.h> -#import <AXRuntime/AXNotificationConstants.h> -#else -#define kAXPidStatusChangedNotification 0 #endif -#endif - -#if PLATFORM(MAC) - -#import "ApplicationServicesSPI.h" - -extern "C" AXError _AXUIElementNotifyProcessSuspendStatus(AXSuspendStatus); - -#endif // PLATFORM(MAC) - namespace IPC { static const size_t inlineMessageMaxSize = 4096; @@ -590,29 +574,6 @@ bool Connection::kill() return false; } -void AccessibilityProcessSuspendedNotification(bool suspended) -{ -#if PLATFORM(MAC) - _AXUIElementNotifyProcessSuspendStatus(suspended ? AXSuspendStatusSuspended : AXSuspendStatusRunning); -#elif PLATFORM(IOS_FAMILY) - UIAccessibilityPostNotification(kAXPidStatusChangedNotification, @{ @"pid" : @(getpid()), @"suspended" : @(suspended) }); -#else - UNUSED_PARAM(suspended); -#endif -} - -void Connection::willSendSyncMessage(OptionSet<SendSyncOption> sendSyncOptions) -{ - if (sendSyncOptions.contains(IPC::SendSyncOption::InformPlatformProcessWillSuspend) && WebCore::AXObjectCache::accessibilityEnabled()) - AccessibilityProcessSuspendedNotification(true); -} - -void Connection::didReceiveSyncReply(OptionSet<SendSyncOption> sendSyncOptions) -{ - if (sendSyncOptions.contains(IPC::SendSyncOption::InformPlatformProcessWillSuspend) && WebCore::AXObjectCache::accessibilityEnabled()) - AccessibilityProcessSuspendedNotification(false); -} - pid_t Connection::remoteProcessID() const { if (!m_xpcConnection) diff --git a/Source/WebKit/Platform/cocoa/CocoaImage.mm b/Source/WebKit/Platform/cocoa/CocoaImage.mm index 3eb9b1da2fe8..1ed30df7f6c9 100644 --- a/Source/WebKit/Platform/cocoa/CocoaImage.mm +++ b/Source/WebKit/Platform/cocoa/CocoaImage.mm @@ -34,6 +34,8 @@ #import <CoreServices/CoreServices.h> #endif +#import <ImageIO/ImageIO.h> + namespace WebKit { RetainPtr<NSData> transcode(CGImageRef image, CFStringRef typeIdentifier) diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h index 2bd7da136dc9..091d04a805e0 100644 --- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h +++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h @@ -1106,6 +1106,7 @@ typedef NS_ENUM(NSUInteger, _UIScrollDeviceCategory) { - (UIScrollView *)_scroller; - (CGPoint)accessibilityConvertPointFromSceneReferenceCoordinates:(CGPoint)point; - (CGRect)accessibilityConvertRectToSceneReferenceCoordinates:(CGRect)rect; +- (void)accessibilityRelayNotification:(NSString *)notificationName notificationData:(NSData *)notificationData; - (UIRectEdge)_edgesApplyingSafeAreaInsetsToContentInset; @end diff --git a/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in b/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in index 83c72bc44783..b6a5d6b52246 100644 --- a/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in +++ b/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in @@ -927,7 +927,6 @@ (extension "com.apple.webkit.extension.mach") (global-name "com.apple.frontboard.systemappservices" - "com.apple.iphone.axserver-systemwide" "com.apple.mobileassetd.v2" "com.apple.mobilegestalt.xpc"))) diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm index 9d67dcaf22c9..ef84f288960c 100644 --- a/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm +++ b/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm @@ -253,7 +253,7 @@ void WebProcessProxy::unblockAccessibilityServerIfNeeded() Vector<SandboxExtension::Handle> handleArray; #if PLATFORM(IOS_FAMILY) - handleArray = SandboxExtension::createHandlesForMachLookup({ "com.apple.iphone.axserver-systemwide"_s, "com.apple.frontboard.systemappservices"_s }, auditToken(), SandboxExtension::MachBootstrapOptions::EnableMachBootstrap); + handleArray = SandboxExtension::createHandlesForMachLookup({ "com.apple.frontboard.systemappservices"_s }, auditToken(), SandboxExtension::MachBootstrapOptions::EnableMachBootstrap); #endif send(Messages::WebProcess::UnblockServicesRequiredByAccessibility(handleArray), 0); diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h index e5ceb5446e23..1d0859e9dc00 100644 --- a/Source/WebKit/UIProcess/PageClient.h +++ b/Source/WebKit/UIProcess/PageClient.h @@ -346,6 +346,9 @@ public: virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) = 0; virtual WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) = 0; virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0; +#if PLATFORM(IOS_FAMILY) + virtual void relayAccessibilityNotification(const String&, RetainPtr<NSData>) = 0; +#endif #if PLATFORM(MAC) virtual WebCore::IntRect rootViewToWindow(const WebCore::IntRect&) = 0; #endif diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h index fbc563943004..7e496d9b14d9 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.h +++ b/Source/WebKit/UIProcess/WebPageProxy.h @@ -2397,6 +2397,9 @@ private: void rootViewToScreen(const WebCore::IntRect& viewRect, CompletionHandler<void(const WebCore::IntRect&)>&&); void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, CompletionHandler<void(WebCore::IntPoint)>&&); void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, CompletionHandler<void(WebCore::IntRect)>&&); +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(const String&, const IPC::DataReference&); +#endif void runBeforeUnloadConfirmPanel(WebCore::FrameIdentifier, FrameInfoData&&, const String& message, CompletionHandler<void(bool)>&&); void didChangeViewportProperties(const WebCore::ViewportAttributes&); void pageDidScroll(const WebCore::IntPoint&); diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in index 8670a5cd09d9..0d325d864cd2 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in @@ -53,6 +53,9 @@ messages -> WebPageProxy { RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) Synchronous AccessibilityScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) Synchronous RootViewToAccessibilityScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) Synchronous +#if PLATFORM(IOS_FAMILY) + RelayAccessibilityNotification(String notificationName, IPC::DataReference notificationData) +#endif #if PLATFORM(COCOA) || PLATFORM(GTK) ShowValidationMessage(WebCore::IntRect anchorRect, String message) diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h index d564769b4eb6..2886f12e2208 100644 --- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h +++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h @@ -113,6 +113,7 @@ private: WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override; WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) override; WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) override; + void relayAccessibilityNotification(const String&, RetainPtr<NSData>) override; void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override; #if ENABLE(TOUCH_EVENTS) void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm index a5d22fb2ded1..e3ecd2061719 100644 --- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm +++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm @@ -453,7 +453,14 @@ IntPoint PageClientImpl::accessibilityScreenToRootView(const IntPoint& point) rootViewPoint = [contentView accessibilityConvertPointFromSceneReferenceCoordinates:rootViewPoint]; return IntPoint(rootViewPoint); } - + +void PageClientImpl::relayAccessibilityNotification(const String& notificationName, RetainPtr<NSData> notificationData) +{ + auto contentView = this->contentView(); + if ([contentView respondsToSelector:@selector(accessibilityRelayNotification:notificationData:)]) + [contentView accessibilityRelayNotification:notificationName notificationData:notificationData.get()]; +} + IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect) { CGRect rootViewRect = rect; diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm index ea5afc0edd5a..79970f89a144 100644 --- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm +++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm @@ -776,6 +776,13 @@ void WebPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference pageClient().accessibilityWebProcessTokenReceived(data); } + +void WebPageProxy::relayAccessibilityNotification(const String& notificationName, const IPC::DataReference& data) +{ + NSData *notificationData = [NSData dataWithBytes:data.data() length:data.size()]; + pageClient().relayAccessibilityNotification(notificationName, notificationData); +} + void WebPageProxy::assistiveTechnologyMakeFirstResponder() { pageClient().assistiveTechnologyMakeFirstResponder(); diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp index 6318c5b65ec0..7c86e4a3cde8 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -161,6 +161,24 @@ namespace WebKit { using namespace WebCore; using namespace HTMLNames; +AXRelayProcessSuspendedNotification::AXRelayProcessSuspendedNotification(Ref<WebPage> page, AutomaticallySend automaticallySend) + : m_page(page) + , m_automaticallySend(automaticallySend) +{ + if (m_automaticallySend == AutomaticallySend::Yes) + sendProcessSuspendMessage(true); +} + +AXRelayProcessSuspendedNotification::~AXRelayProcessSuspendedNotification() +{ + if (m_automaticallySend == AutomaticallySend::Yes) + sendProcessSuspendMessage(false); +} + +#if !PLATFORM(COCOA) +void AXRelayProcessSuspendedNotification::sendProcessSuspendMessage(bool) { } +#endif + WebChromeClient::WebChromeClient(WebPage& page) : m_page(page) { @@ -322,7 +340,7 @@ Page* WebChromeClient::createWindow(LocalFrame& frame, const WindowFeatures& win auto webFrame = WebFrame::fromCoreFrame(frame); - auto sendResult = webProcess.parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(webFrame->info(), webFrame->page()->webPageProxyIdentifier(), navigationAction.resourceRequest(), windowFeatures, navigationActionData), page().identifier(), IPC::Timeout::infinity(), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages, IPC::SendSyncOption::InformPlatformProcessWillSuspend }); + auto sendResult = webProcess.parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(webFrame->info(), webFrame->page()->webPageProxyIdentifier(), navigationAction.resourceRequest(), windowFeatures, navigationActionData), page().identifier(), IPC::Timeout::infinity(), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages }); if (!sendResult.succeeded()) return nullptr; @@ -457,7 +475,10 @@ bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, LocalFr HangDetectionDisabler hangDetectionDisabler; - auto sendResult = protectedPage()->sendSyncWithDelayedReply(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(webFrame->frameID(), webFrame->info(), message), IPC::SendSyncOption::InformPlatformProcessWillSuspend); + auto page = protectedPage(); + auto relay = AXRelayProcessSuspendedNotification(page); + + auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(webFrame->frameID(), webFrame->info(), message)); auto [shouldClose] = sendResult.takeReplyOr(false); return shouldClose; } @@ -505,7 +526,9 @@ void WebChromeClient::runJavaScriptAlert(LocalFrame& frame, const String& alertT HangDetectionDisabler hangDetectionDisabler; IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; - page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), webFrame->info(), alertText), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages, IPC::SendSyncOption::InformPlatformProcessWillSuspend }); + auto relay = AXRelayProcessSuspendedNotification(page); + + page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), webFrame->info(), alertText), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages }); } bool WebChromeClient::runJavaScriptConfirm(LocalFrame& frame, const String& message) @@ -524,7 +547,9 @@ bool WebChromeClient::runJavaScriptConfirm(LocalFrame& frame, const String& mess HangDetectionDisabler hangDetectionDisabler; IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; - auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), webFrame->info(), message), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages, IPC::SendSyncOption::InformPlatformProcessWillSuspend }); + auto relay = AXRelayProcessSuspendedNotification(page); + + auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), webFrame->info(), message), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages }); auto [result] = sendResult.takeReplyOr(false); return result; } @@ -545,7 +570,9 @@ bool WebChromeClient::runJavaScriptPrompt(LocalFrame& frame, const String& messa HangDetectionDisabler hangDetectionDisabler; IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; - auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), webFrame->info(), message, defaultValue), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages, IPC::SendSyncOption::InformPlatformProcessWillSuspend }); + auto relay = AXRelayProcessSuspendedNotification(page); + + auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), webFrame->info(), message, defaultValue), { IPC::SendSyncOption::MaintainOrderingWithAsyncMessages }); if (!sendResult.succeeded()) return false; @@ -778,9 +805,11 @@ void WebChromeClient::print(LocalFrame& frame, const StringWithDirection& title) #endif auto truncatedTitle = truncateFromEnd(title, maxTitleLength); + auto page = protectedPage(); + auto relay = AXRelayProcessSuspendedNotification(page); IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; - protectedPage()->sendSyncWithDelayedReply(Messages::WebPageProxy::PrintFrame(webFrame->frameID(), truncatedTitle.string, pdfFirstPageSize), IPC::SendSyncOption::InformPlatformProcessWillSuspend); + page->sendSyncWithDelayedReply(Messages::WebPageProxy::PrintFrame(webFrame->frameID(), truncatedTitle.string, pdfFirstPageSize)); } void WebChromeClient::reachedMaxAppCacheSize(int64_t) @@ -800,7 +829,9 @@ void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin& origin, if (!cacheStorage.calculateQuotaForOrigin(origin, currentQuota)) return; - auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(origin.data().databaseIdentifier(), currentQuota, totalBytesNeeded), IPC::SendSyncOption::InformPlatformProcessWillSuspend); + auto relay = AXRelayProcessSuspendedNotification(page); + + auto sendResult = page->sendSyncWithDelayedReply(Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(origin.data().databaseIdentifier(), currentQuota, totalBytesNeeded)); auto [newQuota] = sendResult.takeReplyOr(0); cacheStorage.storeUpdatedQuotaForOrigin(&origin, newQuota); diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h index c8c287c5ad62..932d303889a4 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h @@ -52,6 +52,10 @@ public: WebPage& page() const { return m_page.get(); } Ref<WebPage> protectedPage() const; +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(const String&, RetainPtr<NSData>) const final; +#endif + private: void chromeDestroyed() final; @@ -496,4 +500,17 @@ private: CheckedRef<WebPage> m_page; }; +class AXRelayProcessSuspendedNotification { +public: + enum class AutomaticallySend : bool { No, Yes }; + + explicit AXRelayProcessSuspendedNotification(Ref<WebPage>, AutomaticallySend = AutomaticallySend::Yes); + ~AXRelayProcessSuspendedNotification(); + + void sendProcessSuspendMessage(bool suspended); +private: + CheckedRef<WebPage> m_page; + AutomaticallySend m_automaticallySend; +}; + } // namespace WebKit diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClientCocoa.mm b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClientCocoa.mm index 4413010349e8..ea4ac074fd2c 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClientCocoa.mm +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClientCocoa.mm @@ -29,8 +29,18 @@ #if PLATFORM(COCOA) #import "WebIconUtilities.h" +#import "WebPage.h" +#import <WebCore/AXObjectCache.h> #import <WebCore/Icon.h> +#if PLATFORM(MAC) + +#import "ApplicationServicesSPI.h" + +extern "C" AXError _AXUIElementNotifyProcessSuspendStatus(AXSuspendStatus); + +#endif // PLATFORM(MAC) + namespace WebKit { using namespace WebCore; @@ -39,6 +49,20 @@ RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames return Icon::create(iconForFiles(filenames).get()); } +void AXRelayProcessSuspendedNotification::sendProcessSuspendMessage(bool suspended) +{ + if (!AXObjectCache::accessibilityEnabled()) + return; + +#if PLATFORM(MAC) + _AXUIElementNotifyProcessSuspendStatus(suspended ? AXSuspendStatusSuspended : AXSuspendStatusRunning); +#else + NSDictionary *message = @{ @"pid" : @(getpid()), @"suspended" : @(suspended) }; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:message requiringSecureCoding:YES error:nil]; + m_page->relayAccessibilityNotification("AXProcessSuspended"_s, data); +#endif +} + } // namespace WebKit #endif // PLATFORM(COCOA) diff --git a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm index f75d0c11764b..77d242d196ba 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm +++ b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm @@ -179,6 +179,11 @@ bool WebChromeClient::showDataDetectorsUIForElement(const Element& element, cons return true; } +void WebChromeClient::relayAccessibilityNotification(const String& notificationName, RetainPtr<NSData> notificationData) const +{ + return protectedPage()->relayAccessibilityNotification(notificationName, notificationData); +} + } // namespace WebKit #endif // PLATFORM(IOS_FAMILY) diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp index 3cace16bf6bd..7f3c7b954452 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp @@ -7896,7 +7896,10 @@ WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(WebCore::DOMPaste // should be removed once <rdar://problem/16207002> is resolved. preemptivelySendAutocorrectionContext(); #endif - auto sendResult = sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess(pasteAccessCategory, rectForElementAtInteractionLocation(), originIdentifier), IPC::SendSyncOption::InformPlatformProcessWillSuspend); + + AXRelayProcessSuspendedNotification(*this); + + auto sendResult = sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess(pasteAccessCategory, rectForElementAtInteractionLocation(), originIdentifier)); auto [response] = sendResult.takeReplyOr(WebCore::DOMPasteAccessResponse::DeniedForGesture); return response; } diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h index 3b09a2144b59..bceb2cd479b5 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit/WebProcess/WebPage/WebPage.h @@ -773,6 +773,9 @@ public: WebCore::IntRect rootViewToScreen(const WebCore::IntRect&); WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&); WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&); +#if PLATFORM(IOS_FAMILY) + void relayAccessibilityNotification(const String&, RetainPtr<NSData>); +#endif RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions); diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm index 205a166b8bb4..07db0b8e9f50 100644 --- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm +++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm @@ -256,6 +256,14 @@ RetainPtr<NSData> WebPage::accessibilityRemoteTokenData() const return newAccessibilityRemoteToken([NSUUID UUID]); } +void WebPage::relayAccessibilityNotification(const String& notificationName, RetainPtr<NSData> notificationData) +{ + IPC::DataReference dataToken = { }; AG: do you need to explicitly initialize IPC::DataReference, I would think that the constructor would do it for you. + if ([notificationData length]) + dataToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([notificationData bytes]), [notificationData length]); + send(Messages::WebPageProxy::RelayAccessibilityNotification(notificationName, dataToken)); +} + static void computeEditableRootHasContentAndPlainText(const VisibleSelection& selection, EditorState::PostLayoutData& data) { data.hasContent = false; diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp index 42e2adcaa28b..c9fc6ad24d43 100644 --- a/Source/WebKit/WebProcess/WebProcess.cpp +++ b/Source/WebKit/WebProcess/WebProcess.cpp @@ -52,6 +52,7 @@ #include "WebBadgeClient.h" #include "WebBroadcastChannelRegistry.h" #include "WebCacheStorageProvider.h" +#include "WebChromeClient.h" #include "WebConnectionToUIProcess.h" #include "WebCookieJar.h" #include "WebCoreArgumentCoders.h" @@ -686,7 +687,8 @@ void WebProcess::setIsInProcessCache(bool isInProcessCache) updateProcessName(IsInProcessInitialization::No); - IPC::AccessibilityProcessSuspendedNotification(isInProcessCache); + if (auto* webPage = focusedWebPage()) + AXRelayProcessSuspendedNotification(*webPage, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(isInProcessCache); AG: do we need to notify of suspended process only for the focused page? Wonder if VO holding a reference to an object in a page that is no longer focused is waiting for a response. #else UNUSED_PARAM(isInProcessCache); #endif @@ -1615,7 +1617,8 @@ void WebProcess::prepareToSuspend(bool isSuspensionImminent, MonotonicTime estim #endif #if PLATFORM(IOS_FAMILY) - IPC::AccessibilityProcessSuspendedNotification(true); + if (auto* webPage = focusedWebPage()) + AXRelayProcessSuspendedNotification(*webPage, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(true); updateFreezerStatus(); #endif @@ -1680,7 +1683,8 @@ void WebProcess::processDidResume() #endif #if PLATFORM(IOS_FAMILY) - IPC::AccessibilityProcessSuspendedNotification(false); + if (auto* webPage = focusedWebPage()) + AXRelayProcessSuspendedNotification(*webPage, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(false); #endif #if ENABLE(VIDEO)
chris fleizach
Comment 7 2023-10-12 07:09:38 PDT
- IPC::AccessibilityProcessSuspendedNotification(isInProcessCache); + if (auto* webPage = focusedWebPage()) + AXRelayProcessSuspendedNotification(*webPage, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(isInProcessCache); AG: do we need to notify of suspended process only for the focused page? Wonder if VO holding a reference to an object in a page that is no longer focused is waiting for a response. CF: As long as these pages are in the same process, it doesn't matter. On the other side, it will just get the pid() and send that to clients
Andres Gonzalez
Comment 8 2023-10-12 07:37:44 PDT
(In reply to chris fleizach from comment #7) > - IPC::AccessibilityProcessSuspendedNotification(isInProcessCache); > + if (auto* webPage = focusedWebPage()) > + AXRelayProcessSuspendedNotification(*webPage, > AXRelayProcessSuspendedNotification::AutomaticallySend::No). > sendProcessSuspendMessage(isInProcessCache); > > AG: do we need to notify of suspended process only for the focused page? > Wonder if VO holding a reference to an object in a page that is no longer > focused is waiting for a response. > > > CF: As long as these pages are in the same process, it doesn't matter. On > the other side, it will just get the pid() and send that to clients AG: can we then just use any page in m_pageMap. Concerned that auto* webPage = focusedWebPage() may be null, in which case we won't send the notification, correct? Plus that it would save the trouble of determining the focused page. But if you still want to use the focused page if it is exists, fallback to any page if it doesn't have a focused one.
chris fleizach
Comment 9 2023-10-12 07:50:53 PDT
chris fleizach
Comment 10 2023-10-12 23:59:09 PDT
Andres Gonzalez
Comment 11 2023-10-13 04:38:27 PDT
(In reply to chris fleizach from comment #10) > Created attachment 468200 [details] > Patch +void WebProcess::accessibilityRelayProcessSuspended(bool suspended) +{ + if (m_pageMap.isEmpty()) + return; + + // Take the first webpage. We only need to have the process on the other side relay this for the WebProcess. + auto* webPage = m_pageMap.values().begin().get()->get(); + AXRelayProcessSuspendedNotification(*webPage, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(suspended); AG: AXRelayProcessSuspendedNotification(*m_pageMap.begin().value, AXRelayProcessSuspendedNotification::AutomaticallySend::No).sendProcessSuspendMessage(suspended); +} No need to r? again.
chris fleizach
Comment 12 2023-10-13 09:34:27 PDT
Comment on attachment 468200 [details] Patch this WPE crashing seems unrelated to me
EWS
Comment 13 2023-10-13 10:29:00 PDT
Committed 269308@main (fc59e6e527ce): <https://commits.webkit.org/269308@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 468200 [details].
Note You need to log in before you can comment on or make changes to this bug.