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:
Moonchild 2021-10-29 19:53:54 +00:00 committed by roytam1
commit 44388b01a3
42 changed files with 22 additions and 3581 deletions

View file

@ -135,10 +135,6 @@ static RedirEntry kRedirMap[] = {
{
"support", "chrome://global/content/aboutSupport.xhtml",
nsIAboutModule::ALLOW_SCRIPT
},
{
"telemetry", "chrome://global/content/aboutTelemetry.xhtml",
nsIAboutModule::ALLOW_SCRIPT
#ifdef MOZ_WEBRTC
},
{

View file

@ -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;

View file

@ -329,8 +329,6 @@ function doNotDisturb() {
.getService(Ci.nsIAlertsService)
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
alertService.manualDoNotDisturb = true;
Services.telemetry.getHistogramById("WEB_NOTIFICATION_MENU")
.add(0);
onAlertClose();
}

View file

@ -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

View file

@ -230,7 +230,6 @@ function nsAsyncShutdownService() {
"profileBeforeChange",
"profileChangeTeardown",
"quitApplicationGranted",
"sendTelemetry",
// Child processes
"contentChildShutdown",

View file

@ -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.

View file

@ -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;

View file

@ -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

View file

@ -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",

View file

@ -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.
*/

View file

@ -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";

View file

@ -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 = {

View file

@ -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
/**

View file

@ -145,6 +145,5 @@ this.InsecurePasswordUtils = {
passwordSafety = 5;
}
Services.telemetry.getHistogramById("PWMGR_LOGIN_PAGE_SAFETY").add(passwordSafety);
},
};

View file

@ -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 &&

View file

@ -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

View file

@ -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

View file

@ -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();
}

View file

@ -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:

View file

@ -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;
});
},

View file

@ -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);

View file

@ -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];
})
}

View file

@ -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 =

View file

@ -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.

View file

@ -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;

View file

@ -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;
}
},
/**

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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);
}

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -1,271 +0,0 @@
/* 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/. */
.hidden {
display: none;
}
html {
background-color: -moz-Dialog;
color: -moz-DialogText;
font: message-box;
}
body {
padding: 0px;
margin: 0px;
}
h2 {
font-size: medium;
}
#page-description {
border: 1px solid threedshadow;
margin: 0px;
padding: 10px;
}
#settings {
border: 1px solid lightgrey;
padding: 5px;
}
.description-enabled,
.description-disabled {
margin: 0px;
}
.description-enabled > span {
color: green;
}
.description-disabled > span {
color: red;
}
#ping-picker {
margin-top: 10px;
border: 1px solid lightgrey;
padding: 5px;
}
#ping-source-picker {
margin-left: 5px;
margin-bottom: 10px;
}
.data-section,
.data-subsection {
background-color: -moz-Field;
color: -moz-FieldText;
border-top: 1px solid threedshadow;
border-bottom: 1px solid threedshadow;
margin: 0px;
padding: 10px;
}
.data-section:not(.has-data),
.data-subsection:not(.has-subdata) {
color: gray;
}
.section-name {
font-size: x-large;
display: inline;
}
.has-data .section-name {
cursor: pointer;
}
.toggle-caption {
font-style: italic;
cursor: pointer;
}
.data-section:not(.has-data) .toggle-caption,
.data-subsection:not(.has-subdata) .toggle-caption {
display: none;
}
.empty-caption {
font-style: italic;
}
.has-data .empty-caption,
.has-subdata .empty-caption {
display: none; /* invisible when has-data */
}
.data,
.subdata {
margin: 15px;
display: none;
}
.has-data.expanded .data,
.has-subdata.expanded .subdata {
display: block;
}
.stack-title {
font-size: medium;
font-weight: bold;
text-decoration: underline;
}
#histograms, #addon-histograms, #thread-hang-stats>div {
overflow: hidden;
}
.histogram {
float: left;
border: 1px solid gray;
white-space: nowrap;
padding: 10px;
position: relative; /* required for position:absolute of the contained .copy-node */
}
body[dir="rtl"] .histogram {
float: right;
}
.histogram-title {
text-overflow: ellipsis;
width: 100%;
white-space: nowrap;
overflow: hidden;
}
.keyed-histogram {
white-space: nowrap;
padding: 15px;
position: relative; /* required for position:absolute of the contained .copy-node */
display: block;
overflow: hidden;
}
.keyed-histogram-title {
text-overflow: ellipsis;
width: 100%;
margin: 10px;
font-weight: bold;
font-size: 120%;
white-space: nowrap;
}
.bar {
width: 2em;
margin: 2px;
text-align: center;
float: left;
font-family: monospace;
}
body[dir="rtl"] .bar {
float: right;
}
.bar-inner {
background-color: DeepSkyBlue;
border: 1px solid #0000b0;
}
th {
font-weight: bold;
white-space: nowrap;
text-align: left;
}
body[dir="rtl"] th {
text-align: right;
}
caption {
font-weight: bold;
white-space: nowrap;
text-align: left;
font-size: large;
}
body[dir="rtl"] caption {
text-align: right;
}
.copy-node {
visibility: hidden;
position: absolute;
bottom: 1px;
right: 1px;
}
body[dir="rtl"] .copy-node {
left: 1px;
}
.histogram:hover .copy-node {
visibility: visible;
}
.statebox {
display: none;
}
.filter-ui {
padding-inline-start: 10em;
display: none;
}
.has-data.expanded .filter-ui {
display: inline;
}
.processes-ui {
display: none;
}
.has-data.expanded .processes-ui {
display: initial;
}
.filter-blocked {
display: none;
}
#raw-ping-data-section {
width: 100%;
height: 100%;
background-color:-moz-Dialog;
}
#raw-ping-data {
background-color:white;
margin: 0px;
}
#hide-raw-ping {
float: right;
cursor: pointer;
font-size: 20px;
background-color:#d8d8d8;
padding: 5px 10px;
}
/* addon subsection style */
.addon-caption {
font-size: larger;
margin: 5px 0;
}
.process-picker {
margin: 0 0.5em;
}

File diff suppressed because it is too large Load diff

View file

@ -1,290 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> %htmlDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> %brandDTD;
<!ENTITY % aboutTelemetryDTD SYSTEM "chrome://global/locale/aboutTelemetry.dtd"> %aboutTelemetryDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&aboutTelemetry.pageTitle;</title>
<link rel="stylesheet" href="chrome://global/content/aboutTelemetry.css"
type="text/css"/>
<script type="application/javascript;version=1.7"
src="chrome://global/content/aboutTelemetry.js"/>
</head>
<body dir="&locale.dir;">
<header id="page-description">
<h1>&aboutTelemetry.pageTitle;</h1>
<h2 id="page-subtitle"></h2>
<table id="settings">
<tr>
<td>
<p id="description-upload-enabled" class="description-enabled">&aboutTelemetry.uploadEnabled;</p>
<p id="description-upload-disabled" class="description-disabled">&aboutTelemetry.uploadDisabled;</p>
</td>
<td>
<a href="" class="change-data-choices-link">&aboutTelemetry.changeDataChoices;</a>
</td>
</tr>
<tr>
<td>
<p id="description-extended-recording-enabled" class="description-enabled">&aboutTelemetry.extendedRecordingEnabled;</p>
<p id="description-extended-recording-disabled" class="description-disabled">&aboutTelemetry.extendedRecordingDisabled;</p>
</td>
<td>
<a href="" class="change-data-choices-link">&aboutTelemetry.changeDataChoices;</a>
</td>
</tr>
</table>
<div id="ping-picker">
<div id="ping-source-picker">
&aboutTelemetry.pingDataSource;<br/>
<input type="radio" id="ping-source-current" name="choose-ping-source" value="current" checked="checked" />
&aboutTelemetry.showCurrentPingData;<br />
<input type="radio" id="ping-source-archive" name="choose-ping-source" value="archive" />
&aboutTelemetry.showArchivedPingData;<br />
</div>
<div id="ping-source-picker">
&aboutTelemetry.pingDataDisplay;<br/>
<input type="radio" id="ping-source-structured" name="choose-ping-display" value="structured" checked="checked" />
&aboutTelemetry.structured;<br />
<input type="radio" id="ping-source-raw" name="choose-ping-display" value="raw" />
&aboutTelemetry.raw;<br />
</div>
<div id="current-ping-picker">
<input id="show-subsession-data" type="checkbox" checked="checked" />&aboutTelemetry.showSubsessionData;
</div>
<div id="archived-ping-picker" class="hidden">
&aboutTelemetry.choosePing;<br />
<button id="newer-ping" type="button">&aboutTelemetry.showNewerPing;</button>
<button id="older-ping" type="button">&aboutTelemetry.showOlderPing;</button><br />
<table>
<tr>
<th>&aboutTelemetry.archiveWeekHeader;</th>
<th>&aboutTelemetry.archivePingHeader;</th>
</tr>
<tr>
<td>
<select id="choose-ping-week">
</select>
</td>
<td>
<select id="choose-ping-id">
</select>
</td>
</tr>
</table>
</div>
<table>
<tr>
<th>&aboutTelemetry.payloadChoiceHeader;</th>
</tr>
<tr>
<td>
<select id="choose-payload">
</select>
</td>
</tr>
</table>
</div>
</header>
<div id="raw-ping-data-section" class="hidden">
<pre id="raw-ping-data"></pre>
</div>
<div id="structured-ping-data-section">
<section id="general-data-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.generalDataSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="general-data" class="data">
</div>
</section>
<section id="environment-data-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.environmentDataSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="environment-data" class="data">
</div>
</section>
<section id="session-info-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.sessionInfoSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="session-info" class="data">
</div>
</section>
<section id="scalars-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.scalarsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="scalars" class="data">
</div>
</section>
<section id="keyed-scalars-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.keyedScalarsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="keyed-scalars" class="data">
</div>
</section>
<section id="histograms-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.histogramsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<span class="filter-ui">
&aboutTelemetry.filterText; <input type="text" class="filter" id="histograms-filter" target_id="histograms"/>
</span>
<div class="processes-ui">
<select id="histograms-processes" class="process-picker"></select>
</div>
<div id="histograms" class="data">
</div>
</section>
<section id="keyed-histograms-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.keyedHistogramsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div class="processes-ui">
<select id="keyed-histograms-processes" class="process-picker"></select>
</div>
<div id="keyed-histograms" class="data">
</div>
</section>
<section id="events-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">Events</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="events" class="data">
</div>
</section>
<section id="simple-measurements-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.simpleMeasurementsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="simple-measurements" class="data">
</div>
</section>
<section id="telemetry-log-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.telemetryLogSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="telemetry-log" class="data">
</div>
</section>
<section id="slow-sql-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.slowSqlSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="slow-sql-tables" class="data">
<p id="sql-warning" class="hidden">&aboutTelemetry.fullSqlWarning;</p>
</div>
</section>
<section id="chrome-hangs-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.chromeHangsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="chrome-hangs" class="data">
<a id="chrome-hangs-fetch-symbols" href="#">&aboutTelemetry.fetchSymbols;</a>
<a id="chrome-hangs-hide-symbols" class="hidden" href="#">&aboutTelemetry.hideSymbols;</a>
<br/>
<br/>
<div id="chrome-hangs-data">
</div>
</div>
</section>
<section id="thread-hang-stats-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.threadHangStatsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="thread-hang-stats" class="data">
</div>
</section>
<section id="late-writes-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.lateWritesSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="late-writes" class="data">
<a id="late-writes-fetch-symbols" href="#">&aboutTelemetry.fetchSymbols;</a>
<a id="late-writes-hide-symbols" class="hidden" href="#">&aboutTelemetry.hideSymbols;</a>
<br/>
<br/>
<div id="late-writes-data">
</div>
</div>
</section>
<section id="addon-details-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.addonDetailsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="addon-details" class="data">
</div>
</section>
<section id="addon-histograms-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.addonHistogramsSection;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="addon-histograms" class="data">
</div>
</section>
<section id="raw-payload-section" class="data-section">
<input type="checkbox" class="statebox"/>
<h1 class="section-name">&aboutTelemetry.rawPayload;</h1>
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
<div id="raw-payload-data" class="data">
<pre id="raw-payload-data-pre"></pre>
</div>
</section>
</div>
</body>
</html>

