From fcea19dfd2c426bac0456da850e7c12258e4b9eb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 17:11:26 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- accessible/generic/HyperTextAccessible.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'accessible/generic/HyperTextAccessible.cpp') 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* 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 frameSelection = FrameSelection(); if (!frameSelection || frameSelection->GetDisplaySelection() <= -- cgit v1.2.3