Bug 1786519 - Null check BrowserParent's element and its owner doc. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D155729
This commit is contained in:
Eitan Isaacson 2022-08-30 23:04:14 +00:00
Родитель d50c882977
Коммит ebe08f86d0
1 изменённых файлов: 9 добавлений и 4 удалений

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

@ -283,10 +283,15 @@ RefPtr<SessionAccessibility> SessionAccessibility::GetInstanceFor(
bp = static_cast<dom::BrowserParent*>(
aAccessible->AsRemote()->Document()->Manager());
}
nsPresContext* presContext =
bp->GetOwnerElement()->OwnerDoc()->GetPresContext();
if (presContext) {
return GetInstanceFor(presContext->PresShell());
if (auto element = bp->GetOwnerElement()) {
if (auto doc = element->OwnerDoc()) {
if (nsPresContext* presContext = doc->GetPresContext()) {
return GetInstanceFor(presContext->PresShell());
}
} else {
MOZ_ASSERT_UNREACHABLE(
"Browser parent's element does not have owner doc.");
}
}
}