summaryrefslogtreecommitdiffstats
path: root/accessible/base/DocManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/base/DocManager.cpp')
-rw-r--r--accessible/base/DocManager.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/accessible/base/DocManager.cpp b/accessible/base/DocManager.cpp
index b7a5203e40..18bf9c0433 100644
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -17,6 +17,7 @@
# include "Logging.h"
#endif
+#include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/PresShell.h"
@@ -464,7 +465,18 @@ DocAccessible* DocManager::CreateDocOrRootAccessible(Document* aDocument) {
// XXXaaronl: ideally we would traverse the presshell chain. Since there's
// no easy way to do that, we cheat and use the document hierarchy.
parentDocAcc = GetDocAccessible(aDocument->GetInProcessParentDocument());
- NS_ASSERTION(parentDocAcc, "Can't create an accessible for the document!");
+ // We should always get parentDocAcc except sometimes for background
+ // extension pages, where the parent has an invisible DocShell but the child
+ // does not. See bug 1888649.
+ NS_ASSERTION(
+ parentDocAcc ||
+ (BasePrincipal::Cast(aDocument->GetPrincipal())->AddonPolicy() &&
+ aDocument->GetInProcessParentDocument() &&
+ aDocument->GetInProcessParentDocument()->GetDocShell() &&
+ aDocument->GetInProcessParentDocument()
+ ->GetDocShell()
+ ->IsInvisible()),
+ "Can't create an accessible for the document!");
if (!parentDocAcc) return nullptr;
}