Bug 1275129 - Add missing null check in OrphanReporter::sizeOfIncludingThis. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 24 May 2016 10:27:02 +1000
changeset 298625 73bb17e67fc160729a66be353d968350e37def61
parent 298624 3f6d3a7f5cbabbf8f89be6978911154fb8499fd4
child 298626 bbd1d5a1fc25172e04103c4f3142f24c3a74685a
push id30281
push usercbook@mozilla.com
push dateTue, 24 May 2016 12:54:02 +0000
treeherdermozilla-central@829d3be6ba64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1275129
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275129 - Add missing null check in OrphanReporter::sizeOfIncludingThis. r=mccr8.
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2734,17 +2734,18 @@ class OrphanReporter : public JS::Object
         // assumptions.  Yuk.
         if (node && !node->IsInUncomposedDoc() &&
             !(node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL)))
         {
             // This is an orphan node.  If we haven't already handled the
             // sub-tree that this node belongs to, measure the sub-tree's size
             // and then record its root so we don't measure it again.
             nsCOMPtr<nsINode> orphanTree = node->SubtreeRoot();
-            if (!mAlreadyMeasuredOrphanTrees.Contains(orphanTree)) {
+            if (orphanTree &&
+                !mAlreadyMeasuredOrphanTrees.Contains(orphanTree)) {
                 // If PutEntry() fails we don't measure this tree, which could
                 // lead to under-measurement. But that's better than the
                 // alternatives, which are over-measurement or an OOM abort.
                 if (mAlreadyMeasuredOrphanTrees.PutEntry(orphanTree, fallible)) {
                     n += SizeOfTreeIncludingThis(orphanTree);
                 }
             }
         }