Bug 1340926 part 2 - Avoid record deprecated operation inside about: pages. r=ehsan draft
authorXidorn Quan <me@upsuper.org>
Mon, 20 Feb 2017 12:35:56 +1100
changeset 487672 f895006f49ee2e0a810c53073f85470e007214ee
parent 487671 7ed49c06d62e1003ad33ef67aa1cda74c4740473
child 487673 5b09f8b92405d68bd578fea1a2336101c8436400
push id46289
push userxquan@mozilla.com
push dateTue, 21 Feb 2017 23:05:51 +0000
reviewersehsan
bugs1340926
milestone54.0a1
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]);
 }