Bug 1382017 - stylo: Don't crash on null parent contexts in nsCSSFrameConstructor::AddFrameConstructionItemsInternal ; r?xidorn draft
authorManish Goregaokar <manishearth@gmail.com>
Tue, 18 Jul 2017 15:14:21 -0700
changeset 610892 e471624d510404eb9dcac1e3adf39486b30b5f28
parent 610891 17d688e61807dc270e4d4e46be9a5c7f4ab78b0e
child 637985 d32d9972c3c3069575eeadbba106eb2402511364
push id69031
push userbmo:manishearth@gmail.com
push dateTue, 18 Jul 2017 22:14:52 +0000
reviewersxidorn
bugs1382017
milestone56.0a1
Bug 1382017 - stylo: Don't crash on null parent contexts in nsCSSFrameConstructor::AddFrameConstructionItemsInternal ; r?xidorn MozReview-Commit-ID: Ga6s9RlRqzl
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5882,18 +5882,21 @@ nsCSSFrameConstructor::AddFrameConstruct
           ServoRestyleManager::ClearServoDataFromSubtree(element);
           styleSet->StyleNewSubtree(element);
 
           // Servo's should_traverse_children() in traversal.rs skips
           // styling descendants of elements with a -moz-binding the
           // first time. Thus call StyleNewChildren() again.
           styleSet->StyleNewChildren(element);
 
+          auto parent = styleContext->GetParentAllowServo();
+          ServoStyleContext* parentServo =  parent ? parent->AsServo() : nullptr;
+
           styleContext =
-            styleSet->ResolveStyleFor(element, styleContext->GetParentAllowServo()->AsServo(),
+            styleSet->ResolveStyleFor(element, parent,
                                       LazyComputeBehavior::Assert);
         } else {
           styleContext =
             ResolveStyleContext(styleContext->GetParent(), aContent, &aState);
         }
 
         display = styleContext->StyleDisplay();
         aStyleContext = styleContext;