mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Bug 1793073: Ensure Accessible::IsTable can't return true if AsTable will return null. r=eeejay
These should never be out of sync. Previously, they could be out of sync for an ARIA table with display: contents, since we don't create an ARIAGridAccessible in that case (bug 1494196). While that incorrect creation is itself a bug that we should fix, I don't want to deal with that here. Instead, don't check ARIA generic types in Accessible::IsTable, only the class generic types, as we already do for IsTableCell. This fixes a crash in BundleFieldsForCache. In addition, while the crash is fixed by the above change, as an optimisation, BundleFieldsForCache now just calls AsTable instead of calling IsTable first, since the IsTable call is redundant. This second fix alone would be sufficient to fix the crash, but the first will catch other potential instances of this problem. Differential Revision: https://phabricator.services.mozilla.com/D158548
This commit is contained in:
parent
911e17ed60
commit
8a72400cf5
@ -455,12 +455,12 @@ class Accessible {
|
||||
* classes to use for accessible object creation. However, an invalid table
|
||||
* structure might cause these classes not to be used after all.
|
||||
*
|
||||
* To make sure we're really dealing with a table cell, only check the
|
||||
* To make sure we're really dealing with a table/cell, only check the
|
||||
* generic type defined by the class, not the type defined in the ARIA map.
|
||||
*/
|
||||
bool IsTableCell() const { return mGenericTypes & eTableCell; }
|
||||
|
||||
bool IsTable() const { return HasGenericType(eTable); }
|
||||
bool IsTable() const { return mGenericTypes & eTable; }
|
||||
|
||||
bool IsHyperText() const { return HasGenericType(eHyperText); }
|
||||
|
||||
|
@ -3493,8 +3493,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
||||
}
|
||||
|
||||
if (aCacheDomain & CacheDomain::Table) {
|
||||
if (IsTable()) {
|
||||
TableAccessible* table = AsTable();
|
||||
if (TableAccessible* table = AsTable()) {
|
||||
if (table->IsProbablyLayoutTable()) {
|
||||
fields->SetAttribute(nsGkAtoms::layout_guess, true);
|
||||
} else if (aUpdateType == CacheUpdateType::Update) {
|
||||
|
@ -415,3 +415,30 @@ addAccessibleTask(
|
||||
remoteIframe: isCacheEnabled,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test the handling of ARIA tables with display: contents.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<div id="table" role="table" style="display: contents;">
|
||||
<div role="row"><div role="cell">a</div></div>
|
||||
</div>
|
||||
`,
|
||||
async function(browser, docAcc) {
|
||||
// XXX We don't create a TableAccessible in this case (bug 1494196). For
|
||||
// now, just ensure we don't crash (bug 1793073).
|
||||
const table = findAccessibleChildByID(docAcc, "table");
|
||||
let queryOk = false;
|
||||
try {
|
||||
table.QueryInterface(nsIAccessibleTable);
|
||||
} catch (e) {}
|
||||
todo(queryOk, "Got nsIAccessibleTable");
|
||||
},
|
||||
{
|
||||
chrome: true,
|
||||
topLevel: isCacheEnabled,
|
||||
iframe: isCacheEnabled,
|
||||
remoteIframe: isCacheEnabled,
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user