Bug 1457102: Avoid grabbing a reference to the pres context. r?heycam
Nothing from within CompatibilityModeChanged can kill it.
MozReview-Commit-ID: 386GiYBC6kF
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -853,18 +853,17 @@ nsHTMLDocument::SetCompatibilityMode(nsC
NS_ASSERTION(IsHTMLDocument() || aMode == eCompatibility_FullStandards,
"Bad compat mode for XHTML document!");
if (mCompatMode == aMode) {
return;
}
mCompatMode = aMode;
CSSLoader()->SetCompatibilityMode(mCompatMode);
- RefPtr<nsPresContext> pc = GetPresContext();
- if (pc) {
+ if (nsPresContext* pc = GetPresContext()) {
pc->CompatibilityModeChanged();
}
}
nsIContent*
nsHTMLDocument::GetUnfocusedKeyEventTarget()
{
if (nsGenericHTMLElement* body = GetBody()) {