Bug 1340926 part 2 - Avoid record deprecated operation inside about: pages. r=ehsan
MozReview-Commit-ID: GksnEDiHboq
--- 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]);
}