Bug 1382568: Avoid trying to resolve styles in an uninitialized presshell in GetInnerText. r?heycam
MozReview-Commit-ID: DFFb5OCQpHG
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -3012,17 +3012,20 @@ IsOrHasAncestorWithDisplayNone(Element*
}
void
nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue,
mozilla::ErrorResult& aError)
{
if (!GetPrimaryFrame(FlushType::Layout)) {
nsIPresShell* presShell = nsComputedDOMStyle::GetPresShellForContent(this);
- if (!presShell || IsOrHasAncestorWithDisplayNone(this, presShell)) {
+ // NOTE(emilio): We need to check the presshell is styled in order to ensure
+ // the document is styled.
+ if (!presShell || !presShell->DidInitialize() ||
+ IsOrHasAncestorWithDisplayNone(this, presShell)) {
GetTextContentInternal(aValue, aError);
return;
}
}
nsRange::GetInnerTextNoFlush(aValue, aError, this, 0, this, GetChildCount());
}