mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1454572: nsComputedDOMStyle: Don't crash when used on a detached pseudo-element. r=emilio,xidorn:emilio
This shouldn't normally happen, but it does in some rare cases; e.g. if an accessibility client queries info for a node that is being removed. MozReview-Commit-ID: 3nac9ITN66f --HG-- extra : rebase_source : 238ffc5b14589c91f30f9f0c7d3c23a82914aad3
This commit is contained in:
parent
c90d9acc4d
commit
a0c54786f9
@ -501,6 +501,7 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
|
||||
StyleType aStyleType)
|
||||
{
|
||||
MOZ_ASSERT(aElement, "NULL element");
|
||||
|
||||
// If the content has a pres shell, we must use it. Otherwise we'd
|
||||
// potentially mix rule trees by using the wrong pres shell's style
|
||||
// set. Using the pres shell from the content also means that any
|
||||
@ -521,6 +522,14 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aElement->IsInNativeAnonymousSubtree() && !aElement->IsInComposedDoc()) {
|
||||
// Normal web content can't access NAC, but Accessibility, DevTools and
|
||||
// Editor use this same API and this may get called for anonymous content.
|
||||
// Computing the style of a pseudo-element that doesn't have a parent doesn't
|
||||
// really make sense.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// XXX the !aElement->IsHTMLElement(nsGkAtoms::area)
|
||||
// check is needed due to bug 135040 (to avoid using
|
||||
// mPrimaryFrame). Remove it once that's fixed.
|
||||
|
Loading…
Reference in New Issue
Block a user