зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1091140, add telemetry for sanitize, r=vdjeric
This commit is contained in:
Родитель
1ff610e6bd
Коммит
352abe4eb4
|
@ -17,6 +17,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
|||
"resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon",
|
||||
"resource:///modules/DownloadsCommon.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
||||
function Sanitizer() {}
|
||||
Sanitizer.prototype = {
|
||||
|
@ -92,6 +94,8 @@ Sanitizer.prototype = {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
TelemetryStopwatch.start("FX_SANITIZE_TOTAL");
|
||||
|
||||
// Cache the range of times to clear
|
||||
if (this.ignoreTimespan)
|
||||
var range = null; // If we ignore timespan, clear everything
|
||||
|
@ -101,6 +105,7 @@ Sanitizer.prototype = {
|
|||
let itemCount = Object.keys(itemsToClear).length;
|
||||
let onItemComplete = function() {
|
||||
if (!--itemCount) {
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_TOTAL");
|
||||
seenError ? deferred.reject() : deferred.resolve();
|
||||
}
|
||||
};
|
||||
|
@ -146,6 +151,8 @@ Sanitizer.prototype = {
|
|||
cache: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_CACHE");
|
||||
|
||||
var cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"].
|
||||
getService(Ci.nsICacheStorageService);
|
||||
try {
|
||||
|
@ -159,6 +166,8 @@ Sanitizer.prototype = {
|
|||
try {
|
||||
imageCache.clearCache(false); // true=chrome, false=content
|
||||
} catch(er) {}
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_CACHE");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -170,6 +179,8 @@ Sanitizer.prototype = {
|
|||
cookies: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_COOKIES");
|
||||
|
||||
var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"]
|
||||
.getService(Ci.nsICookieManager);
|
||||
if (this.range) {
|
||||
|
@ -217,6 +228,8 @@ Sanitizer.prototype = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_COOKIES");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -228,8 +241,10 @@ Sanitizer.prototype = {
|
|||
offlineApps: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_OFFLINEAPPS");
|
||||
Components.utils.import("resource:///modules/offlineAppCache.jsm");
|
||||
OfflineAppCacheHelper.clear();
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_OFFLINEAPPS");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -241,6 +256,8 @@ Sanitizer.prototype = {
|
|||
history: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_HISTORY");
|
||||
|
||||
if (this.range)
|
||||
PlacesUtils.history.removeVisitsByTimeframe(this.range[0], this.range[1]);
|
||||
else
|
||||
|
@ -259,6 +276,8 @@ Sanitizer.prototype = {
|
|||
.getService(Components.interfaces.nsINetworkPredictor);
|
||||
predictor.reset();
|
||||
} catch (e) { }
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_HISTORY");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -272,6 +291,8 @@ Sanitizer.prototype = {
|
|||
formdata: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_FORMDATA");
|
||||
|
||||
// Clear undo history of all searchBars
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
|
@ -296,6 +317,8 @@ Sanitizer.prototype = {
|
|||
[ change.firstUsedStart, change.firstUsedEnd ] = this.range;
|
||||
}
|
||||
FormHistory.update(change);
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_FORMDATA");
|
||||
},
|
||||
|
||||
canClear : function(aCallback, aArg)
|
||||
|
@ -342,6 +365,7 @@ Sanitizer.prototype = {
|
|||
downloads: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_DOWNLOADS");
|
||||
Task.spawn(function () {
|
||||
let filterByTime = null;
|
||||
if (this.range) {
|
||||
|
@ -355,7 +379,11 @@ Sanitizer.prototype = {
|
|||
// Clear all completed/cancelled downloads
|
||||
let list = yield Downloads.getList(Downloads.ALL);
|
||||
list.removeFinished(filterByTime);
|
||||
}.bind(this)).then(null, Components.utils.reportError);
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS");
|
||||
}.bind(this)).then(null, error => {
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS");
|
||||
Components.utils.reportError(error);
|
||||
});
|
||||
},
|
||||
|
||||
canClear : function(aCallback, aArg)
|
||||
|
@ -368,10 +396,12 @@ Sanitizer.prototype = {
|
|||
passwords: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_PASSWORDS");
|
||||
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
|
||||
.getService(Components.interfaces.nsILoginManager);
|
||||
// Passwords are timeless, and don't respect the timeSpan setting
|
||||
pwmgr.removeAllLogins();
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_PASSWORDS");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -386,6 +416,8 @@ Sanitizer.prototype = {
|
|||
sessions: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_SESSIONS");
|
||||
|
||||
// clear all auth tokens
|
||||
var sdr = Components.classes["@mozilla.org/security/sdr;1"]
|
||||
.getService(Components.interfaces.nsISecretDecoderRing);
|
||||
|
@ -395,6 +427,8 @@ Sanitizer.prototype = {
|
|||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.notifyObservers(null, "net:clear-active-logins", null);
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -406,6 +440,8 @@ Sanitizer.prototype = {
|
|||
siteSettings: {
|
||||
clear: function ()
|
||||
{
|
||||
TelemetryStopwatch.start("FX_SANITIZE_SITESETTINGS");
|
||||
|
||||
// Clear site-specific permissions like "Allow this site to open popups"
|
||||
// we ignore the "end" range and hope it is now() - none of the
|
||||
// interfaces used here support a true range anyway.
|
||||
|
@ -444,6 +480,8 @@ Sanitizer.prototype = {
|
|||
var sss = Cc["@mozilla.org/ssservice;1"]
|
||||
.getService(Ci.nsISiteSecurityService);
|
||||
sss.clearAll();
|
||||
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_SITESETTINGS");
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -516,6 +554,8 @@ Sanitizer.prototype = {
|
|||
|
||||
// If/once we get here, we should actually be able to close all windows.
|
||||
|
||||
TelemetryStopwatch.start("FX_SANITIZE_OPENWINDOWS");
|
||||
|
||||
// First create a new window. We do this first so that on non-mac, we don't
|
||||
// accidentally close the app by closing all the windows.
|
||||
let handler = Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler);
|
||||
|
@ -555,8 +595,10 @@ Sanitizer.prototype = {
|
|||
#endif
|
||||
newWindowOpened = true;
|
||||
// If we're the last thing to happen, invoke callback.
|
||||
if (numWindowsClosing == 0)
|
||||
if (numWindowsClosing == 0) {
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_OPENWINDOWS");
|
||||
aCallback();
|
||||
}
|
||||
}
|
||||
|
||||
let numWindowsClosing = windowList.length;
|
||||
|
@ -565,8 +607,10 @@ Sanitizer.prototype = {
|
|||
if (numWindowsClosing == 0) {
|
||||
Services.obs.removeObserver(onWindowClosed, "xul-window-destroyed");
|
||||
// If we're the last thing to happen, invoke callback.
|
||||
if (newWindowOpened)
|
||||
if (newWindowOpened) {
|
||||
TelemetryStopwatch.finish("FX_SANITIZE_OPENWINDOWS");
|
||||
aCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7155,6 +7155,105 @@
|
|||
"n_buckets": 16,
|
||||
"description": "The number of entries in persistent DataStorage (HSTS and HPKP data, basically)"
|
||||
},
|
||||
"FX_SANITIZE_TOTAL": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Total time it takes to sanitize (ms)"
|
||||
},
|
||||
"FX_SANITIZE_CACHE": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize the cache (ms)"
|
||||
},
|
||||
"FX_SANITIZE_COOKIES": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize cookies (ms)"
|
||||
},
|
||||
"FX_SANITIZE_OFFLINEAPPS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize stored offline app data (ms)"
|
||||
},
|
||||
"FX_SANITIZE_HISTORY": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize history (ms)"
|
||||
},
|
||||
"FX_SANITIZE_FORMDATA": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize stored form data (ms)"
|
||||
},
|
||||
"FX_SANITIZE_DOWNLOADS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize recent downloads (ms)"
|
||||
},
|
||||
"FX_SANITIZE_PASSWORDS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize saved passwords (ms)"
|
||||
},
|
||||
"FX_SANITIZE_SESSIONS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize saved sessions (ms)"
|
||||
},
|
||||
"FX_SANITIZE_SITESETTINGS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize site-specific settings (ms)"
|
||||
},
|
||||
"FX_SANITIZE_OPENWINDOWS": {
|
||||
"alert_emails": ["firefox-dev@mozilla.org", "gavin@mozilla.com"],
|
||||
"expires_in_version": "40",
|
||||
"kind": "exponential",
|
||||
"high": "30000",
|
||||
"n_buckets": 20,
|
||||
"extended_statistics_ok": true,
|
||||
"description": "Sanitize: Time it takes to sanitize the open windows list (ms)"
|
||||
},
|
||||
"PWMGR_BLOCKLIST_NUM_SITES": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
|
Загрузка…
Ссылка в новой задаче