summaryrefslogtreecommitdiffstats
path: root/accessible/generic/HyperTextAccessible.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/generic/HyperTextAccessible.cpp')
-rw-r--r--accessible/generic/HyperTextAccessible.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp
index 943ac63c1c..b5102fa514 100644
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -776,6 +776,17 @@ LayoutDeviceIntRect HyperTextAccessible::GetCaretRect(nsIWidget** aWidget) {
void HyperTextAccessible::GetSelectionDOMRanges(SelectionType aSelectionType,
nsTArray<nsRange*>* aRanges) {
+ if (IsDoc() && !AsDoc()->HasLoadState(DocAccessible::eTreeConstructed)) {
+ // Rarely, a client query can be handled after a DocAccessible is created
+ // but before the initial tree is constructed, since DoInitialUpdate happens
+ // during a refresh tick. In that case, there might be a DOM selection, but
+ // we can't use it. We will crash if we try due to mContent being null, etc.
+ // This should only happen in the parent process because we should never
+ // try to push the cache in a content process before the initial tree is
+ // constructed.
+ MOZ_ASSERT(XRE_IsParentProcess(), "Query before DoInitialUpdate");
+ return;
+ }
// Ignore selection if it is not visible.
RefPtr<nsFrameSelection> frameSelection = FrameSelection();
if (!frameSelection || frameSelection->GetDisplaySelection() <=