Bug 1457102: Avoid grabbing a reference to the pres context. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 26 Apr 2018 16:10:10 +0200
changeset 472006 860f468355b9545e50e26fd83e7abb4a3429b8bb
parent 472005 681cf57b9ff3a8e6493ef5e42e4fc6289db469d2
child 472007 9806b8af0e6fbc1f3ef63da5c55ea68bd5afee2d
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1457102
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457102: Avoid grabbing a reference to the pres context. r=heycam Nothing from within CompatibilityModeChanged can kill it. MozReview-Commit-ID: 386GiYBC6kF
dom/html/nsHTMLDocument.cpp
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -852,18 +852,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()) {