Backed out changeset 718208a40b89 (bug 1888310) for causing mochitest failures @ browser_app.js CLOSED TREE

This commit is contained in:
Sandor Molnar 2024-06-05 00:43:46 +03:00
parent efc48100f0
commit 5c4d387874

View file

@ -879,13 +879,10 @@ struct RoleDescrComparator {
// a random acc with the same ID) by checking: // a random acc with the same ID) by checking:
// - The gecko acc is local, our a11y-announcement lives in browser.xhtml // - The gecko acc is local, our a11y-announcement lives in browser.xhtml
// - The ID of the gecko acc is "a11y-announcement" // - The ID of the gecko acc is "a11y-announcement"
// - The native acc is a direct descendent of the chrome window (ChildView in // - The native acc is a direct descendent of the root
// a non-headless context, mozRootAccessible in a headless context).
if (mGeckoAccessible->IsLocal() && if (mGeckoAccessible->IsLocal() &&
[[self moxDOMIdentifier] isEqualToString:@"a11y-announcement"] && [[self moxDOMIdentifier] isEqualToString:@"a11y-announcement"] &&
((gfxPlatform::IsHeadless() && [[self moxParent] isKindOfClass:[mozRootAccessible class]]) {
[[self moxParent] isKindOfClass:[mozRootAccessible class]]) ||
[[self moxParent] isKindOfClass:[ChildView class]])) {
// Our actual announcement should be stored as a child of the alert, // Our actual announcement should be stored as a child of the alert,
// so we verify a child exists, and then query that child below. // so we verify a child exists, and then query that child below.
NSArray* children = [self moxChildren]; NSArray* children = [self moxChildren];
@ -899,24 +896,23 @@ struct RoleDescrComparator {
} else { } else {
key = [announcement moxTitle]; key = [announcement moxTitle];
} }
NSDictionary* info = @{ NSDictionary* info = @{
NSAccessibilityAnnouncementKey : key ? key : @(""), NSAccessibilityAnnouncementKey : key ? key : @(""),
// High priority means VO will stop what it is currently speaking NSAccessibilityPriorityKey : @(NSAccessibilityPriorityMedium)
// to speak our announcement.
NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
}; };
id window = [self moxWindow];
// This sends events via nsIObserverService to be consumed by our // This sends events via nsIObserverService to be consumed by our
// mochitests. Normally we'd fire these events through moxPostNotification // mochitests. Normally we'd fire these events through moxPostNotification
// which takes care of this, but because NSApp isn't derived // which takes care of this, but because the window we fetch above isn't
// from MOXAccessibleBase, we do this (and post the notification) manually. // derrived from MOXAccessibleBase, we do this (and post the notification)
// We used to fire this on the window, but per Chrome and Safari these // manually.
// notifs get dropped if fired on any non-main window. We now fire on NSApp
// to avoid this.
xpcAccessibleMacEvent::FireEvent( xpcAccessibleMacEvent::FireEvent(
NSApp, NSAccessibilityAnnouncementRequestedNotification, info); window, NSAccessibilityAnnouncementRequestedNotification, info);
NSAccessibilityPostNotificationWithUserInfo( NSAccessibilityPostNotificationWithUserInfo(
NSApp, NSAccessibilityAnnouncementRequestedNotification, info); window, NSAccessibilityAnnouncementRequestedNotification, info);
} }
} }