commit 6e5eee6e934cbcee7391dbc8fc3b7fd8fad32a46 parent 8288fc9244a29d10ccfd3d5af5630a4012383347 Author: Serban Stanca <sstanca@mozilla.com> Date: Wed, 15 Oct 2025 22:39:21 +0300 Revert "Bug 1994030 - P2: Expose aria-actions via accessibilityCustomActions. r=morgan" for causing leakcheck failures. This reverts commit 981fe3517406ea1708b2bbf3a1172f1f670e64ac. This reverts commit 632fdf0841deb7b9407d91d4a2c05f0bdbeb7950. This reverts commit 93dfc5ab873d5a4b28cdd9dbfc7ca239426d2477. This reverts commit e1fd97aa19fc94ebe1ac8a6aa7e5119651fad502. This reverts commit 78703903abbf1c0ebc4b833dee0d46f0b3d2524d. This reverts commit 9de5df00a5ebee8a62b4995d4c5dfbc8f2aa927a. Diffstat:
30 files changed, 53 insertions(+), 446 deletions(-)
diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp @@ -305,9 +305,16 @@ static uint16_t CreateMaiInterfaces(Accessible* aAccessible) { interfaces |= 1 << MAI_INTERFACE_SELECTION; } - // XXX: Always include the action interface because aria-actions - // can define actions mid-life. - interfaces |= 1 << MAI_INTERFACE_ACTION; + if (aAccessible->IsRemote()) { + if (aAccessible->IsActionable()) { + interfaces |= 1 << MAI_INTERFACE_ACTION; + } + } else { + // XXX: Harmonize this with remote accessibles + if (aAccessible->ActionCount()) { + interfaces |= 1 << MAI_INTERFACE_ACTION; + } + } return interfaces; } diff --git a/accessible/atk/nsMaiInterfaceAction.cpp b/accessible/atk/nsMaiInterfaceAction.cpp @@ -10,7 +10,6 @@ #include "nsMai.h" #include "mozilla/Likely.h" #include "nsAccessibilityService.h" -#include "Relation.h" #include "RemoteAccessible.h" #include "nsString.h" @@ -21,29 +20,8 @@ extern "C" { static gboolean doActionCB(AtkAction* aAction, gint aActionIndex) { AtkObject* atkObject = ATK_OBJECT(aAction); - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return false; - } - - if (aActionIndex < acc->ActionCount()) { - acc->DoAction(aActionIndex); - return true; - } - - // Check for custom actions. - Relation customActions(acc->RelationByType(RelationType::ACTION)); - gint actionIndex = acc->ActionCount(); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - MOZ_ASSERT(target->ActionCount() > 0); - if (actionIndex == aActionIndex) { - target->DoAction(0); - return true; - } - actionIndex++; - } + if (Accessible* acc = GetInternalObj(atkObject)) { + return acc->DoAction(aActionIndex); } return false; @@ -51,52 +29,19 @@ static gboolean doActionCB(AtkAction* aAction, gint aActionIndex) { static gint getActionCountCB(AtkAction* aAction) { AtkObject* atkObject = ATK_OBJECT(aAction); - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return 0; - } - - gint actionCount = acc->ActionCount(); - Relation customActions(acc->RelationByType(RelationType::ACTION)); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - actionCount++; - } + if (Accessible* acc = GetInternalObj(atkObject)) { + return acc->ActionCount(); } - return actionCount; + return 0; } static const gchar* getActionDescriptionCB(AtkAction* aAction, gint aActionIndex) { AtkObject* atkObject = ATK_OBJECT(aAction); nsAutoString description; - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return 0; - } - - if (aActionIndex < acc->ActionCount()) { + if (Accessible* acc = GetInternalObj(atkObject)) { acc->ActionDescriptionAt(aActionIndex, description); - } else { - // Check for custom actions. - Relation customActions(acc->RelationByType(RelationType::ACTION)); - gint actionIndex = acc->ActionCount(); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - MOZ_ASSERT(target->ActionCount() > 0); - if (actionIndex == aActionIndex) { - target->ActionDescriptionAt(0, description); - break; - } - actionIndex++; - } - } - } - - if (!description.IsEmpty()) { return AccessibleWrap::ReturnString(description); } @@ -105,71 +50,10 @@ static const gchar* getActionDescriptionCB(AtkAction* aAction, static const gchar* getActionNameCB(AtkAction* aAction, gint aActionIndex) { AtkObject* atkObject = ATK_OBJECT(aAction); - nsAutoString name; - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return 0; - } - - if (aActionIndex < acc->ActionCount()) { - acc->ActionNameAt(aActionIndex, name); - } else { - // Check for custom actions. - Relation customActions(acc->RelationByType(RelationType::ACTION)); - gint actionIndex = acc->ActionCount(); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - MOZ_ASSERT(target->ActionCount() > 0); - if (actionIndex == aActionIndex) { - name.AssignLiteral("custom"); - nsAutoString domNodeId; - target->DOMNodeID(domNodeId); - if (!domNodeId.IsEmpty()) { - name.AppendPrintf("_%s", NS_ConvertUTF16toUTF8(domNodeId).get()); - } - break; - } - actionIndex++; - } - } - } - - if (!name.IsEmpty()) { - return AccessibleWrap::ReturnString(name); - } - - return nullptr; -} - -static const gchar* getActionLocalizedNameCB(AtkAction* aAction, - gint aActionIndex) { - AtkObject* atkObject = ATK_OBJECT(aAction); - nsAutoString name; - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return 0; - } - - if (aActionIndex >= acc->ActionCount()) { - // Check for custom actions. - Relation customActions(acc->RelationByType(RelationType::ACTION)); - gint actionIndex = acc->ActionCount(); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - MOZ_ASSERT(target->ActionCount() > 0); - if (actionIndex == aActionIndex) { - target->Name(name); - break; - } - actionIndex++; - } - } - } - - if (!name.IsEmpty()) { - return AccessibleWrap::ReturnString(name); + nsAutoString autoStr; + if (Accessible* acc = GetInternalObj(atkObject)) { + acc->ActionNameAt(aActionIndex, autoStr); + return AccessibleWrap::ReturnString(autoStr); } return nullptr; @@ -196,5 +80,4 @@ void actionInterfaceInitCB(AtkActionIface* aIface) { aIface->get_description = getActionDescriptionCB; aIface->get_keybinding = getKeyBindingCB; aIface->get_name = getActionNameCB; - aIface->get_localized_name = getActionLocalizedNameCB; } diff --git a/accessible/base/ARIAMap.cpp b/accessible/base/ARIAMap.cpp @@ -1447,7 +1447,6 @@ struct AttrCharacteristics { static const AttrCharacteristics gWAIUnivAttrMap[] = { // clang-format off - {nsGkAtoms::aria_actions, ATTR_BYPASSOBJ | ATTR_GLOBAL | ATTR_REFLECT_ELEMENTS }, {nsGkAtoms::aria_activedescendant, ATTR_BYPASSOBJ }, {nsGkAtoms::aria_atomic, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL }, {nsGkAtoms::aria_busy, ATTR_VALTOKEN | ATTR_GLOBAL }, diff --git a/accessible/base/AccTypes.h b/accessible/base/AccTypes.h @@ -86,9 +86,10 @@ enum AccGenericType { eTableRow = 1 << 13, eText = 1 << 14, eNumericValue = 1 << 15, - eDPub = 1 << 16, + eActionable = 1 << 16, // This is for remote accessibles + eDPub = 1 << 17, - eLastAccGenericType = eDPub, + eLastAccGenericType = eActionable, eAllGenericTypes = (eLastAccGenericType << 1) - 1 }; diff --git a/accessible/base/CacheConstants.h b/accessible/base/CacheConstants.h @@ -95,8 +95,6 @@ static constexpr RelationData kRelationTypeAtoms[] = { RelationType::DETAILS_FOR}, {nsGkAtoms::aria_errormessage, nullptr, RelationType::ERRORMSG, RelationType::ERRORMSG_FOR}, - {nsGkAtoms::aria_actions, nullptr, RelationType::ACTION, - RelationType::ACTION_FOR}, }; // The count of numbers needed to serialize an nsRect. This is used when diff --git a/accessible/base/RelationTypeMap.h b/accessible/base/RelationTypeMap.h @@ -88,9 +88,3 @@ RELATIONTYPE(ERRORMSG_FOR, "error for", ATK_RELATION_ERROR_FOR, RELATIONTYPE(LINKS_TO, "links to", ATK_RELATION_NULL, NAVRELATION_LINKS_TO, IA2_RELATION_NULL) - -RELATIONTYPE(ACTION, "action", ATK_RELATION_NULL, NAVRELATION_ACTION, - IA2_RELATION_NULL) - -RELATIONTYPE(ACTION_FOR, "action for", ATK_RELATION_NULL, - NAVRELATION_ACTION_FOR, IA2_RELATION_NULL) diff --git a/accessible/basetypes/Accessible.h b/accessible/basetypes/Accessible.h @@ -603,6 +603,8 @@ class Accessible { bool IsSelect() const { return HasGenericType(eSelect); } + bool IsActionable() const { return HasGenericType(eActionable); } + bool IsText() const { return mGenericTypes & eText; } bool IsImage() const { return mType == eImageType; } @@ -778,15 +780,6 @@ class Accessible { */ virtual int32_t GetLevel(bool aFast) const; - /** - * Return true if accessible has a primary action directly related to it, like - * "click", "activate", "press", "jump", "open", "close", etc. A non-primary - * action would be a complementary one like "showlongdesc". - * If an accessible has an action that is associated with an ancestor, it is - * not a primary action either. - */ - virtual bool HasPrimaryAction() const = 0; - protected: // Some abstracted group utility methods. @@ -821,6 +814,15 @@ class Accessible { const Accessible* ActionAncestor() const; /** + * Return true if accessible has a primary action directly related to it, like + * "click", "activate", "press", "jump", "open", "close", etc. A non-primary + * action would be a complementary one like "showlongdesc". + * If an accessible has an action that is associated with an ancestor, it is + * not a primary action either. + */ + virtual bool HasPrimaryAction() const = 0; + + /** * Apply states which are implied by other information common to both * LocalAccessible and RemoteAccessible. */ diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp @@ -68,8 +68,7 @@ static nsStaticAtom* const kRelationAttrs[] = { nsGkAtoms::aria_controls, nsGkAtoms::aria_flowto, nsGkAtoms::aria_errormessage, nsGkAtoms::_for, nsGkAtoms::control, nsGkAtoms::popovertarget, - nsGkAtoms::commandfor, nsGkAtoms::aria_activedescendant, - nsGkAtoms::aria_actions}; + nsGkAtoms::commandfor, nsGkAtoms::aria_activedescendant}; static const uint32_t kRelationAttrsLen = std::size(kRelationAttrs); diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp @@ -1516,8 +1516,7 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID, if (aAttribute == nsGkAtoms::aria_controls || aAttribute == nsGkAtoms::aria_flowto || - aAttribute == nsGkAtoms::aria_errormessage || - aAttribute == nsGkAtoms::aria_actions) { + aAttribute == nsGkAtoms::aria_errormessage) { mDoc->QueueCacheUpdate(this, CacheDomain::Relations); } @@ -2434,14 +2433,6 @@ Relation LocalAccessible::RelationByType(RelationType aType) const { return Relation( new RelatedAccIterator(mDoc, mContent, nsGkAtoms::aria_errormessage)); - case RelationType::ACTION: - return Relation(new AssociatedElementsIterator(mDoc, mContent, - nsGkAtoms::aria_actions)); - - case RelationType::ACTION_FOR: - return Relation( - new RelatedAccIterator(mDoc, mContent, nsGkAtoms::aria_actions)); - default: return Relation(); } diff --git a/accessible/interfaces/nsIAccessibleMacInterface.idl b/accessible/interfaces/nsIAccessibleMacInterface.idl @@ -58,14 +58,8 @@ interface nsIAccessibleMacInterface : nsISupports jsval getParameterizedAttributeValue(in AString attributeName, in jsval parameter); /** - * Gets a description of the specified action. - * Emulates `AXUIElementCopyActionDescription`. - */ - AString getActionDescription(in AString actionName); - - /** * Requests that the accessibility object perform the specified action. - * Emulates `AXUIElementPerformAction`. + * Emulatets `AXUIElementPerformAction`. */ void performAction(in AString actionName); diff --git a/accessible/interfaces/nsIAccessibleRelation.idl b/accessible/interfaces/nsIAccessibleRelation.idl @@ -161,16 +161,6 @@ interface nsIAccessibleRelation : nsISupports const unsigned long RELATION_LINKS_TO = 0x19; /** - * This object is has an action associated with the target object. - */ - const unsigned long RELATION_ACTION = 0x20; - - /** - * This object is has an action that operates on the target object. - */ - const unsigned long RELATION_ACTION_FOR = 0x21; - - /** * Returns the type of the relation. */ readonly attribute unsigned long relationType; diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp @@ -51,6 +51,18 @@ AccessibleData DocAccessibleChild::SerializeAcc(LocalAccessible* aAcc) { // XXX: We need to do this because this requires a state check. genericTypes |= eNumericValue; } + if (aAcc->IsTextLeaf() || aAcc->IsImage()) { + // Ideally, we'd set eActionable for any Accessible with an ancedstor + // action. However, that requires an ancestor walk which is too expensive + // here. eActionable is only used by ATK. For now, we only expose ancestor + // actions on text leaf and image Accessibles. This means that we don't + // support "clickAncestor" for ATK. + if (aAcc->ActionCount()) { + genericTypes |= eActionable; + } + } else if (aAcc->HasPrimaryAction()) { + genericTypes |= eActionable; + } RefPtr<AccAttributes> fields; // Even though we send moves as a hide and a show, we don't want to diff --git a/accessible/ipc/RemoteAccessible.h b/accessible/ipc/RemoteAccessible.h @@ -390,8 +390,6 @@ class RemoteAccessible : public Accessible, public HyperTextAccessibleBase { virtual bool IsPopover() const override; - virtual bool HasPrimaryAction() const override; - #if !defined(XP_WIN) void Announce(const nsString& aAnnouncement, uint16_t aPriority); #endif // !defined(XP_WIN) @@ -494,6 +492,9 @@ class RemoteAccessible : public Accessible, public HyperTextAccessibleBase { virtual void GetPositionAndSetSize(int32_t* aPosInSet, int32_t* aSetSize) override; + + virtual bool HasPrimaryAction() const override; + nsAtom* GetPrimaryAction() const; virtual nsTArray<int32_t>& GetCachedHyperTextOffsets() override; diff --git a/accessible/mac/MOXAccessibleBase.h b/accessible/mac/MOXAccessibleBase.h @@ -79,9 +79,6 @@ inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) { - (id)accessibilityFocusedUIElement; // override, final -- (NSArray*)accessibilityCustomActions; - -// override, final - (BOOL)isAccessibilityElement; // final @@ -100,9 +97,6 @@ inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) { - (id)moxFocusedUIElement; // override -- (NSArray*)moxCustomActions; - -// override - (void)moxPostNotification:(NSString*)notification; // override diff --git a/accessible/mac/MOXAccessibleBase.mm b/accessible/mac/MOXAccessibleBase.mm @@ -390,12 +390,6 @@ mozilla::LogModule* GetMacAccessibilityLog() { NS_OBJC_END_TRY_BLOCK_RETURN(nil); } -- (id)accessibilityCustomActions { - NS_OBJC_BEGIN_TRY_BLOCK_RETURN; - return [self moxCustomActions]; - NS_OBJC_END_TRY_BLOCK_RETURN(nil); -} - - (BOOL)isAccessibilityElement { NS_OBJC_BEGIN_TRY_BLOCK_RETURN; @@ -592,10 +586,6 @@ mozilla::LogModule* GetMacAccessibilityLog() { return nil; } -- (NSArray*)moxCustomActions { - return nil; -} - #pragma mark - Private - (BOOL)isSelectorSupported:(SEL)selector { diff --git a/accessible/mac/MOXAccessibleProtocol.h b/accessible/mac/MOXAccessibleProtocol.h @@ -25,9 +25,6 @@ // Forwarded from accessibilityFocusedUIElement. - (id _Nullable)moxFocusedUIElement; -// Retrieve a list of custom actions. -- (NSArray* _Nullable)moxCustomActions; - // Sends a notification to any observing assistive applications. - (void)moxPostNotification:(NSString* _Nonnull)notification; diff --git a/accessible/mac/mozAccessible.h b/accessible/mac/mozAccessible.h @@ -188,9 +188,6 @@ enum CheckedState { - (NSArray*)moxCustomContent; // override -- (NSArray*)moxCustomActions; - -// override - (NSNumber*)moxEnabled; // override diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm @@ -580,35 +580,6 @@ static bool ProvidesTitle(const Accessible* aAccessible, nsString& aName) { NS_OBJC_END_TRY_BLOCK_RETURN(nil); } -- (NSArray*)moxCustomActions { - if (@available(macOS 13.0, *)) { - NSMutableArray<NSAccessibilityCustomAction*>* customActions = - [[[NSMutableArray alloc] init] autorelease]; - Relation relatedActions( - mGeckoAccessible->RelationByType(RelationType::ACTION)); - while (Accessible* target = relatedActions.Next()) { - if (target->HasPrimaryAction()) { - // Any ACTION related accesibles should be considered a custom action. - mozAccessible* nativeTarget = GetNativeFromGeckoAccessible(target); - if (nativeTarget) { - nsAutoString name; - // Use the name of the target as the action name. - target->Name(name); - NSAccessibilityCustomAction* action = - [[NSAccessibilityCustomAction alloc] - initWithName:nsCocoaUtils::ToNSString(name) - target:nativeTarget - selector:@selector(moxPerformPress)]; - [customActions addObject:action]; - } - } - } - return customActions; - } - - return nil; -} - - (NSWindow*)moxWindow { NS_OBJC_BEGIN_TRY_BLOCK_RETURN; diff --git a/accessible/mac/mozAccessibleProtocol.h b/accessible/mac/mozAccessibleProtocol.h @@ -45,8 +45,6 @@ // currently focused UI element (possibly a child accessible) - (id)accessibilityFocusedUIElement; -- (NSArray*)accessibilityCustomActions; - /*** attributes ***/ // all supported attributes diff --git a/accessible/tests/browser/atk/a11y_setup.py b/accessible/tests/browser/atk/a11y_setup.py @@ -21,22 +21,11 @@ pyatspiFile = subprocess.check_output( ), encoding="utf-8", ).rstrip() -giFile = subprocess.check_output( - ( - os.path.join(sys.base_prefix, "bin", "python3"), - "-c", - "import gi; print(gi.__file__)", - ), - encoding="utf-8", -).rstrip() sys.path.append(os.path.dirname(os.path.dirname(pyatspiFile))) -sys.path.append(os.path.dirname(os.path.dirname(giFile))) import pyatspi sys.path.pop() -sys.path.pop() del pyatspiFile -del giFile def setup(): diff --git a/accessible/tests/browser/atk/browser.toml b/accessible/tests/browser/atk/browser.toml @@ -13,8 +13,6 @@ prefs = [ "security.allow_eval_with_system_principal=true" ] -["browser_action.js"] - ["browser_atspi_interfaces.js"] ["browser_groupPosition.js"] diff --git a/accessible/tests/browser/atk/browser_action.js b/accessible/tests/browser/atk/browser_action.js @@ -1,90 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -/** - * Test basic press action. - */ -addAccessibleTask( - ` -<button id="btn" onclick="this.textContent = 'Clicked'">Click me</button> - `, - async function () { - const actions = await runPython(` - global doc - doc = getDoc() - global btn - btn = findByDomId(doc, "btn").queryAction() - return str([[btn.getName(i), btn.getLocalizedName(i), btn.getDescription(i)] for i in range(btn.get_nActions())]) - `); - is(actions, "[['press', '', 'Press']]", "btn has correct actions"); - - const nameChanged = waitForEvent(EVENT_NAME_CHANGE, "btn"); - await runPython(` - btn.doAction(0) - `); - await nameChanged; - } -); - -/** - * Test aria-actions. - */ -addAccessibleTask( - ` - <div id="container"> - <dialog aria-actions="btn1" id="dlg1" open> - Hello - <form method="dialog"> - <button id="btn1">Close</button> - </form> - </dialog> - <dialog aria-actions="btn2" id="dlg2" onclick="" open> - Dialog with its own click listener - <form method="dialog"> - <button id="btn2">Close</button> - </form> - </dialog> - </div>`, - async function () { - let actions = await runPython(` - global doc - doc = getDoc() - global dlg1 - dlg1 = findByDomId(doc, "dlg1").queryAction() - return str([[dlg1.getName(i), dlg1.getLocalizedName(i), dlg1.getDescription(i)] for i in range(dlg1.get_nActions())]) - `); - is( - actions, - "[['custom_btn1', 'Close', 'Press']]", - "dlg1 has correct actions" - ); - - let reorder = waitForEvent(EVENT_REORDER, "container"); - await runPython(` - dlg1.doAction(0) - `); - await reorder; - - // Test dialog with its own click listener, and therefore has the aria-actions - // target actions appended to its own actions. - actions = await runPython(` - global dlg2 - dlg2 = findByDomId(doc, "dlg2").queryAction() - return str([[dlg2.getName(i), dlg2.getLocalizedName(i), dlg2.getDescription(i)] for i in range(dlg2.get_nActions())]) - `); - is( - actions, - "[['click', '', 'Click'], ['custom_btn2', 'Close', 'Press']]", - "dlg2 has correct actions" - ); - - reorder = waitForEvent(EVENT_REORDER, "container"); - await runPython(` - dlg2.doAction(1) - `); - await reorder; - } -); diff --git a/accessible/tests/browser/atk/browser_atspi_interfaces.js b/accessible/tests/browser/atk/browser_atspi_interfaces.js @@ -31,7 +31,6 @@ addAccessibleTask( await checkInterfaces("p", [ "Accessible", - "Action", "Collection", "Component", "EditableText", @@ -51,7 +50,6 @@ addAccessibleTask( ]); await checkInterfaces("range_input", [ "Accessible", - "Action", "Collection", "Component", "Hyperlink", diff --git a/accessible/tests/browser/mac/browser.toml b/accessible/tests/browser/mac/browser.toml @@ -47,8 +47,6 @@ skip-if = ["os == 'mac' && os_version == '15.30' && arch == 'aarch64' && opt"] # ["browser_combobox.js"] -["browser_custom_actions.js"] - ["browser_description.js"] ["browser_details_summary.js"] diff --git a/accessible/tests/browser/mac/browser_custom_actions.js b/accessible/tests/browser/mac/browser_custom_actions.js @@ -1,39 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -/* import-globals-from ../../mochitest/role.js */ -/* import-globals-from ../../mochitest/states.js */ -loadScripts( - { name: "role.js", dir: MOCHITESTS_DIR }, - { name: "states.js", dir: MOCHITESTS_DIR } -); - -// Test custom action -addAccessibleTask( - `<div id="container"> - <dialog aria-actions="btn" id="dlg" open> - Hello - <form method="dialog"> - <button id="btn">Close</button> - </form> - </dialog> - </div>`, - async (browser, accDoc) => { - let dialog = getNativeInterface(accDoc, "dlg"); - let actionNames = dialog.actionNames; - let customAction = actionNames.find(name => name.startsWith("Name:Close")); - ok(!!customAction, "Dialog should have a custom action"); - is( - dialog.getActionDescription(customAction), - "Close", - "Correct action description" - ); - - const reorder = waitForEvent(EVENT_REORDER, "container"); - dialog.performAction(customAction); - await reorder; - } -); diff --git a/accessible/tests/browser/relations/browser_relations_general.js b/accessible/tests/browser/relations/browser_relations_general.js @@ -20,7 +20,6 @@ const attrRelationsSpec = [ ["aria-flowto", RELATION_FLOWS_TO, RELATION_FLOWS_FROM], ["aria-details", RELATION_DETAILS, RELATION_DETAILS_FOR], ["aria-errormessage", RELATION_ERRORMSG, RELATION_ERRORMSG_FOR], - ["aria-actions", RELATION_ACTION, RELATION_ACTION_FOR], ]; /** diff --git a/accessible/tests/mochitest/relations.js b/accessible/tests/mochitest/relations.js @@ -31,8 +31,6 @@ const RELATION_DETAILS_FOR = nsIAccessibleRelation.RELATION_DETAILS_FOR; const RELATION_ERRORMSG = nsIAccessibleRelation.RELATION_ERRORMSG; const RELATION_ERRORMSG_FOR = nsIAccessibleRelation.RELATION_ERRORMSG_FOR; const RELATION_LINKS_TO = nsIAccessibleRelation.RELATION_LINKS_TO; -const RELATION_ACTION = nsIAccessibleRelation.RELATION_ACTION; -const RELATION_ACTION_FOR = nsIAccessibleRelation.RELATION_ACTION_FOR; // ////////////////////////////////////////////////////////////////////////////// // General diff --git a/accessible/windows/msaa/MsaaAccessible.h b/accessible/windows/msaa/MsaaAccessible.h @@ -185,9 +185,7 @@ class MsaaAccessible : public ia2Accessible, NAVRELATION_DETAILS_FOR = 0x1016, NAVRELATION_ERROR = 0x1017, NAVRELATION_ERROR_FOR = 0x1018, - NAVRELATION_LINKS_TO = 0x1019, - NAVRELATION_ACTION = 0x1020, - NAVRELATION_ACTION_FOR = 0x1021 + NAVRELATION_LINKS_TO = 0x1019 }; private: diff --git a/accessible/xpcom/xpcAccessibleMacInterface.mm b/accessible/xpcom/xpcAccessibleMacInterface.mm @@ -90,13 +90,6 @@ xpcAccessibleMacInterface::GetParameterizedAttributeNames( NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE) } -// Return a string that uniquely identifies a custom action. -static NSString* GetCustomActionName(NSAccessibilityCustomAction* action) { - return [NSString stringWithFormat:@"Name:%@ Target:%@ Selector:%@", - [action name], [action target], - NSStringFromSelector([action selector])]; -} - NS_IMETHODIMP xpcAccessibleMacInterface::GetActionNames(nsTArray<nsString>& aActionNames) { NS_OBJC_BEGIN_TRY_BLOCK_RETURN @@ -111,51 +104,12 @@ xpcAccessibleMacInterface::GetActionNames(nsTArray<nsString>& aActionNames) { aActionNames.AppendElement(actionName); } - if (NSArray* customActions = [mNativeObject accessibilityCustomActions]) { - for (id action in customActions) { - nsAutoString actionName; - NSString* actionNameStr = GetCustomActionName(action); - nsCocoaUtils::GetStringForNSString(actionNameStr, actionName); - aActionNames.AppendElement(actionName); - } - } - return NS_OK; NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE) } NS_IMETHODIMP -xpcAccessibleMacInterface::GetActionDescription(const nsAString& aActionName, - nsAString& aDescription) { - aDescription.Truncate(); - - if (!mNativeObject || [mNativeObject isExpired]) { - return NS_ERROR_NOT_AVAILABLE; - } - - NSString* actionName = nsCocoaUtils::ToNSString(aActionName); - - // First search custom actions, since `accessibilityActionDescription` will - // just return the provided name if no description is found. - if (NSArray* customActions = [mNativeObject accessibilityCustomActions]) { - for (id action in customActions) { - NSString* actionNameStr = GetCustomActionName(action); - if ([actionNameStr isEqualToString:actionName]) { - nsCocoaUtils::GetStringForNSString([action name], aDescription); - return NS_OK; - } - } - } - - NSString* description = - [mNativeObject accessibilityActionDescription:actionName]; - nsCocoaUtils::GetStringForNSString(description, aDescription); - - return NS_OK; -} - -NS_IMETHODIMP xpcAccessibleMacInterface::PerformAction(const nsAString& aActionName) { NS_OBJC_BEGIN_TRY_BLOCK_RETURN @@ -164,19 +118,6 @@ xpcAccessibleMacInterface::PerformAction(const nsAString& aActionName) { } NSString* actionName = nsCocoaUtils::ToNSString(aActionName); - - // First search custom actions, since `accessibilityPerformAction` will - // silently fail on unknown action names. - if (NSArray* customActions = [mNativeObject accessibilityCustomActions]) { - for (id action in customActions) { - NSString* actionNameStr = GetCustomActionName(action); - if ([actionNameStr isEqualToString:actionName]) { - [[action target] performSelector:[action selector]]; - return NS_OK; - } - } - } - [mNativeObject accessibilityPerformAction:actionName]; return NS_OK; diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py @@ -119,7 +119,6 @@ STATIC_ATOMS = [ Atom("archive", "archive"), Atom("area", "area"), Atom("aria", "aria"), - Atom("aria_actions", "aria-actions"), Atom("aria_activedescendant", "aria-activedescendant"), Atom("aria_atomic", "aria-atomic"), Atom("aria_autocomplete", "aria-autocomplete"),