View file

@ -30,9 +30,6 @@ toolkit.jar:
#endif
* content/global/aboutSupport.js
* content/global/aboutSupport.xhtml
content/global/aboutTelemetry.js
content/global/aboutTelemetry.xhtml
content/global/aboutTelemetry.css
content/global/directionDetector.html
content/global/plugins.html
content/global/plugins.css

View file

@ -169,7 +169,6 @@ function safeCall(aCallback, ...aArgs) {
*/
function reportProviderError(aProvider, aMethod, aError) {
let method = `provider ${providerName(aProvider)}.${aMethod}`;
AddonManagerPrivate.recordException("AMI", method, aError);
logger.error("Exception calling " + method, aError);
}
@ -632,12 +631,6 @@ var AddonManagerInternal = {
providerShutdowns: new Map(),
types: {},
startupChanges: {},
// Store telemetry details per addon provider
telemetryDetails: {},
recordTimestamp: function(name, value) {
this.TelemetryTimestamps.add(name, value);
},
validateBlocklist: function() {
let appBlocklist = FileUtils.getFile(KEY_APPDIR, [FILE_BLOCKLIST]);
@ -749,7 +742,6 @@ var AddonManagerInternal = {
})
.catch(err => {
logger.warn("Failure during shutdown of " + name, err);
AddonManagerPrivate.recordException("AMI", "Async shutdown of " + name, err);
});
};
logger.debug("Registering shutdown blocker for " + name);
@ -771,12 +763,6 @@ var AddonManagerInternal = {
if (gStarted)
return;
this.recordTimestamp("AMI_startup_begin");
// clear this for xpcshell test restarts
for (let provider in this.telemetryDetails)
delete this.telemetryDetails[provider];
let appChanged = undefined;
let oldAppVersion = null;
@ -823,7 +809,6 @@ var AddonManagerInternal = {
Services.prefs.addObserver(PREF_EM_AUTOUPDATE_DEFAULT, this, false);
let defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED, true);
AddonManagerPrivate.recordSimpleMeasure("default_providers", defaultProvidersEnabled);
// Ensure all default providers have had a chance to register themselves
if (defaultProvidersEnabled) {
@ -837,12 +822,10 @@ var AddonManagerInternal = {
if ((syms.length < 1) ||
(typeof scope[syms[0]].startup != "function")) {
logger.warn("Provider " + url + " has no startup()");
AddonManagerPrivate.recordException("AMI", "provider " + url, "no startup()");
}
logger.debug("Loaded provider scope for " + url + ": " + Object.keys(scope).toSource());
}
catch (e) {
AddonManagerPrivate.recordException("AMI", "provider " + url + " load failed", e);
logger.error("Exception loading default provider \"" + url + "\"", e);
}
};
@ -861,7 +844,6 @@ var AddonManagerInternal = {
logger.debug(`Loaded provider scope for ${url}`);
}
catch (e) {
AddonManagerPrivate.recordException("AMI", "provider " + url + " load failed", e);
logger.error("Exception loading provider " + entry + " from category \"" +
url + "\"", e);
}
@ -887,11 +869,9 @@ var AddonManagerInternal = {
}
gStartupComplete = true;
this.recordTimestamp("AMI_startup_end");
}
catch (e) {
logger.error("startup failed", e);
AddonManagerPrivate.recordException("AMI", "startup failed", e);
}
logger.debug("Completed startup sequence");
@ -1106,7 +1086,6 @@ var AddonManagerInternal = {
catch(err) {
savedError = err;
logger.error("Failure during wait for shutdown barrier", err);
AddonManagerPrivate.recordException("AMI", "Async shutdown of AddonManager providers", err);
}
}
@ -1119,7 +1098,6 @@ var AddonManagerInternal = {
catch(err) {
savedError = err;
logger.error("Failure during AddonRepository shutdown", err);
AddonManagerPrivate.recordException("AMI", "Async shutdown of AddonRepository", err);
}
logger.debug("Async provider shutdown done");
@ -2519,56 +2497,6 @@ this.AddonManagerPrivate = {
AddonType: AddonType,
recordTimestamp: function(name, value) {
AddonManagerInternal.recordTimestamp(name, value);
},
_simpleMeasures: {},
recordSimpleMeasure: function(name, value) {
this._simpleMeasures[name] = value;
},
recordException: function(aModule, aContext, aException) {
let report = {
module: aModule,
context: aContext
};
if (typeof aException == "number") {
report.message = Components.Exception("", aException).name;
}
else {
report.message = aException.toString();
if (aException.fileName) {
report.file = aException.fileName;
report.line = aException.lineNumber;
}
}
this._simpleMeasures.exception = report;
},
getSimpleMeasures: function() {
return this._simpleMeasures;
},
getTelemetryDetails: function() {
return AddonManagerInternal.telemetryDetails;
},
setTelemetryDetails: function(aProvider, aDetails) {
AddonManagerInternal.telemetryDetails[aProvider] = aDetails;
},
// Start a timer, record a simple measure of the time interval when
// timer.done() is called
simpleTimer: function(aName) {
let startTime = Cu.now();
return {
done: () => this.recordSimpleMeasure(aName, Math.round(Cu.now() - startTime))
};
},
/**
* Helper to call update listeners when no update is available.
*
@ -2970,7 +2898,6 @@ this.AddonManager = {
};
// load the timestamps module into AddonManagerInternal
Cu.import("resource://gre/modules/TelemetryTimestamps.jsm", AddonManagerInternal);
Object.freeze(AddonManagerInternal);
Object.freeze(AddonManagerPrivate);
Object.freeze(AddonManager);

View file

@ -243,17 +243,6 @@ var gVersionInfoPage = {
onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() {
AddonManager.removeAddonListener(listener);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_disabled",
gUpdateWizard.disabled);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_metadata_enabled",
gUpdateWizard.metadataEnabled);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_metadata_disabled",
gUpdateWizard.metadataDisabled);
// Record 0 for these here in case we exit early; values will be replaced
// later if we actually upgrade any.
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgraded", 0);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed", 0);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined", 0);
// Filter out any add-ons that are now enabled.
// Tycho:
// logger.debug("VersionInfo updates finished: found " +
@ -563,12 +552,6 @@ var gInstallingPage = {
if (this._installs.length == this._currentInstall) {
Services.obs.notifyObservers(null, "TEST:all-updates-done", null);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgraded",
gUpdateWizard.upgraded);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed",
gUpdateWizard.upgradeFailed);
AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined",
gUpdateWizard.upgradeDeclined);
this._installing = false;
if (gUpdateWizard.shuttingDown) {
return;

View file

@ -463,7 +463,6 @@ var GMPProvider = {
configureLogging();
this._log = Log.repository.getLoggerWithMessagePrefix("Toolkit.GMP",
"GMPProvider.");
let telemetry = {};
this.buildPluginList();
this.ensureProperCDMInstallState();
@ -485,14 +484,6 @@ var GMPProvider = {
e.name + " - sandboxing not available?", e);
}
}
if (this.isEnabled) {
telemetry[id] = {
userDisabled: wrapper.userDisabled,
version: wrapper.version,
applyBackgroundUpdates: wrapper.applyBackgroundUpdates,
};
}
}
if (Preferences.get(GMPPrefs.KEY_EME_ENABLED, false)) {
@ -509,8 +500,6 @@ var GMPProvider = {
this._log.warn("startup - adding clearkey CDM failed", e);
}
}
AddonManagerPrivate.setTelemetryDetails("GMP", telemetry);
},
shutdown: function() {

View file

@ -206,7 +206,7 @@ const RESTARTLESS_TYPES = new Set([
"locale",
]);
// Keep track of where we are in startup for telemetry
// Keep track of where we are in startup.
// event happened during XPIDatabase.startup()
const XPI_STARTING = "XPIStarting";
// event happened after startup() but before the final-ui-startup event
@ -1833,13 +1833,11 @@ this.XPIProvider = {
allAppGlobal: true,
// A string listing the enabled add-ons for annotating crash reports
enabledAddons: null,
// Keep track of startup phases for telemetry
// Keep track of startup phases.
runPhase: XPI_STARTING,
// Keep track of the newest file in each add-on, in case we want to
// report it to telemetry.
// report it.
_mostRecentlyModifiedFile: {},
// Per-addon telemetry information
_telemetryDetails: {},
// Experiments are disabled by default. Track ones that are locally enabled.
_enabledExperiments: null,
// A Map from an add-on install to its ID
@ -2009,8 +2007,6 @@ this.XPIProvider = {
}
try {
AddonManagerPrivate.recordTimestamp("XPI_startup_begin");
logger.debug("startup");
this.runPhase = XPI_STARTING;
this.installs = [];
@ -2018,8 +2014,6 @@ this.XPIProvider = {
this.installLocationsByName = {};
// Hook for tests to detect when saving database at shutdown time fails
this._shutdownError = null;
// Clear this at startup for xpcshell test restarts
this._telemetryDetails = {};
// Clear the set of enabled experiments (experiments disabled by default).
this._enabledExperiments = new Set();
@ -2144,21 +2138,7 @@ this.XPIProvider = {
this.enabledAddons = Preferences.get(PREF_EM_ENABLED_ADDONS, "");
if ("nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter) {
// Annotate the crash report with relevant add-on information.
try {
Services.appinfo.annotateCrashReport("Theme", this.currentSkin);
} catch (e) { }
try {
Services.appinfo.annotateCrashReport("EMCheckCompatibility",
AddonManager.checkCompatibility);
} catch (e) { }
this.addAddonsToCrashReporter();
}
try {
AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_begin");
for (let id in this.bootstrappedAddons) {
try {
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
@ -2177,11 +2157,9 @@ this.XPIProvider = {
this.bootstrappedAddons[id].descriptor, e);
}
}
AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_end");
}
catch (e) {
logger.error("bootstrap startup failed", e);
AddonManagerPrivate.recordException("XPI-BOOTSTRAP", "startup failed", e);
}
// Let these shutdown a little earlier when they still have access to most
@ -2200,23 +2178,11 @@ this.XPIProvider = {
}
}, "quit-application-granted", false);
// Detect final-ui-startup for telemetry reporting
Services.obs.addObserver({
observe: function uiStartupObserver(aSubject, aTopic, aData) {
AddonManagerPrivate.recordTimestamp("XPI_finalUIStartup");
XPIProvider.runPhase = XPI_AFTER_UI_STARTUP;
Services.obs.removeObserver(this, "final-ui-startup");
}
}, "final-ui-startup", false);
AddonManagerPrivate.recordTimestamp("XPI_startup_end");
this.extensionsActive = true;
this.runPhase = XPI_BEFORE_UI_STARTUP;
}
catch (e) {
logger.error("startup failed", e);
AddonManagerPrivate.recordException("XPI", "startup failed", e);
}
},
@ -2240,7 +2206,6 @@ this.XPIProvider = {
// If there are pending operations then we must update the list of active
// add-ons
if (Preferences.get(PREF_PENDING_OPERATIONS, false)) {
AddonManagerPrivate.recordSimpleMeasure("XPIDB_pending_ops", 1);
XPIDatabase.updateActiveAddons();
Services.prefs.setBoolPref(PREF_PENDING_OPERATIONS,
!XPIDatabase.writeAddonsList());
@ -2307,11 +2272,8 @@ this.XPIProvider = {
* to be updated, but the metadata check needs to be performed.
*/
shouldForceUpdateCheck: function XPI_shouldForceUpdateCheck(aAppChanged) {
AddonManagerPrivate.recordSimpleMeasure("XPIDB_metadata_age", AddonRepository.metadataAge());
let startupChanges = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
logger.debug("shouldForceUpdateCheck startupChanges: " + startupChanges.toSource());
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startup_disabled", startupChanges.length);
let forceUpdate = [];
if (startupChanges.length > 0) {
@ -2405,10 +2367,6 @@ this.XPIProvider = {
Services.appinfo.annotateCrashReport("Add-ons", data);
}
catch (e) { }
let TelemetrySession =
Cu.import("resource://gre/modules/TelemetrySession.jsm", {}).TelemetrySession;
TelemetrySession.setAddOns(data);
},
/**
@ -3554,11 +3512,7 @@ this.XPIProvider = {
}
}
// Telemetry probe added around getInstallState() to check perf
let telemetryCaptureTime = Cu.now();
let installChanged = XPIStates.getInstallState();
let telemetry = Services.telemetry;
telemetry.getHistogramById("CHECK_ADDONS_MODIFIED_MS").add(Math.round(Cu.now() - telemetryCaptureTime));
if (installChanged) {
updateReasons.push("directoryState");
}
@ -3610,7 +3564,6 @@ this.XPIProvider = {
// If the database needs to be updated then open it and then update it
// from the filesystem
if (updateReasons.length > 0) {
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startup_load_reasons", updateReasons);
XPIDatabase.syncLoadDB(false);
try {
extensionListChanged = this.processFileChanges(manifests,
@ -6431,7 +6384,6 @@ AddonInternal.prototype = {
let message = "Problem with addon " + this.id + " targetPlatforms "
+ JSON.stringify(this.targetPlatforms);
logger.error(message, e);
AddonManagerPrivate.recordException("XPI", message, e);
// don't trust this add-on
return false;
}

View file

@ -431,7 +431,6 @@ this.XPIDatabase = {
// use an Error here so we get a stack trace.
let err = new Error("XPI database modified after shutdown began");
logger.warn(err);
AddonManagerPrivate.recordSimpleMeasure("XPIDB_late_stack", Log.stackTrace(err));
}
if (!this._deferredSave) {
@ -539,7 +538,6 @@ this.XPIDatabase = {
let fstream = null;
let data = "";
try {
let readTimer = AddonManagerPrivate.simpleTimer("XPIDB_syncRead_MS");
logger.debug("Opening XPI database " + this.jsonFile.path);
fstream = Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
@ -557,14 +555,11 @@ this.XPIDatabase = {
data += str.value;
} while (read != 0);
readTimer.done();
this.parseDB(data, aRebuildOnError);
}
catch(e) {
logger.error("Failed to load XPI JSON data from profile", e);
let rebuildTimer = AddonManagerPrivate.simpleTimer("XPIDB_rebuildReadFailed_MS");
this.rebuildDatabase(aRebuildOnError);
rebuildTimer.done();
}
finally {
if (cstream)
@ -586,7 +581,6 @@ this.XPIDatabase = {
// If an async load was also in progress, resolve that promise with our DB;
// otherwise create a resolved promise
if (this._dbPromise) {
AddonManagerPrivate.recordSimpleMeasure("XPIDB_overlapped_load", 1);
this._dbPromise.resolve(this.addonDB);
}
else
@ -599,27 +593,20 @@ this.XPIDatabase = {
* If true, synchronously reconstruct the database from installed add-ons
*/
parseDB: function(aData, aRebuildOnError) {
let parseTimer = AddonManagerPrivate.simpleTimer("XPIDB_parseDB_MS");
try {
// dump("Loaded JSON:\n" + aData + "\n");
let inputAddons = JSON.parse(aData);
// Now do some sanity checks on our JSON db
if (!("schemaVersion" in inputAddons) || !("addons" in inputAddons)) {
parseTimer.done();
// Content of JSON file is bad, need to rebuild from scratch
logger.error("bad JSON file contents");
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError", "badJSON");
let rebuildTimer = AddonManagerPrivate.simpleTimer("XPIDB_rebuildBadJSON_MS");
this.rebuildDatabase(aRebuildOnError);
rebuildTimer.done();
return;
}
if (inputAddons.schemaVersion != DB_SCHEMA) {
// Handle mismatched JSON schema version. For now, we assume
// compatibility for JSON data, though we throw away any fields we
// don't know about (bug 902956)
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError",
"schemaMismatch-" + inputAddons.schemaVersion);
logger.debug("JSON schema mismatch: expected " + DB_SCHEMA +
", actual " + inputAddons.schemaVersion);
// When we rev the schema of the JSON database, we need to make sure we
@ -633,7 +620,6 @@ this.XPIDatabase = {
let newAddon = new DBAddonInternal(loadedAddon);
addonDB.set(newAddon._key, newAddon);
};
parseTimer.done();
this.addonDB = addonDB;
logger.debug("Successfully read XPI database");
this.initialized = true;
@ -641,18 +627,13 @@ this.XPIDatabase = {
catch(e) {
// If we catch and log a SyntaxError from the JSON
// parser, the xpcshell test harness fails the test for us: bug 870828
parseTimer.done();
if (e.name == "SyntaxError") {
logger.error("Syntax error parsing saved XPI JSON data");
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError", "syntax");
}
else {
logger.error("Failed to load XPI JSON data from profile", e);
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError", "other");
}
let rebuildTimer = AddonManagerPrivate.simpleTimer("XPIDB_rebuildReadFailed_MS");
this.rebuildDatabase(aRebuildOnError);
rebuildTimer.done();
}
},
@ -660,7 +641,6 @@ this.XPIDatabase = {
* Upgrade database from earlier (sqlite or RDF) version if available
*/
upgradeDB: function(aRebuildOnError) {
let upgradeTimer = AddonManagerPrivate.simpleTimer("XPIDB_upgradeDB_MS");
try {
let schemaVersion = Services.prefs.getIntPref(PREF_DB_SCHEMA);
if (schemaVersion <= LAST_SQLITE_DB_SCHEMA) {
@ -671,7 +651,6 @@ this.XPIDatabase = {
else {
// we've upgraded before but the JSON file is gone, fall through
// and rebuild from scratch
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError", "dbMissing");
}
}
catch(e) {
@ -681,7 +660,6 @@ this.XPIDatabase = {
}
this.rebuildDatabase(aRebuildOnError);
upgradeTimer.done();
},
/**
@ -689,15 +667,12 @@ this.XPIDatabase = {
* (for example because read permission is denied)
*/
rebuildUnreadableDB: function(aError, aRebuildOnError) {
let rebuildTimer = AddonManagerPrivate.simpleTimer("XPIDB_rebuildUnreadableDB_MS");
logger.warn("Extensions database " + this.jsonFile.path +
" exists but is not readable; rebuilding", aError);
// Remember the error message until we try and write at least once, so
// we know at shutdown time that there was a problem
this._loadError = aError;
AddonManagerPrivate.recordSimpleMeasure("XPIDB_startupError", "unreadable");
this.rebuildDatabase(aRebuildOnError);
rebuildTimer.done();
},
/**
@ -715,24 +690,19 @@ this.XPIDatabase = {
}
logger.debug("Starting async load of XPI database " + this.jsonFile.path);
AddonManagerPrivate.recordSimpleMeasure("XPIDB_async_load", XPIProvider.runPhase);
let readOptions = {
outExecutionDuration: 0
};
return this._dbPromise = OS.File.read(this.jsonFile.path, null, readOptions).then(
byteArray => {
logger.debug("Async JSON file read took " + readOptions.outExecutionDuration + " MS");
AddonManagerPrivate.recordSimpleMeasure("XPIDB_asyncRead_MS",
readOptions.outExecutionDuration);
if (this._addonDB) {
logger.debug("Synchronous load completed while waiting for async load");
return this.addonDB;
}
logger.debug("Finished async read of XPI database, parsing...");
let decodeTimer = AddonManagerPrivate.simpleTimer("XPIDB_decode_MS");
let decoder = new TextDecoder();
let data = decoder.decode(byteArray);
decodeTimer.done();
this.parseDB(data, true);
return this.addonDB;
})
@ -1009,21 +979,11 @@ this.XPIDatabase = {
this.initialized = false;
if (this._deferredSave) {
AddonManagerPrivate.recordSimpleMeasure(
"XPIDB_saves_total", this._deferredSave.totalSaves);
AddonManagerPrivate.recordSimpleMeasure(
"XPIDB_saves_overlapped", this._deferredSave.overlappedSaves);
AddonManagerPrivate.recordSimpleMeasure(
"XPIDB_saves_late", this._deferredSave.dirty ? 1 : 0);
}
// Return a promise that any pending writes of the DB are complete and we
// are finished cleaning up
let flushPromise = this.flush();
flushPromise.then(null, error => {
logger.error("Flush of XPI database failed", error);
AddonManagerPrivate.recordSimpleMeasure("XPIDB_shutdownFlush_failed", 1);
// If our last attempt to read or write the DB failed, force a new
// extensions.ini to be written to disk on the next startup
Services.prefs.setBoolPref(PREF_PENDING_OPERATIONS, true);
@ -1142,7 +1102,6 @@ this.XPIDatabase = {
// an XPI theme to a lightweight theme before the DB has loaded,
// because we're called from sync XPIProvider.addonChanged
logger.warn("Synchronous load of XPI database due to getAddonsByType(" + aType + ")");
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_byType", XPIProvider.runPhase);
this.syncLoadDB(true);
}
return _filterDB(this.addonDB, aAddon => (aAddon.type == aType));
@ -1159,8 +1118,6 @@ this.XPIDatabase = {
if (!this.addonDB) {
// This may be called when the DB hasn't otherwise been loaded
logger.warn("Synchronous load of XPI database due to getVisibleAddonForInternalName");
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_forInternalName",
XPIProvider.runPhase);
this.syncLoadDB(true);
}
@ -1231,8 +1188,6 @@ this.XPIDatabase = {
*/
addAddonMetadata: function XPIDB_addAddonMetadata(aAddon, aDescriptor) {
if (!this.addonDB) {
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_addMetadata",
XPIProvider.runPhase);
this.syncLoadDB(false);
}
@ -1361,8 +1316,6 @@ this.XPIDatabase = {
if (!this.addonDB) {
logger.warn("updateActiveAddons called when DB isn't loaded");
// force the DB to load
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_updateActive",
XPIProvider.runPhase);
this.syncLoadDB(true);
}
logger.debug("Updating add-on states");
@ -1382,8 +1335,6 @@ this.XPIDatabase = {
writeAddonsList: function XPIDB_writeAddonsList() {
if (!this.addonDB) {
// force the DB to load
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_writeList",
XPIProvider.runPhase);
this.syncLoadDB(true);
}
Services.appinfo.invalidateCachesOnRestart();