Bug 1807639: Null check `ancestor` before creating a Pivot r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D165923
This commit is contained in:
Morgan Rae Reschenberg 2023-01-04 21:33:59 +00:00
Родитель 6bb5ab0abd
Коммит 2dcebc6f8b
1 изменённых файлов: 11 добавлений и 6 удалений

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

@ -753,12 +753,17 @@ Relation RemoteAccessibleBase<Derived>::RelationByType(
while (ancestor && ancestor->Role() != roles::FORM && ancestor != mDoc) {
ancestor = ancestor->RemoteParent();
}
Pivot p = Pivot(ancestor);
PivotRadioNameRule rule(name);
Accessible* match = p.Next(ancestor, rule);
while (match) {
rel.AppendTarget(match->AsRemote());
match = p.Next(match, rule);
if (ancestor) {
// Sometimes we end up with an unparented acc here, potentially
// because the acc is being moved. See bug 1807639.
// Pivot expects to be created with a non-null mRoot.
Pivot p = Pivot(ancestor);
PivotRadioNameRule rule(name);
Accessible* match = p.Next(ancestor, rule);
while (match) {
rel.AppendTarget(match->AsRemote());
match = p.Next(match, rule);
}
}
return rel;
}