From ff10ad8bc2abb15679c7eba4dc0a5af61944195a Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Tue, 8 Nov 2016 16:24:34 +0800 Subject: [PATCH] Bug 1315889 - stylo: don't try to restyle elements that have been removed from the document. r=emilio MozReview-Commit-ID: EiFS1KAKAj6 --- layout/base/ServoRestyleManager.cpp | 9 +++++++++ layout/style/crashtests/1315889-1.html | 12 ++++++++++++ layout/style/crashtests/crashtests.list | 1 + 3 files changed, 22 insertions(+) create mode 100644 layout/style/crashtests/1315889-1.html diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index a74abe1d4363..e2de2d285833 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -366,6 +366,15 @@ ServoRestyleManager::ProcessPendingRestyles() ServoElementSnapshot* snapshot = iter.UserData(); Element* element = iter.Key(); + // The element is no longer in the document, so don't bother computing + // a final restyle hint for it. + // + // XXXheycam RestyleTracker checks that the element's GetComposedDoc() + // matches the document we're restyling. Do we need to do that too? + if (!element->IsInComposedDoc()) { + continue; + } + // TODO: avoid the ComputeRestyleHint call if we already have the highest // explicit restyle hint? nsRestyleHint hint = styleSet->ComputeRestyleHint(element, snapshot); diff --git a/layout/style/crashtests/1315889-1.html b/layout/style/crashtests/1315889-1.html new file mode 100644 index 000000000000..29186fac1c47 --- /dev/null +++ b/layout/style/crashtests/1315889-1.html @@ -0,0 +1,12 @@ + + +
hello
+ diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index 1be03042c13f..7a7752c81372 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -160,4 +160,5 @@ pref(dom.animations-api.core.enabled,true) load 1290994-2.html pref(dom.animations-api.core.enabled,true) load 1290994-3.html load 1290994-4.html load 1314531.html +load 1315889-1.html load 1315894-1.html