mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-12 18:27:32 +09:00
Issue #21 - Remove Telemetry accumulation/structures from toolkit js.
This fixes toolkit modules and prevents toolkit component breakage. Also removes about:telemetry
This commit is contained in:
parent
8d800b1cb0
commit
44388b01a3
42 changed files with 22 additions and 3581 deletions
|
|
@ -47,11 +47,6 @@ var CompatWarning = {
|
|||
}
|
||||
alreadyWarned = true;
|
||||
|
||||
if (addon) {
|
||||
let histogram = Services.telemetry.getKeyedHistogramById("ADDON_SHIM_USAGE");
|
||||
histogram.add(addon, warning ? warning.number : 0);
|
||||
}
|
||||
|
||||
if (!Preferences.get("dom.ipc.shims.enabledWarnings", false))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -329,8 +329,6 @@ function doNotDisturb() {
|
|||
.getService(Ci.nsIAlertsService)
|
||||
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
|
||||
alertService.manualDoNotDisturb = true;
|
||||
Services.telemetry.getHistogramById("WEB_NOTIFICATION_MENU")
|
||||
.add(0);
|
||||
onAlertClose();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@
|
|||
* sequentially. Typically, each shutdown phase removes some
|
||||
* capabilities from the application. For instance, at the end of
|
||||
* phase profileBeforeChange, no service is permitted to write to the
|
||||
* profile directory (with the exception of Telemetry). Consequently,
|
||||
* if any service has requested I/O to the profile directory before or
|
||||
* during phase profileBeforeChange, the system must be informed that
|
||||
* these requests need to be completed before the end of phase
|
||||
* profileBeforeChange. Failing to inform the system of this
|
||||
* requirement can (and has been known to) cause data loss.
|
||||
* profile directory. Consequently, if any service has requested I/O
|
||||
* to the profile directory before or during phase profileBeforeChange,
|
||||
* the system must be informed that these requests need to be completed
|
||||
* before the end of phase profileBeforeChange. Failing to inform the
|
||||
* system of this requirement can (and has been known to) cause data loss.
|
||||
*
|
||||
* Example: At some point during shutdown, the Add-On Manager needs to
|
||||
* ensure that all add-ons have safely written their data to disk,
|
||||
|
|
@ -1001,7 +1000,6 @@ if (!isContent) {
|
|||
this.AsyncShutdown.profileChangeTeardown = getPhase("profile-change-teardown");
|
||||
this.AsyncShutdown.profileBeforeChange = getPhase("profile-before-change");
|
||||
this.AsyncShutdown.placesClosingInternalConnection = getPhase("places-will-close-connection");
|
||||
this.AsyncShutdown.sendTelemetry = getPhase("profile-before-change-telemetry");
|
||||
}
|
||||
|
||||
// Notifications that fire in the parent and content process, but should
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ function nsAsyncShutdownService() {
|
|||
"profileBeforeChange",
|
||||
"profileChangeTeardown",
|
||||
"quitApplicationGranted",
|
||||
"sendTelemetry",
|
||||
|
||||
// Child processes
|
||||
"contentChildShutdown",
|
||||
|
|
|
|||
|
|
@ -192,11 +192,6 @@ interface nsIAsyncShutdownService: nsISupports {
|
|||
*/
|
||||
readonly attribute nsIAsyncShutdownClient quitApplicationGranted;
|
||||
|
||||
/**
|
||||
* Barrier for notification profile-before-change-telemetry.
|
||||
*/
|
||||
readonly attribute nsIAsyncShutdownClient sendTelemetry;
|
||||
|
||||
|
||||
// Barriers for global shutdown stages in all processes.
|
||||
|
||||
|
|
|
|||
|
|
@ -748,10 +748,7 @@ Blocklist.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let telemetry = Services.telemetry;
|
||||
|
||||
if (this._isBlocklistPreloaded()) {
|
||||
telemetry.getHistogramById("BLOCKLIST_SYNC_FILE_LOAD").add(false);
|
||||
this._loadBlocklistFromString(this._preloadedBlocklistContent);
|
||||
delete this._preloadedBlocklistContent;
|
||||
return;
|
||||
|
|
@ -762,8 +759,6 @@ Blocklist.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
telemetry.getHistogramById("BLOCKLIST_SYNC_FILE_LOAD").add(true);
|
||||
|
||||
let text = "";
|
||||
let fstream = null;
|
||||
let cstream = null;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ Cu.import("resource://gre/modules/Services.jsm", this);
|
|||
Cu.import("resource://gre/modules/Task.jsm", this);
|
||||
Cu.import("resource://gre/modules/Timer.jsm", this);
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
Cu.import("resource://gre/modules/TelemetryController.jsm");
|
||||
Cu.import("resource://gre/modules/KeyValueParser.jsm");
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
|
|
@ -64,9 +63,6 @@ function dateToDays(date) {
|
|||
* storeDir (string)
|
||||
* Directory we will use for our data store. This instance will write
|
||||
* data files into the directory specified.
|
||||
*
|
||||
* telemetryStoreSizeKey (string)
|
||||
* Telemetry histogram to report store size under.
|
||||
*/
|
||||
this.CrashManager = function (options) {
|
||||
for (let k of ["pendingDumpsDir", "submittedDumpsDir", "eventsDirs",
|
||||
|
|
@ -98,10 +94,6 @@ this.CrashManager = function (options) {
|
|||
this._storeDir = v;
|
||||
break;
|
||||
|
||||
case "telemetryStoreSizeKey":
|
||||
this._telemetryStoreSizeKey = v;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error("Unknown property in options: " + k);
|
||||
}
|
||||
|
|
@ -531,48 +523,6 @@ this.CrashManager.prototype = Object.freeze({
|
|||
store.addCrash(this.PROCESS_TYPE_MAIN, this.CRASH_TYPE_CRASH,
|
||||
crashID, date, metadata);
|
||||
|
||||
// If we have a saved environment, use it. Otherwise report
|
||||
// the current environment.
|
||||
let crashEnvironment = null;
|
||||
let sessionId = null;
|
||||
let stackTraces = null;
|
||||
let reportMeta = Cu.cloneInto(metadata, myScope);
|
||||
if ('TelemetryEnvironment' in reportMeta) {
|
||||
try {
|
||||
crashEnvironment = JSON.parse(reportMeta.TelemetryEnvironment);
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
delete reportMeta.TelemetryEnvironment;
|
||||
}
|
||||
if ('TelemetrySessionId' in reportMeta) {
|
||||
sessionId = reportMeta.TelemetrySessionId;
|
||||
delete reportMeta.TelemetrySessionId;
|
||||
}
|
||||
if ('StackTraces' in reportMeta) {
|
||||
try {
|
||||
stackTraces = JSON.parse(reportMeta.StackTraces);
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
delete reportMeta.StackTraces;
|
||||
}
|
||||
TelemetryController.submitExternalPing("crash",
|
||||
{
|
||||
version: 1,
|
||||
crashDate: date.toISOString().slice(0, 10), // YYYY-MM-DD
|
||||
sessionId: sessionId,
|
||||
crashId: entry.id,
|
||||
stackTraces: stackTraces,
|
||||
metadata: reportMeta,
|
||||
hasCrashEnvironment: (crashEnvironment !== null),
|
||||
},
|
||||
{
|
||||
retentionDays: 180,
|
||||
addClientId: true,
|
||||
addEnvironment: true,
|
||||
overrideEnvironment: crashEnvironment,
|
||||
});
|
||||
break;
|
||||
|
||||
case "crash.submission.1":
|
||||
|
|
@ -665,8 +615,7 @@ this.CrashManager.prototype = Object.freeze({
|
|||
unixMode: OS.Constants.libc.S_IRWXU,
|
||||
});
|
||||
|
||||
let store = new CrashStore(this._storeDir,
|
||||
this._telemetryStoreSizeKey);
|
||||
let store = new CrashStore(this._storeDir);
|
||||
yield store.load();
|
||||
|
||||
this._store = store;
|
||||
|
|
@ -756,13 +705,9 @@ var gCrashManager;
|
|||
*
|
||||
* @param storeDir (string)
|
||||
* Directory the store should be located in.
|
||||
* @param telemetrySizeKey (string)
|
||||
* The telemetry histogram that should be used to store the size
|
||||
* of the data file.
|
||||
*/
|
||||
function CrashStore(storeDir, telemetrySizeKey) {
|
||||
function CrashStore(storeDir) {
|
||||
this._storeDir = storeDir;
|
||||
this._telemetrySizeKey = telemetrySizeKey;
|
||||
|
||||
this._storePath = OS.Path.join(storeDir, "store.json.mozlz4");
|
||||
|
||||
|
|
@ -950,9 +895,6 @@ CrashStore.prototype = Object.freeze({
|
|||
let size = yield OS.File.writeAtomic(this._storePath, data, {
|
||||
tmpPath: this._storePath + ".tmp",
|
||||
compression: "lz4"});
|
||||
if (this._telemetrySizeKey) {
|
||||
Services.telemetry.getHistogramById(this._telemetrySizeKey).add(size);
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
|
@ -1209,8 +1151,6 @@ CrashStore.prototype = Object.freeze({
|
|||
}
|
||||
|
||||
submission.requestDate = date;
|
||||
Services.telemetry.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_ATTEMPT")
|
||||
.add(crash.type, 1);
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
@ -1229,8 +1169,6 @@ CrashStore.prototype = Object.freeze({
|
|||
|
||||
submission.responseDate = date;
|
||||
submission.result = result;
|
||||
Services.telemetry.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_SUCCESS")
|
||||
.add(crash.type, result == "ok");
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
@ -1333,7 +1271,6 @@ XPCOMUtils.defineLazyGetter(this.CrashManager, "Singleton", function () {
|
|||
submittedDumpsDir: OS.Path.join(crPath, "submitted"),
|
||||
eventsDirs: [OS.Path.join(crPath, "events"), OS.Path.join(storePath, "events")],
|
||||
storeDir: storePath,
|
||||
telemetryStoreSizeKey: "CRASH_STORE_COMPRESSED_BYTES",
|
||||
});
|
||||
|
||||
// Automatically aggregate event files shortly after startup. This
|
||||
|
|
|
|||
|
|
@ -55,31 +55,6 @@ function testPixel(ctx, x, y, r, g, b, a, fuzz) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function reportResult(val) {
|
||||
try {
|
||||
let histogram = Services.telemetry.getHistogramById("GRAPHICS_SANITY_TEST");
|
||||
histogram.add(val);
|
||||
} catch (e) {}
|
||||
|
||||
Preferences.set(RUNNING_PREF, false);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}
|
||||
|
||||
function reportTestReason(val) {
|
||||
let histogram = Services.telemetry.getHistogramById("GRAPHICS_SANITY_TEST_REASON");
|
||||
histogram.add(val);
|
||||
}
|
||||
|
||||
function annotateCrashReport(value) {
|
||||
try {
|
||||
// "1" if we're annotating the crash report, "" to remove the annotation.
|
||||
var crashReporter = Cc['@mozilla.org/toolkit/crash-reporter;1'].
|
||||
getService(Ci.nsICrashReporter);
|
||||
crashReporter.annotateCrashReport("GraphicsSanityTest", value ? "1" : "");
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
function setTimeout(aMs, aCallback) {
|
||||
var timer = Cc['@mozilla.org/timer;1'].
|
||||
createInstance(Ci.nsITimer);
|
||||
|
|
@ -125,18 +100,15 @@ function testCompositor(win, ctx) {
|
|||
var testPassed = true;
|
||||
|
||||
if (!verifyVideoRendering(ctx)) {
|
||||
reportResult(TEST_FAILED_VIDEO);
|
||||
Preferences.set(DISABLE_VIDEO_PREF, true);
|
||||
testPassed = false;
|
||||
}
|
||||
|
||||
if (!verifyLayersRendering(ctx)) {
|
||||
reportResult(TEST_FAILED_RENDER);
|
||||
testPassed = false;
|
||||
}
|
||||
|
||||
if (testPassed) {
|
||||
reportResult(TEST_PASSED);
|
||||
}
|
||||
|
||||
return testPassed;
|
||||
|
|
@ -160,7 +132,6 @@ var listener = {
|
|||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
setTimeout(TIMEOUT_SEC * 1000, () => {
|
||||
if (this.win) {
|
||||
reportResult(TEST_TIMEOUT);
|
||||
this.endTest();
|
||||
}
|
||||
});
|
||||
|
|
@ -227,10 +198,6 @@ var listener = {
|
|||
|
||||
this.mm = null;
|
||||
}
|
||||
|
||||
// Remove the annotation after we've cleaned everything up, to catch any
|
||||
// incidental crashes from having performed the sanity test.
|
||||
annotateCrashReport(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -248,7 +215,6 @@ SanityTest.prototype = {
|
|||
|
||||
if (Preferences.get(RUNNING_PREF, false)) {
|
||||
Preferences.set(DISABLE_VIDEO_PREF, true);
|
||||
reportResult(TEST_CRASHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -257,11 +223,6 @@ SanityTest.prototype = {
|
|||
if (prefValue == value) {
|
||||
return true;
|
||||
}
|
||||
if (prefValue === undefined) {
|
||||
reportTestReason(REASON_FIRST_RUN);
|
||||
} else {
|
||||
reportTestReason(reason);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -296,8 +257,6 @@ SanityTest.prototype = {
|
|||
|
||||
if (!this.shouldRunTest()) return;
|
||||
|
||||
annotateCrashReport(true);
|
||||
|
||||
// Open a tiny window to render our test page, and notify us when it's loaded
|
||||
var sanityTest = Services.ww.openWindow(null,
|
||||
"chrome://gfxsanity/content/sanityparent.html",
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public:
|
|||
* as the AbstractResult is cycle-collected.
|
||||
*
|
||||
* @param aStartDate The instant at which the operation was
|
||||
* requested. Used to collect Telemetry statistics.
|
||||
* requested.
|
||||
*/
|
||||
explicit AbstractResult(TimeStamp aStartDate)
|
||||
: mStartDate(aStartDate)
|
||||
|
|
@ -182,7 +182,7 @@ public:
|
|||
* Setup the AbstractResult once data is available.
|
||||
*
|
||||
* @param aDispatchDate The instant at which the IO thread received
|
||||
* the operation request. Used to collect Telemetry statistics.
|
||||
* the operation request.
|
||||
* @param aExecutionDuration The duration of the operation on the
|
||||
* IO thread.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -434,34 +434,11 @@ var Scheduler = this.Scheduler = {
|
|||
Scheduler.Debugging.latestReceived = [Date.now(), error.message, error.fileName, error.lineNumber];
|
||||
throw error;
|
||||
} finally {
|
||||
if (firstLaunch) {
|
||||
Scheduler._updateTelemetry();
|
||||
}
|
||||
Scheduler.restartTimer();
|
||||
}
|
||||
}.bind(this)));
|
||||
},
|
||||
|
||||
/**
|
||||
* Post Telemetry statistics.
|
||||
*
|
||||
* This is only useful on first launch.
|
||||
*/
|
||||
_updateTelemetry: function() {
|
||||
let worker = this.worker;
|
||||
let workerTimeStamps = worker.workerTimeStamps;
|
||||
if (!workerTimeStamps) {
|
||||
// If the first call to OS.File results in an uncaught errors,
|
||||
// the timestamps are absent. As this case is a developer error,
|
||||
// let's not waste time attempting to extract telemetry from it.
|
||||
return;
|
||||
}
|
||||
let HISTOGRAM_LAUNCH = Services.telemetry.getHistogramById("OSFILE_WORKER_LAUNCH_MS");
|
||||
HISTOGRAM_LAUNCH.add(worker.workerTimeStamps.entered - worker.launchTimeStamp);
|
||||
|
||||
let HISTOGRAM_READY = Services.telemetry.getHistogramById("OSFILE_WORKER_READY_MS");
|
||||
HISTOGRAM_READY.add(worker.workerTimeStamps.loaded - worker.launchTimeStamp);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const PREF_OSFILE_LOG = "toolkit.osfile.log";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ if (this.Components) {
|
|||
(function(exports) {
|
||||
"use strict";
|
||||
|
||||
// Timestamps, for use in Telemetry.
|
||||
// The object is set to |null| once it has been sent
|
||||
// to the main thread.
|
||||
let timeStamps = {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ interface nsIParentalControlsService : nsISupports
|
|||
const short ADVANCED_SETTINGS = 17; // Advanced settings
|
||||
const short CAMERA_MICROPHONE = 18; // Camera and microphone (WebRTC)
|
||||
const short BLOCK_LIST = 19; // Block websites that include sensitive content
|
||||
const short TELEMETRY = 20; // Submit telemetry data
|
||||
const short HEALTH_REPORT = 21; // Submit FHR data
|
||||
// 20 and 21 are unused. Was: Telemetry, FHR
|
||||
const short DEFAULT_THEME = 22; // Use default theme or a special parental controls theme
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,6 +145,5 @@ this.InsecurePasswordUtils = {
|
|||
passwordSafety = 5;
|
||||
}
|
||||
|
||||
Services.telemetry.getHistogramById("PWMGR_LOGIN_PAGE_SAFETY").add(passwordSafety);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1068,8 +1068,6 @@ var LoginManagerContent = {
|
|||
}
|
||||
|
||||
// Nothing to do if we have no matching logins available.
|
||||
// Only insecure pages reach this block and logs the same
|
||||
// telemetry flag.
|
||||
if (foundLogins.length == 0) {
|
||||
// We don't log() here since this is a very common case.
|
||||
autofillResult = AUTOFILL_RESULT.NO_SAVED_LOGINS;
|
||||
|
|
@ -1234,9 +1232,6 @@ var LoginManagerContent = {
|
|||
}
|
||||
|
||||
if (!userTriggered) {
|
||||
// Ignore fills as a result of user action for this probe.
|
||||
Services.telemetry.getHistogramById("PWMGR_FORM_AUTOFILL_RESULT").add(autofillResult);
|
||||
|
||||
if (usernameField) {
|
||||
let focusedElement = this._formFillService.focusedInput;
|
||||
if (usernameField == focusedElement &&
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ function Startup() {
|
|||
}
|
||||
|
||||
SignonColumnSort(sortField);
|
||||
Services.telemetry.getKeyedHistogramById("PWMGR_MANAGE_SORTED").add(sortField);
|
||||
});
|
||||
|
||||
LoadSignons();
|
||||
|
|
@ -100,9 +99,6 @@ function Startup() {
|
|||
window.arguments[0] &&
|
||||
window.arguments[0].filterString) {
|
||||
setFilter(window.arguments[0].filterString);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(1);
|
||||
} else {
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(0);
|
||||
}
|
||||
|
||||
FocusFilterBox();
|
||||
|
|
@ -434,7 +430,6 @@ function DeleteAllSignons() {
|
|||
removeButton.setAttribute("disabled", "true");
|
||||
removeAllButton.setAttribute("disabled", "true");
|
||||
FinalizeSignonDeletions(syncNeeded);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED_ALL").add(1);
|
||||
}
|
||||
|
||||
function TogglePasswordVisible() {
|
||||
|
|
@ -449,7 +444,6 @@ function TogglePasswordVisible() {
|
|||
// Notify observers that the password visibility toggling is
|
||||
// completed. (Mostly useful for tests)
|
||||
Services.obs.notifyObservers(null, "passwordmgr-password-toggle-complete", null);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_VISIBILITY_TOGGLED").add(showingPasswords);
|
||||
}
|
||||
|
||||
function AskUserShowPasswords() {
|
||||
|
|
@ -466,7 +460,6 @@ function AskUserShowPasswords() {
|
|||
function FinalizeSignonDeletions(syncNeeded) {
|
||||
for (let s = 0; s < deletedSignons.length; s++) {
|
||||
Services.logins.removeLogin(deletedSignons[s]);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED").add(1);
|
||||
}
|
||||
// If the deletion has been performed in a filtered view, reflect the deletion in the unfiltered table.
|
||||
// See bug 405389.
|
||||
|
|
@ -640,7 +633,6 @@ function CopyPassword() {
|
|||
let row = signonsTree.currentIndex;
|
||||
let password = signonsTreeView.getCellText(row, {id : "passwordCol" });
|
||||
clipboard.copyString(password);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_PASSWORD").add(1);
|
||||
}
|
||||
|
||||
function CopyUsername() {
|
||||
|
|
@ -650,7 +642,6 @@ function CopyUsername() {
|
|||
let row = signonsTree.currentIndex;
|
||||
let username = signonsTreeView.getCellText(row, {id : "userCol" });
|
||||
clipboard.copyString(username);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_USERNAME").add(1);
|
||||
}
|
||||
|
||||
function EditCellInSelectedRow(columnName) {
|
||||
|
|
@ -729,7 +720,7 @@ function escapeKeyHandler() {
|
|||
#if defined(MC_BASILISK) || defined(HYPE_ICEWEASEL)
|
||||
function OpenMigrator() {
|
||||
const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
|
||||
// We pass in the type of source we're using for use in telemetry:
|
||||
// We pass in the type of source we're using:
|
||||
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ LoginManager.prototype = {
|
|||
this._initStorage();
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this._observer, "gather-telemetry", false);
|
||||
},
|
||||
|
||||
|
||||
|
|
@ -168,91 +167,17 @@ LoginManager.prototype = {
|
|||
Services.obs.notifyObservers(null,
|
||||
"passwordmgr-storage-replace-complete", null);
|
||||
}.bind(this));
|
||||
} else if (topic == "gather-telemetry") {
|
||||
// When testing, the "data" parameter is a string containing the
|
||||
// reference time in milliseconds for time-based statistics.
|
||||
this._pwmgr._gatherTelemetry(data ? parseInt(data)
|
||||
: new Date().getTime());
|
||||
} else {
|
||||
log.debug("Oops! Unexpected notification:", topic);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Collects statistics about the current logins and settings. The telemetry
|
||||
* histograms used here are not accumulated, but are reset each time this
|
||||
* function is called, since it can be called multiple times in a session.
|
||||
*
|
||||
* This function might also not be called at all in the current session.
|
||||
*
|
||||
* @param referenceTimeMs
|
||||
* Current time used to calculate time-based statistics, expressed as
|
||||
* the number of milliseconds since January 1, 1970, 00:00:00 UTC.
|
||||
* This is set to a fake value during unit testing.
|
||||
*/
|
||||
_gatherTelemetry(referenceTimeMs) {
|
||||
function clearAndGetHistogram(histogramId) {
|
||||
let histogram = Services.telemetry.getHistogramById(histogramId);
|
||||
histogram.clear();
|
||||
return histogram;
|
||||
}
|
||||
|
||||
clearAndGetHistogram("PWMGR_BLOCKLIST_NUM_SITES").add(
|
||||
this.getAllDisabledHosts({}).length
|
||||
);
|
||||
clearAndGetHistogram("PWMGR_NUM_SAVED_PASSWORDS").add(
|
||||
this.countLogins("", "", "")
|
||||
);
|
||||
clearAndGetHistogram("PWMGR_NUM_HTTPAUTH_PASSWORDS").add(
|
||||
this.countLogins("", null, "")
|
||||
);
|
||||
|
||||
// This is a boolean histogram, and not a flag, because we don't want to
|
||||
// record any value if _gatherTelemetry is not called.
|
||||
clearAndGetHistogram("PWMGR_SAVING_ENABLED").add(this._remember);
|
||||
|
||||
// Don't try to get logins if MP is enabled, since we don't want to show a MP prompt.
|
||||
if (!this.isLoggedIn) {
|
||||
return;
|
||||
}
|
||||
|
||||
let logins = this.getAllLogins({});
|
||||
|
||||
let usernamePresentHistogram = clearAndGetHistogram("PWMGR_USERNAME_PRESENT");
|
||||
let loginLastUsedDaysHistogram = clearAndGetHistogram("PWMGR_LOGIN_LAST_USED_DAYS");
|
||||
|
||||
let hostnameCount = new Map();
|
||||
for (let login of logins) {
|
||||
usernamePresentHistogram.add(!!login.username);
|
||||
|
||||
let hostname = login.hostname;
|
||||
hostnameCount.set(hostname, (hostnameCount.get(hostname) || 0 ) + 1);
|
||||
|
||||
login.QueryInterface(Ci.nsILoginMetaInfo);
|
||||
let timeLastUsedAgeMs = referenceTimeMs - login.timeLastUsed;
|
||||
if (timeLastUsedAgeMs > 0) {
|
||||
loginLastUsedDaysHistogram.add(
|
||||
Math.floor(timeLastUsedAgeMs / MS_PER_DAY)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let passwordsCountHistogram = clearAndGetHistogram("PWMGR_NUM_PASSWORDS_PER_HOSTNAME");
|
||||
for (let count of hostnameCount.values()) {
|
||||
passwordsCountHistogram.add(count);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ---------- Primary Public interfaces ---------- */
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @type Promise
|
||||
* This promise is resolved when initialization is complete, and is rejected
|
||||
|
|
|
|||
|
|
@ -18,14 +18,6 @@ const LoginInfo =
|
|||
|
||||
const BRAND_BUNDLE = "chrome://branding/locale/brand.properties";
|
||||
|
||||
/**
|
||||
* Constants for password prompt telemetry. */
|
||||
const PROMPT_DISPLAYED = 0;
|
||||
|
||||
const PROMPT_ADD_OR_UPDATE = 1;
|
||||
const PROMPT_NOTNOW = 2;
|
||||
const PROMPT_NEVER = 3;
|
||||
|
||||
/**
|
||||
* Implements nsIPromptFactory
|
||||
*
|
||||
|
|
@ -825,7 +817,7 @@ LoginManagerPrompter.prototype = {
|
|||
* new password.
|
||||
* @param {string} type
|
||||
* This is "password-save" or "password-change" depending on the
|
||||
* original notification type. This is used for telemetry and tests.
|
||||
* original notification type. This is used for tests.
|
||||
*/
|
||||
_showLoginCaptureDoorhanger(login, type) {
|
||||
let { browser } = this._getNotifyWindow();
|
||||
|
|
@ -855,11 +847,6 @@ LoginManagerPrompter.prototype = {
|
|||
let promptMsg = type == "password-save" ? this._getLocalizedString(saveMsgNames.prompt, [brandShortName])
|
||||
: this._getLocalizedString(changeMsgNames.prompt);
|
||||
|
||||
let histogramName = type == "password-save" ? "PWMGR_PROMPT_REMEMBER_ACTION"
|
||||
: "PWMGR_PROMPT_UPDATE_ACTION";
|
||||
let histogram = Services.telemetry.getHistogramById(histogramName);
|
||||
histogram.add(PROMPT_DISPLAYED);
|
||||
|
||||
let chromeDoc = browser.ownerDocument;
|
||||
|
||||
let currentNotification;
|
||||
|
|
@ -986,10 +973,6 @@ LoginManagerPrompter.prototype = {
|
|||
label: this._getLocalizedString(initialMsgNames.buttonLabel),
|
||||
accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey),
|
||||
callback: () => {
|
||||
histogram.add(PROMPT_ADD_OR_UPDATE);
|
||||
if (histogramName == "PWMGR_PROMPT_REMEMBER_ACTION") {
|
||||
Services.obs.notifyObservers(null, 'LoginStats:NewSavedPassword', null);
|
||||
}
|
||||
readDataFromUI();
|
||||
persistData();
|
||||
browser.focus();
|
||||
|
|
@ -1001,7 +984,6 @@ LoginManagerPrompter.prototype = {
|
|||
label: this._getLocalizedString("notifyBarNeverRememberButtonText"),
|
||||
accessKey: this._getLocalizedString("notifyBarNeverRememberButtonAccessKey"),
|
||||
callback: () => {
|
||||
histogram.add(PROMPT_NEVER);
|
||||
Services.logins.setLoginSavingEnabled(login.hostname, false);
|
||||
browser.focus();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "console",
|
|||
"resource://gre/modules/Console.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PerformanceWatcher",
|
||||
"resource://gre/modules/PerformanceWatcher.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
|
||||
"@mozilla.org/base/telemetry;1",
|
||||
Ci.nsITelemetry);
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "IdleService",
|
||||
|
|
@ -123,15 +120,6 @@ this.AddonWatcher = {
|
|||
return;
|
||||
}
|
||||
|
||||
// Report immediately to Telemetry, regardless of whether we report to
|
||||
// the user.
|
||||
for (let {source: {addonId}, details} of addons) {
|
||||
Telemetry.getKeyedHistogramById("PERF_MONITORING_SLOW_ADDON_JANK_US").
|
||||
add(addonId, details.highestJank);
|
||||
Telemetry.getKeyedHistogramById("PERF_MONITORING_SLOW_ADDON_CPOW_US").
|
||||
add(addonId, details.highestCPOW);
|
||||
}
|
||||
|
||||
// We expect that users don't care about real-time alerts unless their
|
||||
// browser is going very, very slowly. Therefore, we use the following
|
||||
// heuristic:
|
||||
|
|
|
|||
|
|
@ -220,14 +220,6 @@ this.BookmarkHTMLUtils = Object.freeze({
|
|||
let exporter = new BookmarkExporter(bookmarks);
|
||||
yield exporter.exportToFile(aFilePath);
|
||||
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_EXPORT_TOHTML_MS")
|
||||
.add(Date.now() - startTime);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
}
|
||||
|
||||
return count;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -144,14 +144,6 @@ this.BookmarkJSONUtils = Object.freeze({
|
|||
let [bookmarks, count] = yield PlacesBackups.getBookmarksTree();
|
||||
let startTime = Date.now();
|
||||
let jsonString = JSON.stringify(bookmarks);
|
||||
// Report the time taken to convert the tree to JSON.
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_BACKUPS_TOJSON_MS")
|
||||
.add(Date.now() - startTime);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
}
|
||||
|
||||
let hash = generateHash(jsonString);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 expandtab filetype=javascript
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -537,13 +536,6 @@ this.PlacesBackups = {
|
|||
includeItemIds: true
|
||||
});
|
||||
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_BACKUPS_BOOKMARKSTREE_MS")
|
||||
.add(Date.now() - startTime);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
}
|
||||
return [root, root.itemsCount];
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 expandtab
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -10,9 +9,6 @@ const Cc = Components.classes;
|
|||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
// Fired by TelemetryController when async telemetry data should be collected.
|
||||
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
|
||||
|
||||
// Seconds between maintenance runs.
|
||||
const MAINTENANCE_INTERVAL_SECONDS = 7 * 86400;
|
||||
|
||||
|
|
@ -30,7 +26,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesDBUtils",
|
|||
*/
|
||||
function PlacesCategoriesStarter()
|
||||
{
|
||||
Services.obs.addObserver(this, TOPIC_GATHER_TELEMETRY, false);
|
||||
Services.obs.addObserver(this, PlacesUtils.TOPIC_SHUTDOWN, false);
|
||||
|
||||
// nsINavBookmarkObserver implementation.
|
||||
|
|
@ -63,7 +58,6 @@ PlacesCategoriesStarter.prototype = {
|
|||
switch (aTopic) {
|
||||
case PlacesUtils.TOPIC_SHUTDOWN:
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_SHUTDOWN);
|
||||
Services.obs.removeObserver(this, TOPIC_GATHER_TELEMETRY);
|
||||
let globalObj =
|
||||
Cu.getGlobalForObject(PlacesCategoriesStarter.prototype);
|
||||
let descriptor =
|
||||
|
|
@ -72,9 +66,6 @@ PlacesCategoriesStarter.prototype = {
|
|||
PlacesDBUtils.shutdown();
|
||||
}
|
||||
break;
|
||||
case TOPIC_GATHER_TELEMETRY:
|
||||
PlacesDBUtils.telemetry();
|
||||
break;
|
||||
case "idle-daily":
|
||||
// Once a week run places.sqlite maintenance tasks.
|
||||
let lastMaintenance =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 expandtab filetype=javascript
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -51,13 +50,6 @@ this.PlacesDBUtils = {
|
|||
}
|
||||
else {
|
||||
// All tasks have been completed.
|
||||
// Telemetry the time it took for maintenance, if a start time exists.
|
||||
if (aTasks._telemetryStart) {
|
||||
Services.telemetry.getHistogramById("PLACES_IDLE_MAINTENANCE_TIME_MS")
|
||||
.add(Date.now() - aTasks._telemetryStart);
|
||||
aTasks._telemetryStart = 0;
|
||||
}
|
||||
|
||||
if (aTasks.callback) {
|
||||
let scope = aTasks.scope || Cu.getGlobalForObject(aTasks.callback);
|
||||
aTasks.callback.call(scope, aTasks.messages);
|
||||
|
|
@ -89,7 +81,6 @@ this.PlacesDBUtils = {
|
|||
, this.checkCoherence
|
||||
, this._refreshUI
|
||||
]);
|
||||
tasks._telemetryStart = Date.now();
|
||||
tasks.callback = function() {
|
||||
Services.prefs.setIntPref("places.database.lastMaintenance",
|
||||
parseInt(Date.now() / 1000));
|
||||
|
|
@ -856,181 +847,6 @@ this.PlacesDBUtils = {
|
|||
PlacesDBUtils._executeTasks(tasks);
|
||||
},
|
||||
|
||||
/**
|
||||
* Collects telemetry data and reports it to Telemetry.
|
||||
*
|
||||
* @param [optional] aTasks
|
||||
* Tasks object to execute.
|
||||
*/
|
||||
telemetry: function PDBU_telemetry(aTasks)
|
||||
{
|
||||
let tasks = new Tasks(aTasks);
|
||||
|
||||
// This will be populated with one integer property for each probe result,
|
||||
// using the histogram name as key.
|
||||
let probeValues = {};
|
||||
|
||||
// The following array contains an ordered list of entries that are
|
||||
// processed to collect telemetry data. Each entry has these properties:
|
||||
//
|
||||
// histogram: Name of the telemetry histogram to update.
|
||||
// query: This is optional. If present, contains a database command
|
||||
// that will be executed asynchronously, and whose result will
|
||||
// be added to the telemetry histogram.
|
||||
// callback: This is optional. If present, contains a function that must
|
||||
// return the value that will be added to the telemetry
|
||||
// histogram. If a query is also present, its result is passed
|
||||
// as the first argument of the function. If the function
|
||||
// raises an exception, no data is added to the histogram.
|
||||
//
|
||||
// Since all queries are executed in order by the database backend, the
|
||||
// callbacks can also use the result of previous queries stored in the
|
||||
// probeValues object.
|
||||
let probes = [
|
||||
{ histogram: "PLACES_PAGES_COUNT",
|
||||
query: "SELECT count(*) FROM moz_places" },
|
||||
|
||||
{ histogram: "PLACES_BOOKMARKS_COUNT",
|
||||
query: `SELECT count(*) FROM moz_bookmarks b
|
||||
JOIN moz_bookmarks t ON t.id = b.parent
|
||||
AND t.parent <> :tags_folder
|
||||
WHERE b.type = :type_bookmark` },
|
||||
|
||||
{ histogram: "PLACES_TAGS_COUNT",
|
||||
query: `SELECT count(*) FROM moz_bookmarks
|
||||
WHERE parent = :tags_folder` },
|
||||
|
||||
{ histogram: "PLACES_KEYWORDS_COUNT",
|
||||
query: "SELECT count(*) FROM moz_keywords" },
|
||||
|
||||
{ histogram: "PLACES_SORTED_BOOKMARKS_PERC",
|
||||
query: `SELECT IFNULL(ROUND((
|
||||
SELECT count(*) FROM moz_bookmarks b
|
||||
JOIN moz_bookmarks t ON t.id = b.parent
|
||||
AND t.parent <> :tags_folder AND t.parent > :places_root
|
||||
WHERE b.type = :type_bookmark
|
||||
) * 100 / (
|
||||
SELECT count(*) FROM moz_bookmarks b
|
||||
JOIN moz_bookmarks t ON t.id = b.parent
|
||||
AND t.parent <> :tags_folder
|
||||
WHERE b.type = :type_bookmark
|
||||
)), 0)` },
|
||||
|
||||
{ histogram: "PLACES_TAGGED_BOOKMARKS_PERC",
|
||||
query: `SELECT IFNULL(ROUND((
|
||||
SELECT count(*) FROM moz_bookmarks b
|
||||
JOIN moz_bookmarks t ON t.id = b.parent
|
||||
AND t.parent = :tags_folder
|
||||
) * 100 / (
|
||||
SELECT count(*) FROM moz_bookmarks b
|
||||
JOIN moz_bookmarks t ON t.id = b.parent
|
||||
AND t.parent <> :tags_folder
|
||||
WHERE b.type = :type_bookmark
|
||||
)), 0)` },
|
||||
|
||||
{ histogram: "PLACES_DATABASE_FILESIZE_MB",
|
||||
callback: function () {
|
||||
let DBFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
|
||||
DBFile.append("places.sqlite");
|
||||
return parseInt(DBFile.fileSize / BYTES_PER_MEBIBYTE);
|
||||
}
|
||||
},
|
||||
|
||||
{ histogram: "PLACES_DATABASE_PAGESIZE_B",
|
||||
query: "PRAGMA page_size /* PlacesDBUtils.jsm PAGESIZE_B */" },
|
||||
|
||||
{ histogram: "PLACES_DATABASE_SIZE_PER_PAGE_B",
|
||||
query: "PRAGMA page_count",
|
||||
callback: function (aDbPageCount) {
|
||||
// Note that the database file size would not be meaningful for this
|
||||
// calculation, because the file grows in fixed-size chunks.
|
||||
let dbPageSize = probeValues.PLACES_DATABASE_PAGESIZE_B;
|
||||
let placesPageCount = probeValues.PLACES_PAGES_COUNT;
|
||||
return Math.round((dbPageSize * aDbPageCount) / placesPageCount);
|
||||
}
|
||||
},
|
||||
|
||||
{ histogram: "PLACES_ANNOS_BOOKMARKS_COUNT",
|
||||
query: "SELECT count(*) FROM moz_items_annos" },
|
||||
|
||||
{ histogram: "PLACES_ANNOS_PAGES_COUNT",
|
||||
query: "SELECT count(*) FROM moz_annos" },
|
||||
|
||||
{ histogram: "PLACES_MAINTENANCE_DAYSFROMLAST",
|
||||
callback: function () {
|
||||
try {
|
||||
let lastMaintenance = Services.prefs.getIntPref("places.database.lastMaintenance");
|
||||
let nowSeconds = parseInt(Date.now() / 1000);
|
||||
return parseInt((nowSeconds - lastMaintenance) / 86400);
|
||||
} catch (ex) {
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
let params = {
|
||||
tags_folder: PlacesUtils.tagsFolderId,
|
||||
type_folder: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||
type_bookmark: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||
places_root: PlacesUtils.placesRootId
|
||||
};
|
||||
|
||||
for (let i = 0; i < probes.length; i++) {
|
||||
let probe = probes[i];
|
||||
|
||||
let promiseDone = new Promise((resolve, reject) => {
|
||||
if (!("query" in probe)) {
|
||||
resolve([probe]);
|
||||
return;
|
||||
}
|
||||
|
||||
let stmt = DBConn.createAsyncStatement(probe.query);
|
||||
for (let param in params) {
|
||||
if (probe.query.indexOf(":" + param) > 0) {
|
||||
stmt.params[param] = params[param];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
stmt.executeAsync({
|
||||
handleError: reject,
|
||||
handleResult: function (aResultSet) {
|
||||
let row = aResultSet.getNextRow();
|
||||
resolve([probe, row.getResultByIndex(0)]);
|
||||
},
|
||||
handleCompletion: function () {}
|
||||
});
|
||||
} finally {
|
||||
stmt.finalize();
|
||||
}
|
||||
});
|
||||
|
||||
// Report the result of the probe through Telemetry.
|
||||
// The resulting promise cannot reject.
|
||||
promiseDone.then(
|
||||
// On success
|
||||
([aProbe, aValue]) => {
|
||||
let value = aValue;
|
||||
try {
|
||||
if ("callback" in aProbe) {
|
||||
value = aProbe.callback(value);
|
||||
}
|
||||
probeValues[aProbe.histogram] = value;
|
||||
Services.telemetry.getHistogramById(aProbe.histogram).add(value);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Error adding value " + value +
|
||||
" to histogram " + aProbe.histogram +
|
||||
": " + ex);
|
||||
}
|
||||
},
|
||||
// On failure
|
||||
this._handleError);
|
||||
}
|
||||
|
||||
PlacesDBUtils._executeTasks(tasks);
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs a list of tasks, notifying log messages to the callback.
|
||||
*
|
||||
|
|
@ -1068,7 +884,6 @@ function Tasks(aTasks)
|
|||
this._log = aTasks.messages;
|
||||
this.callback = aTasks.callback;
|
||||
this.scope = aTasks.scope;
|
||||
this._telemetryStart = aTasks._telemetryStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1078,7 +893,6 @@ Tasks.prototype = {
|
|||
_log: [],
|
||||
callback: null,
|
||||
scope: null,
|
||||
_telemetryStart: 0,
|
||||
|
||||
/**
|
||||
* Adds a task to the top of the list.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 expandtab
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -58,9 +57,6 @@ const QUERYTYPE_AUTOFILL_URL = 2;
|
|||
// "comment" back into the title and the tag.
|
||||
const TITLE_TAGS_SEPARATOR = " \u2013 ";
|
||||
|
||||
// Telemetry probes.
|
||||
const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
|
||||
const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
|
||||
// The default frecency value used when inserting matches with unknown frecency.
|
||||
const FRECENCY_DEFAULT = 1000;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,9 +81,6 @@ const kBrowserUrlbarAutofillPref = "autoFill";
|
|||
// Whether to search only typed entries.
|
||||
const kBrowserUrlbarAutofillTypedPref = "autoFill.typed";
|
||||
|
||||
// The Telemetry histogram for urlInlineComplete query on domain
|
||||
const DOMAIN_QUERY_TELEMETRY = "PLACES_AUTOCOMPLETE_URLINLINE_DOMAIN_QUERY_TIME_MS";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Globals
|
||||
|
||||
|
|
@ -553,7 +550,6 @@ nsPlacesAutoComplete.prototype = {
|
|||
queries.push(query);
|
||||
|
||||
// Start executing our queries.
|
||||
this._telemetryStartTime = Date.now();
|
||||
this._executeQueries(queries);
|
||||
|
||||
// Set up our persistent state for the duration of the search.
|
||||
|
|
@ -810,19 +806,6 @@ nsPlacesAutoComplete.prototype = {
|
|||
}
|
||||
result.setSearchResult(Ci.nsIAutoCompleteResult[resultCode]);
|
||||
this._listener.onSearchResult(this, result);
|
||||
if (this._telemetryStartTime) {
|
||||
let elapsed = Date.now() - this._telemetryStartTime;
|
||||
if (elapsed > 50) {
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS")
|
||||
.add(elapsed);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
}
|
||||
}
|
||||
this._telemetryStartTime = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 expandtab
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -708,22 +707,12 @@ nsPlacesExpiration.prototype = {
|
|||
aError.result + "', '" + aError.message + "'");
|
||||
},
|
||||
|
||||
// Number of expiration steps needed to reach a CLEAN status.
|
||||
_telemetrySteps: 1,
|
||||
handleCompletion: function PEX_handleCompletion(aReason)
|
||||
{
|
||||
if (aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
|
||||
if (this._mostRecentExpiredVisitDays) {
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_MOST_RECENT_EXPIRED_VISIT_DAYS")
|
||||
.add(this._mostRecentExpiredVisitDays);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
} finally {
|
||||
delete this._mostRecentExpiredVisitDays;
|
||||
}
|
||||
delete this._mostRecentExpiredVisitDays;
|
||||
}
|
||||
|
||||
if ("_expectedResultsCount" in this) {
|
||||
|
|
@ -734,25 +723,6 @@ nsPlacesExpiration.prototype = {
|
|||
this.status = this._expectedResultsCount == 0 ? STATUS.DIRTY
|
||||
: STATUS.CLEAN;
|
||||
|
||||
// Collect or send telemetry data.
|
||||
if (this.status == STATUS.DIRTY) {
|
||||
this._telemetrySteps++;
|
||||
}
|
||||
else {
|
||||
// Avoid reporting the common cases where the database is clean, or
|
||||
// a single step is needed.
|
||||
if (oldStatus == STATUS.DIRTY) {
|
||||
try {
|
||||
Services.telemetry
|
||||
.getHistogramById("PLACES_EXPIRATION_STEPS_TO_CLEAN2")
|
||||
.add(this._telemetrySteps);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Unable to report telemetry.");
|
||||
}
|
||||
}
|
||||
this._telemetrySteps = 1;
|
||||
}
|
||||
|
||||
delete this._expectedResultsCount;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,9 +198,6 @@ var PrintUtils = {
|
|||
this._sourceBrowser = aListenerObj.getSourceBrowser();
|
||||
this._originalTitle = this._sourceBrowser.contentTitle;
|
||||
this._originalURL = this._sourceBrowser.currentURI.spec;
|
||||
|
||||
// Here we log telemetry data for when the user enters print preview.
|
||||
this.logTelemetry("PRINT_PREVIEW_OPENED_COUNT");
|
||||
} else {
|
||||
// collapse the browser here -- it will be shown in
|
||||
// enterPrintPreview; this forces a reflow which fixes display
|
||||
|
|
@ -536,9 +533,6 @@ var PrintUtils = {
|
|||
URL: this._originalURL,
|
||||
windowID: this._sourceBrowser.outerWindowID,
|
||||
});
|
||||
|
||||
// Here we log telemetry data for when the user enters simplify mode.
|
||||
this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT");
|
||||
}
|
||||
} else {
|
||||
sendEnterPreviewMessage(this._sourceBrowser, false);
|
||||
|
|
@ -597,7 +591,6 @@ var PrintUtils = {
|
|||
if (this._sourceBrowser.isArticle) {
|
||||
printPreviewTB.enableSimplifyPage();
|
||||
} else {
|
||||
this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT");
|
||||
printPreviewTB.disableSimplifyPage();
|
||||
}
|
||||
|
||||
|
|
@ -652,12 +645,6 @@ var PrintUtils = {
|
|||
this._listener.onExit();
|
||||
},
|
||||
|
||||
logTelemetry: function (ID)
|
||||
{
|
||||
let histogram = Services.telemetry.getHistogramById(ID);
|
||||
histogram.add(true);
|
||||
},
|
||||
|
||||
onKeyDownPP: function (aEvent)
|
||||
{
|
||||
// Esc exits the PP
|
||||
|
|
|
|||
|
|
@ -1,5 +1 @@
|
|||
category profile-after-change nsTerminator @mozilla.org/toolkit/shutdown-terminator;1
|
||||
|
||||
component {3f78ada1-cba2-442a-82dd-d5fb300ddea7} nsTerminatorTelemetry.js
|
||||
contract @mozilla.org/toolkit/shutdown-terminator-telemetry;1 {3f78ada1-cba2-442a-82dd-d5fb300ddea7}
|
||||
category profile-after-change nsTerminatorTelemetry @mozilla.org/toolkit/shutdown-terminator-telemetry;1
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ const DEFAULT_CAPTURE_TIMEOUT = 30000; // ms
|
|||
const DESTROY_BROWSER_TIMEOUT = 60000; // ms
|
||||
const FRAME_SCRIPT_URL = "chrome://global/content/backgroundPageThumbsContent.js";
|
||||
|
||||
const TELEMETRY_HISTOGRAM_ID_PREFIX = "FX_THUMBNAILS_BG_";
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
|
|
@ -22,19 +20,6 @@ Cu.import("resource://gre/modules/PageThumbs.jsm");
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
// possible FX_THUMBNAILS_BG_CAPTURE_DONE_REASON_2 telemetry values
|
||||
const TEL_CAPTURE_DONE_OK = 0;
|
||||
const TEL_CAPTURE_DONE_TIMEOUT = 1;
|
||||
// 2 and 3 were used when we had special handling for private-browsing.
|
||||
const TEL_CAPTURE_DONE_CRASHED = 4;
|
||||
const TEL_CAPTURE_DONE_BAD_URI = 5;
|
||||
|
||||
// These are looked up on the global as properties below.
|
||||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_OK", TEL_CAPTURE_DONE_OK);
|
||||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_TIMEOUT", TEL_CAPTURE_DONE_TIMEOUT);
|
||||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_CRASHED", TEL_CAPTURE_DONE_CRASHED);
|
||||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_BAD_URI", TEL_CAPTURE_DONE_BAD_URI);
|
||||
|
||||
const global = this;
|
||||
|
||||
// contains base64 version of a placeholder thumbnail
|
||||
|
|
@ -67,8 +52,6 @@ const BackgroundPageThumbs = {
|
|||
this._captureQueue = this._captureQueue || [];
|
||||
this._capturesByURL = this._capturesByURL || new Map();
|
||||
|
||||
tel("QUEUE_SIZE_ON_CAPTURE", this._captureQueue.length);
|
||||
|
||||
// We want to avoid duplicate captures for the same URL. If there is an
|
||||
// existing one, we just add the callback to that one and we are done.
|
||||
let existing = this._capturesByURL.get(url);
|
||||
|
|
@ -237,7 +220,7 @@ const BackgroundPageThumbs = {
|
|||
// listener. Trying to send a message to the manager in that case
|
||||
// throws NS_ERROR_NOT_INITIALIZED.
|
||||
Services.tm.currentThread.dispatch(() => {
|
||||
curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
|
||||
curCapture._done(null);
|
||||
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
||||
}
|
||||
// else: we must have been idle and not currently doing a capture (eg,
|
||||
|
|
@ -286,9 +269,6 @@ const BackgroundPageThumbs = {
|
|||
throw new Error("The capture should be at the head of the queue.");
|
||||
this._captureQueue.shift();
|
||||
this._capturesByURL.delete(capture.url);
|
||||
if (capture.doneReason != TEL_CAPTURE_DONE_OK) {
|
||||
Services.obs.notifyObservers(null, "page-thumbnail:error", capture.url);
|
||||
}
|
||||
|
||||
// Start the destroy-browser timer *before* processing the capture queue.
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
|
@ -324,7 +304,6 @@ function Capture(url, captureCallback, options) {
|
|||
this.id = Capture.nextID++;
|
||||
this.creationDate = new Date();
|
||||
this.doneCallbacks = [];
|
||||
this.doneReason;
|
||||
if (options.onDone)
|
||||
this.doneCallbacks.push(options.onDone);
|
||||
}
|
||||
|
|
@ -342,7 +321,6 @@ Capture.prototype = {
|
|||
*/
|
||||
start: function (messageManager) {
|
||||
this.startDate = new Date();
|
||||
tel("CAPTURE_QUEUE_TIME_MS", this.startDate - this.creationDate);
|
||||
|
||||
// timeout timer
|
||||
let timeout;
|
||||
|
|
@ -386,46 +364,30 @@ Capture.prototype = {
|
|||
|
||||
// Called when the didCapture message is received.
|
||||
receiveMessage: function (msg) {
|
||||
if (msg.data.imageData)
|
||||
tel("CAPTURE_SERVICE_TIME_MS", new Date() - this.startDate);
|
||||
|
||||
// A different timed-out capture may have finally successfully completed, so
|
||||
// discard messages that aren't meant for this capture.
|
||||
if (msg.data.id != this.id)
|
||||
return;
|
||||
|
||||
if (msg.data.failReason) {
|
||||
let reason = global["TEL_CAPTURE_DONE_" + msg.data.failReason];
|
||||
this._done(null, reason);
|
||||
this._done(null);
|
||||
return;
|
||||
}
|
||||
|
||||
this._done(msg.data, TEL_CAPTURE_DONE_OK);
|
||||
this._done(msg.data);
|
||||
},
|
||||
|
||||
// Called when the timeout timer fires.
|
||||
notify: function () {
|
||||
this._done(null, TEL_CAPTURE_DONE_TIMEOUT);
|
||||
this._done(null);
|
||||
},
|
||||
|
||||
_done: function (data, reason) {
|
||||
_done: function (data) {
|
||||
// Note that _done will be called only once, by either receiveMessage or
|
||||
// notify, since it calls destroy here, which cancels the timeout timer and
|
||||
// removes the didCapture message listener.
|
||||
let { captureCallback, doneCallbacks, options } = this;
|
||||
this.destroy();
|
||||
this.doneReason = reason;
|
||||
|
||||
if (typeof(reason) != "number") {
|
||||
throw new Error("A done reason must be given.");
|
||||
}
|
||||
tel("CAPTURE_DONE_REASON_2", reason);
|
||||
if (data && data.telemetry) {
|
||||
// Telemetry is currently disabled in the content process (bug 680508).
|
||||
for (let id in data.telemetry) {
|
||||
tel(id, data.telemetry[id]);
|
||||
}
|
||||
}
|
||||
|
||||
let done = () => {
|
||||
captureCallback(this);
|
||||
|
|
@ -454,17 +416,6 @@ Capture.prototype = {
|
|||
|
||||
Capture.nextID = 0;
|
||||
|
||||
/**
|
||||
* Adds a value to one of this module's telemetry histograms.
|
||||
*
|
||||
* @param histogramID This is prefixed with this module's ID.
|
||||
* @param value The value to add.
|
||||
*/
|
||||
function tel(histogramID, value) {
|
||||
let id = TELEMETRY_HISTOGRAM_ID_PREFIX + histogramID;
|
||||
Services.telemetry.getHistogramById(id).add(value);
|
||||
}
|
||||
|
||||
function schedule(callback) {
|
||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,14 +215,10 @@ this.PageThumbs = {
|
|||
* fullScale - request that a non-downscaled image be returned.
|
||||
*/
|
||||
captureToCanvas: function (aBrowser, aCanvas, aCallback, aArgs) {
|
||||
let telemetryCaptureTime = new Date();
|
||||
let args = {
|
||||
fullScale: aArgs ? aArgs.fullScale : false
|
||||
};
|
||||
this._captureToCanvas(aBrowser, aCanvas, args, (aCanvas) => {
|
||||
Services.telemetry
|
||||
.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
|
||||
.add(new Date() - telemetryCaptureTime);
|
||||
if (aCallback) {
|
||||
aCallback(aCanvas);
|
||||
}
|
||||
|
|
@ -450,10 +446,7 @@ this.PageThumbs = {
|
|||
*/
|
||||
_store: function PageThumbs__store(aOriginalURL, aFinalURL, aData, aNoOverwrite) {
|
||||
return Task.spawn(function* () {
|
||||
let telemetryStoreTime = new Date();
|
||||
yield PageThumbsStorage.writeData(aFinalURL, aData, aNoOverwrite);
|
||||
Services.telemetry.getHistogramById("FX_THUMBNAILS_STORE_TIME_MS")
|
||||
.add(new Date() - telemetryStoreTime);
|
||||
|
||||
Services.obs.notifyObservers(null, "page-thumbnail:create", aFinalURL);
|
||||
// We've been redirected. Create a copy of the current thumbnail for
|
||||
|
|
|
|||
|
|
@ -169,10 +169,6 @@ const backgroundPageThumbsContent = {
|
|||
id: capture.id,
|
||||
imageData: fileReader.result,
|
||||
finalURL: capture.finalURL,
|
||||
telemetry: {
|
||||
CAPTURE_PAGE_LOAD_TIME_MS: capture.pageLoadTime,
|
||||
CAPTURE_CANVAS_DRAW_TIME_MS: capture.canvasDrawTime,
|
||||
},
|
||||
});
|
||||
};
|
||||
fileReader.readAsArrayBuffer(capture.imageBlob);
|
||||
|
|
|
|||
|
|
@ -90,9 +90,6 @@ var gViewSourceUtils = {
|
|||
* The line number to focus on once the source is loaded.
|
||||
*/
|
||||
viewSourceInBrowser: function(aArgs) {
|
||||
Services.telemetry
|
||||
.getHistogramById("VIEW_SOURCE_IN_BROWSER_OPENED_BOOLEAN")
|
||||
.add(true);
|
||||
let viewSourceBrowser = new ViewSourceBrowser(aArgs.viewSourceBrowser);
|
||||
viewSourceBrowser.loadViewSource(aArgs);
|
||||
},
|
||||
|
|
@ -160,9 +157,6 @@ var gViewSourceUtils = {
|
|||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
Services.telemetry
|
||||
.getHistogramById("VIEW_SOURCE_IN_WINDOW_OPENED_BOOLEAN")
|
||||
.add(true);
|
||||
openDialog("chrome://global/content/viewSource.xul",
|
||||
"_blank",
|
||||
"all,dialog=no",
|
||||
|
|
@ -347,9 +341,6 @@ var gViewSourceUtils = {
|
|||
// Calls the callback, keeping in mind undefined or null values.
|
||||
handleCallBack: function(aCallBack, result, data)
|
||||
{
|
||||
Services.telemetry
|
||||
.getHistogramById("VIEW_SOURCE_EXTERNAL_RESULT_BOOLEAN")
|
||||
.add(result);
|
||||
// if callback is undefined, default to the internal viewer
|
||||
if (aCallBack === undefined) {
|
||||
this.internalViewerFallback(result, data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue