diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 39be8f153b9c..bc641648b143 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -4704,12 +4704,15 @@ nsGenericElement::CanSkip(nsINode* aNode) } } - if (!foundBlack) { + if (!currentDoc || !foundBlack) { if (!gPurpleRoots) { gPurpleRoots = new nsAutoTArray(); } root->SetIsPurpleRoot(true); gPurpleRoots->AppendElement(root); + } + + if (!foundBlack) { return false; }