We didn't do defunct checks previously, but it seems the methods we were calling were safe on defunct accessibles.
Now that retrieving the accessible returns null once it's shut down, we need to explicitly null check it.
Differential Revision: https://phabricator.services.mozilla.com/D114197
In 1513447 there is a demonstrated instance in which the generated
marker is replaced with another one and throws the list item bullet
state into an unknown state. To remedy this we need to observe when such
elements are removed and added.
Instead of that, I opted to finally make the bullet accessible a real
content-backed accessible. This should help with other issues that pop
up when the list item overrides children management and keeps an
artificial accessible as its first child.
Differential Revision: https://phabricator.services.mozilla.com/D110719
1. ia2AccessibleApplication is instantiated for ApplicationAccessible, so it now inherits from MsaaAccessible.
2. ia2AccessibleHypertext is instantiated for HyperTextAccessible, so it now inherits from MsaaAccessible.
3. ia2AccessibleImage is instantiated for ImageAccessible, so it inherits from MsaaAccessible.
4. ia2AccessibleTable is instantiated for TableAccessible, so it inherits from ia2AccessibleHypertext (since most TableAccessible implementations implement HyperTextAccessible).
5. ia2AccessibleTableCell is instantiated for TableCellAccessible, so it inherits from ia2AccessibleHypertext (since most TableCellAccessible implementations implement HyperTextAccessible).
6. All of the above override QueryInterface as appropriate, replacing the QueryInterface implementations from all *AccessibleWrap classes.
7. The ARIAGridAccessibleWrap, HTMLTableAccessibleWrap, ImageAccessibleWrap, XULListboxAccessibleWrap and XULTreeGridAccessibleWrap classes previously served only to host ia2AccessibleImage, ia2AccessibleTable, etc. Since these ia2 classes are now instantiated via MsaaAccessible, these Wrap classes have been removed and replaced with aliases.
8. The QueryInterface handling for ISimpleDOMText has been moved into MsaaAccessible. Since this was the only purpose of TextLeafAccessibleWrap, this too has been removed and replaced with an alias.
9. AccessibleWrap now holds a strong reference to MsaaAccessible and MsaaAccessible holds a weak reference to AccessibleWrap.
10. An MsaaAccessible (or derived class) is instantiated by MsaaAccessible::Create.
11. MsaaAccessible now implements its own COM reference counting using DECL_IUNKNOWN, since it does not need nsISupports (XPCOM).
Differential Revision: https://phabricator.services.mozilla.com/D112956
Until now, our a11y COM implementation has relied on AddRef and Release from nsISupports, but this soon won't be possible.
Instead, MsaaAccessible will implement its own reference counting using DECL_IUNKNOWN.
DECL_IUNKNOWN previously declared AddRef and Release as final.
This doesn't work for MsaaAccessible because there is an aggregatable subclass (MsaaRootAccessible) and because some subclasses will inherit additional interfaces (ia2AccessibleApplication, etc.).
When subclasses inherit additional interfaces, they inherit an additional IUnknown, so the compiler doesn't know which AddRef/Release to call.
To support this, IMPL_IUNKNOWN_REFCOUNTING_INHERITED HAS BEEN ADDED to specify which base class implements reference counting.
Differential Revision: https://phabricator.services.mozilla.com/D112954
These objects need to aggregate the primary COM object (MsaaAccessible).
Once the IUnknown implementation moves out of AccessibleWrap, it won't be possible to aggregate *AccessibleWrap any more.
Differential Revision: https://phabricator.services.mozilla.com/D112949
Rather than static_casting `this`, there is now an ImageAcc/TextAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than `this`, rather than direct static_casting, MsaaAccessible::GetFrom is used.
ia2AccessibleText was calling AccessibleWrap::ConvertToIA2Attributes, but this is actually declared in ia2Accessible, so we just add the necessary include and change the call.
Finally, calls to HyperTextProxyFor() in ia2AccessibleEditableText/Hypertext/Text assertions were replaced with calls to LocalAccessible::IsProxy(), since HyperTextProxyFor statically asserts the inheritance we're removing and isn't otherwise useful.
Differential Revision: https://phabricator.services.mozilla.com/D112942
This is necessary to enable COM objects which aggregate AccessibleWrap/DocAccessibleWrap to aggregate MsaaAccessible/MsaaDocAccessible instead.
Ultimately, the IUnknown implementation will be moved out of AccessibleWrap altogether and into MsaaAccessible, but we can't do that yet.
Even though MsaaDocAccessible indirectly inherits from MsaaAccessible, we have to override QueryInterface due to the naming conflict with nsISupports.
Differential Revision: https://phabricator.services.mozilla.com/D112948
For now, XULMenuitemAccessibleWrap inherits from MsaaXULMenuitemAccessible and MsaaXULMenuitemAccessible inherits from XULMenuitemAccessible.
Accessible calls are made via MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D112947
For now, RootAccessibleWrap inherits from MsaaRootAccessible and MsaaRootAccessible inherits from RootAccessible.
RootAccessible calls are made via a RootAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D112946
For now, DocAccessibleWrap inherits from MsaaDocAccessible and MsaaDocAccessible inherits from DocAccessible.
DocAccessible calls are made via a DocAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D112945
For now, ApplicationAccessibleWrap inherits from the new class.
ApplicationAccessible calls are made via an AppAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D112944
For now, we can't use MsaaAccessible::LocalAcc() because these are inherited into multiple Wrap classes, but we don't know which at runtime.
However, we can still prepare by creating a Table/CellAcc() method which can be easily replaced once we kill the Wrap inheritance.
For LocalAccessibles other than `this`, rather than static_casting, GetNativeInterface is now used.
Differential Revision: https://phabricator.services.mozilla.com/D112943
Rather than static_casting `this`, there is now a LocalAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than `this`, rather than static_casting, GetNativeInterface is now used.
ia2AccessibleValue::QueryInterface was adjusted to AddRef the queried interface on `this`, not the AccessibleWrap.
Finally, calls to HyperTextProxyFor() in ia2AccessibleHyperlink assertions were replaced with calls to LocalAccessible::IsProxy(), since HyperTextProxyFor statically asserts the inheritance we're removing and isn't otherwise useful.
Differential Revision: https://phabricator.services.mozilla.com/D112941
Once MsaaAccessible is no longer inherited into AccessibleWrap, we'll null the AccessibleWrap pointer when the AccessibleWrap shuts down.
At that point, MsaaAccessible won't deal with defunct AccessibleWraps.
Prepare for this by removing defunct special cases from most callers.
To allow for this, the assertion in IsDefunct() had to be changed to allow null mContent when IsProxy() is true.
Otherwise, calling IsDefunct() on a live RemoteAccessibleWrap asserts.
It seems we previously never called IsDefunct() in this case, but this patch now does due to the call to LocalAcc() in GetIAccessibleFor().
Differential Revision: https://phabricator.services.mozilla.com/D112940
For now, we can't use MsaaAccessible::LocalAcc() because these are inherited into multiple Wrap classes, but we don't know which at runtime.
However, we can still prepare by creating a Table/CellAcc() method which can be easily replaced once we kill the Wrap inheritance.
For LocalAccessibles other than `this`, rather than static_casting, GetNativeInterface is now used.
Differential Revision: https://phabricator.services.mozilla.com/D112943
Rather than static_casting `this`, there is now an ImageAcc/TextAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than `this`, rather than static_casting, GetNativeInterface is now used.
ia2AccessibleText was calling AccessibleWrap::ConvertToIA2Attributes, but this is actually declared in ia2Accessible, so we just add the necessary include and change the call.
Finally, calls to HyperTextProxyFor() in ia2AccessibleEditableText/Hypertext/Text assertions were replaced with calls to LocalAccessible::IsProxy(), since HyperTextProxyFor statically asserts the inheritance we're removing and isn't otherwise useful.
Differential Revision: https://phabricator.services.mozilla.com/D112942
Rather than static_casting `this`, there is now a LocalAcc() method which in turn calls MsaaAccessible::LocalAcc().
Since MsaaAccessible::LocalAcc() returns null if defunct, defunct checks have been adjusted accordingly.
For LocalAccessibles other than `this`, rather than static_casting, GetNativeInterface is now used.
ia2AccessibleValue::QueryInterface was adjusted to AddRef the queried interface on `this`, not the AccessibleWrap.
Finally, calls to HyperTextProxyFor() in ia2AccessibleHyperlink assertions were replaced with calls to LocalAccessible::IsProxy(), since HyperTextProxyFor statically asserts the inheritance we're removing and isn't otherwise useful.
Differential Revision: https://phabricator.services.mozilla.com/D112941
Once MsaaAccessible is no longer inherited into AccessibleWrap, we'll null the AccessibleWrap pointer when the AccessibleWrap shuts down.
At that point, MsaaAccessible won't deal with defunct AccessibleWraps.
Prepare for this by removing defunct special cases from most callers.
To allow for this, the assertion in IsDefunct() had to be changed to allow null mContent when IsProxy() is true.
Otherwise, calling IsDefunct() on a live RemoteAccessibleWrap asserts.
It seems we previously never called IsDefunct() in this case, but this patch now does due to the call to LocalAcc() in GetIAccessibleFor().
Differential Revision: https://phabricator.services.mozilla.com/D112940
This simply adds the new MsaaAccessible class, moves the inheritance of ia2Accessible, etc. to that class, and makes AccessibleWrap inherit from MsaaAccessible.
Differential Revision: https://phabricator.services.mozilla.com/D112932
Currently, we use a weak symbol to call atk_bridge_adaptor_init, but for
some reason, this stops working when removing the mozgtk stub library
(which we can do now that we don't need gtk+2 support at all), in a way
similar to bug 1368363.
We've been using a weak symbol because atk-bridge 2.0 was not guaranteed
to be enabled in gtk+3 back when this was added, but things have changed
since then, and gtk+3 always requires atk-bridge 2.0... ... on X11.
Unfortunately, that's not the case on Wayland, and a gtk+3 built with
Wayland support only will not depend on atk-bridge 2.0. So all in all,
we're back to square one, and because this fails to build, we need
another approach.
It turns out that other approach was in place for gtk+2, in the form of
dlopen/dlsym, the code for which somehow survived the years despite
Firefox not actually using gtk+2 for accessibility.
So we repurpose that code to load atk-bridge 2.0, which also happens to
not be a gtk+3 module, so we can remove the whole code path that tries to
load it from the gtk-3.0/modules path.
Differential Revision: https://phabricator.services.mozilla.com/D111996
This test checks accessibility properties of a non-native context menu and sends
synthetic keyboard events to it.
With native context menus, accessibility and keyboard interaction are handled
natively and cannot be tested, so this test can be disabled in that configuration.
Differential Revision: https://phabricator.services.mozilla.com/D112107
This test has a part where it expects AXMenuOpened events for context menus, which are not observable for us when native context menus are used.
It also has a part where it inspects the accessibility-exposed contents of a context menu. This is not testable with native context menus either, so that part of the test needs to be disabled.
Differential Revision: https://phabricator.services.mozilla.com/D112122