Bug 1381083: Don't hold the style context if we had a frame and re-resolved the style. r?heycam
Otherwise we risk losing track of the frame if we hit the cache.
MozReview-Commit-ID: ByHGhcBwIfX
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -955,26 +955,27 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
mStyleContext = styleIfVisited;
}
}
}
void
nsComputedDOMStyle::ClearCurrentStyleSources()
{
+ // Release the current style context if we got it off the frame.
+ // For a style context we resolved, keep it around so that we
+ // can re-use it next time this object is queried, but not if it-s a
+ // re-resolved style context because we were inside a pseudo-element.
+ if (!mResolvedStyleContext || mOuterFrame) {
+ ClearStyleContext();
+ }
+
mOuterFrame = nullptr;
mInnerFrame = nullptr;
mPresShell = nullptr;
-
- // Release the current style context if we got it off the frame.
- // For a style context we resolved, keep it around so that we
- // can re-use it next time this object is queried.
- if (!mResolvedStyleContext) {
- mStyleContext = nullptr;
- }
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
{
nsCSSPropertyID prop =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);