From 5c4d387874c18b4494b9f6ea5fa27d6cac12adb3 Mon Sep 17 00:00:00 2001 From: Sandor Molnar Date: Wed, 5 Jun 2024 00:43:46 +0300 Subject: [PATCH] Backed out changeset 718208a40b89 (bug 1888310) for causing mochitest failures @ browser_app.js CLOSED TREE --- accessible/mac/mozAccessible.mm | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 5cf9b9879ab1..0609cc7afcbd 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -879,13 +879,10 @@ struct RoleDescrComparator { // a random acc with the same ID) by checking: // - The gecko acc is local, our a11y-announcement lives in browser.xhtml // - The ID of the gecko acc is "a11y-announcement" - // - The native acc is a direct descendent of the chrome window (ChildView in - // a non-headless context, mozRootAccessible in a headless context). + // - The native acc is a direct descendent of the root if (mGeckoAccessible->IsLocal() && [[self moxDOMIdentifier] isEqualToString:@"a11y-announcement"] && - ((gfxPlatform::IsHeadless() && - [[self moxParent] isKindOfClass:[mozRootAccessible class]]) || - [[self moxParent] isKindOfClass:[ChildView class]])) { + [[self moxParent] isKindOfClass:[mozRootAccessible class]]) { // Our actual announcement should be stored as a child of the alert, // so we verify a child exists, and then query that child below. NSArray* children = [self moxChildren]; @@ -899,24 +896,23 @@ struct RoleDescrComparator { } else { key = [announcement moxTitle]; } + NSDictionary* info = @{ NSAccessibilityAnnouncementKey : key ? key : @(""), - // High priority means VO will stop what it is currently speaking - // to speak our announcement. - NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) + NSAccessibilityPriorityKey : @(NSAccessibilityPriorityMedium) }; + id window = [self moxWindow]; + // This sends events via nsIObserverService to be consumed by our // mochitests. Normally we'd fire these events through moxPostNotification - // which takes care of this, but because NSApp isn't derived - // from MOXAccessibleBase, we do this (and post the notification) manually. - // We used to fire this on the window, but per Chrome and Safari these - // notifs get dropped if fired on any non-main window. We now fire on NSApp - // to avoid this. + // which takes care of this, but because the window we fetch above isn't + // derrived from MOXAccessibleBase, we do this (and post the notification) + // manually. xpcAccessibleMacEvent::FireEvent( - NSApp, NSAccessibilityAnnouncementRequestedNotification, info); + window, NSAccessibilityAnnouncementRequestedNotification, info); NSAccessibilityPostNotificationWithUserInfo( - NSApp, NSAccessibilityAnnouncementRequestedNotification, info); + window, NSAccessibilityAnnouncementRequestedNotification, info); } }