Bug 1064211 - Check nsDocument::sProcessingStack contains a value before processing it. r=mrbkap
authorWilliam Chen <wchen@mozilla.com>
Wed, 08 Oct 2014 18:05:39 -0700
changeset 209502 c8ee9135805bb434d4627e84c7a45e77b407e36a
parent 209501 923a414099b19542df7da32d13176cd70253e2bd
child 209503 33d851b1e655d727f2678f586417fb324945aff5
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmrbkap
bugs1064211
milestone35.0a1
Bug 1064211 - Check nsDocument::sProcessingStack contains a value before processing it. r=mrbkap
content/base/src/nsDocument.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -5843,16 +5843,21 @@ nsDocument::ProcessBaseElementQueue()
 }
 
 // static
 void
 nsDocument::ProcessTopElementQueue(bool aIsBaseQueue)
 {
   MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
 
+  if (sProcessingStack.isNothing()) {
+    // If XPCOM shutdown has reset the processing stack, don't do anything.
+    return;
+  }
+
   nsTArray<CustomElementData*>& stack = *sProcessingStack;
   uint32_t firstQueue = stack.LastIndexOf((CustomElementData*) nullptr);
 
   if (aIsBaseQueue && firstQueue != 0) {
     return;
   }
 
   for (uint32_t i = firstQueue + 1; i < stack.Length(); ++i) {