Bug 1340926 - Part 2: Avoid record deprecated operation inside about: pages. r=Ehsan, a=gchang
authorXidorn Quan <me@upsuper.org>
Mon, 20 Feb 2017 12:35:56 +1100
changeset 378713 31e2622d8bf86da2206b9267fa385833afc1e46f
parent 378712 a5357f98767044783946a3719dd04fa20a3bd108
child 378714 329442feed2426f939cce4c4126a837573ff11da
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, gchang
bugs1340926
milestone53.0a2
Bug 1340926 - Part 2: Avoid record deprecated operation inside about: pages. r=Ehsan, a=gchang MozReview-Commit-ID: GksnEDiHboq
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -10076,17 +10076,23 @@ void
 nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation,
                            bool asError /* = false */) const
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (HasWarnedAbout(aOperation)) {
     return;
   }
   mDeprecationWarnedAbout[aOperation] = true;
-  const_cast<nsIDocument*>(this)->SetDocumentAndPageUseCounter(OperationToUseCounter(aOperation));
+  // Don't count deprecated operations for about pages since those pages
+  // are almost in our control, and we always need to remove uses there
+  // before we remove the operation itself anyway.
+  if (!static_cast<const nsDocument*>(this)->IsAboutPage()) {
+    const_cast<nsIDocument*>(this)->
+      SetDocumentAndPageUseCounter(OperationToUseCounter(aOperation));
+  }
   uint32_t flags = asError ? nsIScriptError::errorFlag
                            : nsIScriptError::warningFlag;
   nsContentUtils::ReportToConsole(flags,
                                   NS_LITERAL_CSTRING("DOM Core"), this,
                                   nsContentUtils::eDOM_PROPERTIES,
                                   kDeprecationWarnings[aOperation]);
 }