Bug 1748775 - Expire column children when table expires. r=morgan

I think there is a potential crasher if an AT holds a reference to a column object while its parent table expires, and then tries to retrieve AXChildren. We need to expire te column objects when the table expires or is destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D136288
This commit is contained in:
Eitan Isaacson 2022-01-19 19:33:35 +00:00
Родитель 7346b0b19c
Коммит 035538614c
3 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -77,6 +77,9 @@
// override
- (void)dealloc;
// override
- (void)expire;
// override
- (NSNumber*)moxRowCount;

Просмотреть файл

@ -227,6 +227,11 @@ enum CachedBool { eCachedBoolMiss, eCachedTrue, eCachedFalse };
NS_OBJC_END_TRY_IGNORE_BLOCK;
}
- (void)expire {
[self invalidateColumns];
[super expire];
}
- (NSNumber*)moxRowCount {
MOZ_ASSERT(mGeckoAccessible);
@ -365,6 +370,9 @@ enum CachedBool { eCachedBoolMiss, eCachedTrue, eCachedFalse };
- (void)invalidateColumns {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
if (mColContainers) {
for (mozColumnContainer* col in mColContainers) {
[col expire];
}
[mColContainers release];
mColContainers = nil;
}

Просмотреть файл

@ -163,6 +163,22 @@ addAccessibleTask(
1,
"Last column has single child"
);
reorder = waitForEvent(
EVENT_REORDER,
e => e.accessible.role == ROLE_DOCUMENT
);
await SpecialPowers.spawn(browser, [], () => {
content.document.getElementById("customers").remove();
});
await reorder;
try {
cols[0].getAttributeValue("AXChildren");
ok(false, "Getting children from column of expired table should fail");
} catch (e) {
ok(true, "Getting children from column of expired table should fail");
}
}
);