Skip to content

Commit ec0aa56

Browse files
committed
Bug 1996506 - Don't climb above document in GetNonGenericParent. r=Jamie
Also don't allow climbing into local accessibles off main thread, and assert if we do. Differential Revision: https://phabricator.services.mozilla.com/D272729
1 parent 6d0b6a0 commit ec0aa56

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

accessible/basetypes/Accessible.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,11 +705,12 @@ class Accessible {
705705
}
706706

707707
/**
708-
* Returns the nearest ancestor which is not a generic element.
708+
* Returns the nearest ancestor in the document which is not a generic
709+
* element.
709710
*/
710711
Accessible* GetNonGenericParent() const {
711712
for (Accessible* parent = Parent(); parent; parent = parent->Parent()) {
712-
if (!parent->IsGeneric()) {
713+
if (parent->IsDoc() || !parent->IsGeneric()) {
713714
return parent;
714715
}
715716
}

accessible/ipc/DocAccessibleParent.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ class DocAccessibleParent : public RemoteAccessible,
233233
// Accessible
234234
virtual Accessible* Parent() const override {
235235
if (IsTopLevel()) {
236-
return OuterDocOfRemoteBrowser();
236+
if (NS_IsMainThread()) {
237+
return OuterDocOfRemoteBrowser();
238+
} else {
239+
MOZ_ASSERT_UNREACHABLE("Getting local parent off main thread!");
240+
return nullptr;
241+
}
237242
}
238243
return RemoteParent();
239244
}

0 commit comments

Comments
 (0)