Bug 1340926 part 2 - Avoid record deprecated operation inside about: pages. r=Ehsan
authorXidorn Quan <me@upsuper.org>
Mon, 20 Feb 2017 12:35:56 +1100
changeset 344105 8f893ce1a8453b01598a7abe2f30d344a789db6e
parent 344104 b08129753f550de4c4f76d95160041f42534641e
child 344106 be69c846233d6abe9e060bef962b159fff064f2e
push id31401
push usercbook@mozilla.com
push dateWed, 22 Feb 2017 13:30:27 +0000
treeherdermozilla-central@8a6084bc234c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1340926
milestone54.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 1340926 part 2 - Avoid record deprecated operation inside about: pages. r=Ehsan MozReview-Commit-ID: GksnEDiHboq
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -10188,17 +10188,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]);
 }