Bug 827976 - Teach leaks.py to ignore the hidden window. r=Ehsan

Differential Revision: https://phabricator.services.mozilla.com/D21089
This commit is contained in:
Felipe Gomes
2019-03-04 20:21:31 +00:00
parent 37fc18b54c
commit 097696c2d3
3 changed files with 53 additions and 6 deletions

View File

@@ -439,12 +439,22 @@ nsDocShell::~nsDocShell() {
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p destroyed\n", this));
#ifdef DEBUG
nsAutoCString url;
if (mLastOpenedURI) {
url = mLastOpenedURI->GetSpecOrDefault();
// Data URLs can be very long, so truncate to avoid flooding the log.
const uint32_t maxURLLength = 1000;
if (url.Length() > maxURLLength) {
url.Truncate(maxURLLength);
}
}
// We're counting the number of |nsDocShells| to help find leaks
--gNumberOfDocShells;
if (!PR_GetEnv("MOZ_QUIET")) {
printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %s]\n", (void*)this,
gNumberOfDocShells, getpid(),
nsIDToCString(mHistoryID).get());
printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %s] [url = %s]\n",
(void*)this, gNumberOfDocShells, getpid(),
nsIDToCString(mHistoryID).get(), url.get());
}
#endif
}
@@ -1170,6 +1180,10 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
mCurrentURI = aURI;
#ifdef DEBUG
mLastOpenedURI = aURI;
#endif
if (!NS_IsAboutBlank(mCurrentURI)) {
mHasLoadedNonBlankURI = true;
}