diff --git a/toolkit/crashreporter/content/crashes.js b/toolkit/crashreporter/content/crashes.js index b4ebf1b221d2..30a4dfed4a85 100644 --- a/toolkit/crashreporter/content/crashes.js +++ b/toolkit/crashreporter/content/crashes.js @@ -9,6 +9,9 @@ var reportsDir, submittedDir, pendingDir; var reportURL; Components.utils.import("resource://gre/modules/CrashSubmit.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); + +const buildID = Services.appinfo.appBuildID; function submitSuccess(dumpid, ret) { let link = document.getElementById(dumpid); @@ -212,6 +215,17 @@ function clearReports() { file.remove(false); } } + entries = reportsDir.directoryEntries; + var oneYearAgo = Date.now() - 31586000000; + while (entries.hasMoreElements()) { + var file = entries.getNext().QueryInterface(Ci.nsIFile); + var leaf = file.leafName; + if (leaf.substr(0, 11) == "InstallTime" && + file.lastModifiedTime < oneYearAgo && + leaf != "InstallTime" + buildID) { + file.remove(false); + } + } document.getElementById("clear-reports").style.display = "none"; document.getElementById("reportList").style.display = "none"; document.getElementById("noReports").style.display = "block";