summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/osfile/modules/osfile_async_front.jsm4
-rw-r--r--toolkit/components/places/UnifiedComplete.js14
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.js5
-rw-r--r--toolkit/components/search/current/nsSearchService.js6
-rw-r--r--toolkit/components/telemetry/TelemetryStopwatch.jsm335
-rw-r--r--toolkit/components/telemetry/moz.build1
-rw-r--r--toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js156
-rw-r--r--toolkit/components/telemetry/tests/unit/xpcshell.ini1
-rw-r--r--toolkit/content/widgets/tabbox.xml22
9 files changed, 0 insertions, 544 deletions
diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm
index 964e53084..93c7e66d6 100644
--- a/toolkit/components/osfile/modules/osfile_async_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_async_front.jsm
@@ -56,7 +56,6 @@ Cu.import("resource://gre/modules/Task.jsm", this);
// The implementation of communications
Cu.import("resource://gre/modules/PromiseWorker.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
-Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
Cu.import("resource://gre/modules/AsyncShutdown.jsm", this);
var Native = Cu.import("resource://gre/modules/osfile/osfile_native.jsm", {});
@@ -1171,13 +1170,10 @@ File.writeAtomic = function writeAtomic(path, buffer, options = {}) {
if (isTypedArray(buffer) && (!("bytes" in options))) {
options.bytes = buffer.byteLength;
};
- let refObj = {};
- TelemetryStopwatch.start("OSFILE_WRITEATOMIC_JANK_MS", refObj);
let promise = Scheduler.post("writeAtomic",
[Type.path.toMsg(path),
Type.void_t.in_ptr.toMsg(buffer),
options], [options, buffer, path]);
- TelemetryStopwatch.finish("OSFILE_WRITEATOMIC_JANK_MS", refObj);
return promise;
};
diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js
index acd358b11..2efae9cbe 100644
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -262,8 +262,6 @@ Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
@@ -887,10 +885,6 @@ Search.prototype = {
if (!this.pending)
return;
- TelemetryStopwatch.start(TELEMETRY_1ST_RESULT, this);
- if (this._searchString)
- TelemetryStopwatch.start(TELEMETRY_6_FIRST_RESULTS, this);
-
// Since we call the synchronous parseSubmissionURL function later, we must
// wait for the initialization of PlacesSearchAutocompleteProvider first.
yield PlacesSearchAutocompleteProvider.ensureInitialized();
@@ -1468,9 +1462,6 @@ Search.prototype = {
},
_onResultRow: function (row) {
- if (this._localMatchesCount == 0) {
- TelemetryStopwatch.finish(TELEMETRY_1ST_RESULT, this);
- }
let queryType = row.getResultByIndex(QUERYINDEX_QUERYTYPE);
let match;
switch (queryType) {
@@ -1566,9 +1557,6 @@ Search.prototype = {
match.style,
match.finalCompleteValue);
- if (this._result.matchCount == 6)
- TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, this);
-
this.notifyResults(true);
},
@@ -2088,8 +2076,6 @@ UnifiedComplete.prototype = {
* results or not.
*/
finishSearch: function (notify=false) {
- TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
- TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
// Clear state now to avoid race conditions, see below.
let search = this._currentSearch;
if (!search)
diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js
index 29bdae4c1..9c6452ecd 100644
--- a/toolkit/components/places/nsPlacesAutoComplete.js
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -8,8 +8,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@@ -1510,8 +1508,6 @@ urlInlineComplete.prototype = {
// Do a synchronous search on the table of hosts.
let query = this._hostQuery;
query.params.search_string = this._currentSearchString.toLowerCase();
- // This is just to measure the delay to reach the UI, not the query time.
- TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
handleResult: aResultSet => {
if (this._pendingSearch != pendingSearch)
@@ -1541,7 +1537,6 @@ urlInlineComplete.prototype = {
handleCompletion: aReason => {
if (this._pendingSearch != pendingSearch)
return;
- TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
this._finishSearch();
}
}, this._db);
diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js
index 9f9003516..99e73b50b 100644
--- a/toolkit/components/search/current/nsSearchService.js
+++ b/toolkit/components/search/current/nsSearchService.js
@@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData",
"resource://gre/modules/SearchStaticData.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
@@ -3873,21 +3871,17 @@ SearchService.prototype = {
LOG("SearchService.init");
let self = this;
if (!this._initStarted) {
- TelemetryStopwatch.start("SEARCH_SERVICE_INIT_MS");
this._initStarted = true;
Task.spawn(function* task() {
try {
// Complete initialization by calling asynchronous initializer.
yield self._asyncInit();
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} catch (ex) {
if (ex.result == Cr.NS_ERROR_ALREADY_INITIALIZED) {
// No need to pursue asynchronous because synchronous fallback was
// called and has finished.
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} else {
self._initObservers.reject(ex);
- TelemetryStopwatch.cancel("SEARCH_SERVICE_INIT_MS");
}
}
});
diff --git a/toolkit/components/telemetry/TelemetryStopwatch.jsm b/toolkit/components/telemetry/TelemetryStopwatch.jsm
deleted file mode 100644
index ab6c6eafb..000000000
--- a/toolkit/components/telemetry/TelemetryStopwatch.jsm
+++ /dev/null
@@ -1,335 +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/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-this.EXPORTED_SYMBOLS = ["TelemetryStopwatch"];
-
-Cu.import("resource://gre/modules/Log.jsm", this);
-var Telemetry = Cc["@mozilla.org/base/telemetry;1"]
- .getService(Ci.nsITelemetry);
-
-// Weak map does not allow using null objects as keys. These objects are used
-// as 'null' placeholders.
-const NULL_OBJECT = {};
-const NULL_KEY = {};
-
-/**
- * Timers is a variation of a Map used for storing information about running
- * Stopwatches. Timers has the following data structure:
- *
- * {
- * "HISTOGRAM_NAME": WeakMap {
- * Object || NULL_OBJECT: Map {
- * "KEY" || NULL_KEY: startTime
- * ...
- * }
- * ...
- * }
- * ...
- * }
- *
- *
- * @example
- * // Stores current time for a keyed histogram "PLAYING_WITH_CUTE_ANIMALS".
- * Timers.put("PLAYING_WITH_CUTE_ANIMALS", null, "CATS", Date.now());
- *
- * @example
- * // Returns information about a simple Stopwatch.
- * let startTime = Timers.get("PLAYING_WITH_CUTE_ANIMALS", null, "CATS");
- */
-let Timers = {
- _timers: new Map(),
-
- _validTypes: function(histogram, obj, key) {
- let nonEmptyString = value => {
- return typeof value === "string" && value !== "" && value.length > 0;
- };
- return nonEmptyString(histogram) &&
- typeof obj == "object" &&
- (key === NULL_KEY || nonEmptyString(key));
- },
-
- get: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this.has(histogram, obj, key)) {
- return null;
- }
-
- return this._timers.get(histogram).get(obj).get(key);
- },
-
- put: function(histogram, obj, key, startTime) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this._validTypes(histogram, obj, key)) {
- return false;
- }
-
- let objectMap = this._timers.get(histogram) || new WeakMap();
- let keyedInfo = objectMap.get(obj) || new Map();
- keyedInfo.set(key, startTime);
- objectMap.set(obj, keyedInfo);
- this._timers.set(histogram, objectMap);
- return true;
- },
-
- has: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- return this._timers.has(histogram) &&
- this._timers.get(histogram).has(obj) &&
- this._timers.get(histogram).get(obj).has(key);
- },
-
- delete: function(histogram, obj, key) {
- key = key === null ? NULL_KEY : key;
- obj = obj || NULL_OBJECT;
-
- if (!this.has(histogram, obj, key)) {
- return false;
- }
- let objectMap = this._timers.get(histogram);
- let keyedInfo = objectMap.get(obj);
- if (keyedInfo.size > 1) {
- keyedInfo.delete(key);
- return true;
- }
- objectMap.delete(obj);
- // NOTE:
- // We never delete empty objecMaps from this._timers because there is no
- // nice solution for tracking the number of objects in a WeakMap.
- // WeakMap is not enumerable, so we can't deterministically say when it's
- // empty. We accept that trade-off here, given that entries for short-lived
- // objects will go away when they are no longer referenced
- return true;
- }
-};
-
-this.TelemetryStopwatch = {
- /**
- * Starts a timer associated with a telemetry histogram. The timer can be
- * directly associated with a histogram, or with a pair of a histogram and
- * an object.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers for the same histogram may be run
- * concurrently, as long as they are associated with
- * different objects.
- *
- * @returns {Boolean} True if the timer was successfully started, false
- * otherwise. If a timer already exists, it can't be
- * started again, and the existing one will be cleared in
- * order to avoid measurements errors.
- */
- start: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.start(aHistogram, aObj, null);
- },
-
- /**
- * Deletes the timer associated with a telemetry histogram. The timer can be
- * directly associated with a histogram, or with a pair of a histogram and
- * an object. Important: Only use this method when a legitimate cancellation
- * should be done.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers or a same histogram may be run concurrently,
- * as long as they are associated with different
- * objects.
- *
- * @returns {Boolean} True if the timer exist and it was cleared, False
- * otherwise.
- */
- cancel: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.cancel(aHistogram, aObj, null);
- },
-
- /**
- * Returns the elapsed time for a particular stopwatch. Primarily for
- * debugging purposes. Must be called prior to finish.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- * If an invalid name is given, the function will
- * throw.
- *
- * @param (Object) aObj - Optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Integer} time in milliseconds or -1 if the stopwatch was not
- * found.
- */
- timeElapsed: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, null);
- },
-
- /**
- * Stops the timer associated with the given histogram (and object),
- * calculates the time delta between start and finish, and adds the value
- * to the histogram.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {Object} aObj - Optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Boolean} True if the timer was succesfully stopped and the data
- * was added to the histogram, False otherwise.
- */
- finish: function(aHistogram, aObj) {
- return TelemetryStopwatchImpl.finish(aHistogram, aObj, null);
- },
-
- /**
- * Starts a timer associated with a keyed telemetry histogram. The timer can
- * be directly associated with a histogram and its key. Similarly to
- * @see{TelemetryStopwatch.stat} the histogram and its key can be associated
- * with an object. Each key may have multiple associated objects and each
- * object can be associated with multiple keys.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer is
- * associated with this object, meaning that multiple
- * timers for the same histogram may be run
- * concurrently,as long as they are associated with
- * different objects.
- *
- * @returns {Boolean} True if the timer was successfully started, false
- * otherwise. If a timer already exists, it can't be
- * started again, and the existing one will be cleared in
- * order to avoid measurements errors.
- */
- startKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.start(aHistogram, aObj, aKey);
- },
-
- /**
- * Deletes the timer associated with a keyed histogram. Important: Only use
- * this method when a legitimate cancellation should be done.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer
- * associated with this object is deleted.
- *
- * @return {Boolean} True if the timer exist and it was cleared, False
- * otherwise.
- */
- cancelKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.cancel(aHistogram, aObj, aKey);
- },
-
- /**
- * Returns the elapsed time for a particular stopwatch. Primarily for
- * debugging purposes. Must be called prior to finish.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - Optional parameter. If specified, the timer
- * associated with this object is used to calculate
- * the elapsed time.
- *
- * @return {Integer} time in milliseconds or -1 if the stopwatch was not
- * found.
- */
- timeElapsedKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.timeElapsed(aHistogram, aObj, aKey);
- },
-
- /**
- * Stops the timer associated with the given keyed histogram (and object),
- * calculates the time delta between start and finish, and adds the value
- * to the keyed histogram.
- *
- * @param {String} aHistogram - a string which must be a valid histogram name.
- *
- * @param {String} aKey - a string which must be a valid histgram key.
- *
- * @param {Object} aObj - optional parameter which associates the histogram
- * timer with the given object.
- *
- * @returns {Boolean} True if the timer was succesfully stopped and the data
- * was added to the histogram, False otherwise.
- */
- finishKeyed: function(aHistogram, aKey, aObj) {
- return TelemetryStopwatchImpl.finish(aHistogram, aObj, aKey);
- }
-};
-
-this.TelemetryStopwatchImpl = {
- start: function(histogram, object, key) {
- if (Timers.has(histogram, object, key)) {
- Timers.delete(histogram, object, key);
- Cu.reportError(`TelemetryStopwatch: key "${histogram}" was already ` +
- "initialized");
- return false;
- }
-
- return Timers.put(histogram, object, key, Components.utils.now());
- },
-
- cancel: function (histogram, object, key) {
- return Timers.delete(histogram, object, key);
- },
-
- timeElapsed: function(histogram, object, key) {
- let startTime = Timers.get(histogram, object, key);
- if (startTime === null) {
- Cu.reportError("TelemetryStopwatch: requesting elapsed time for " +
- `nonexisting stopwatch. Histogram: "${histogram}", ` +
- `key: "${key}"`);
- return -1;
- }
-
- try {
- let delta = Components.utils.now() - startTime
- return Math.round(delta);
- } catch (e) {
- Cu.reportError("TelemetryStopwatch: failed to calculate elapsed time " +
- `for Histogram: "${histogram}", key: "${key}", ` +
- `exception: ${Log.exceptionStr(e)}`);
- return -1;
- }
- },
-
- finish: function(histogram, object, key) {
- let delta = this.timeElapsed(histogram, object, key);
- if (delta == -1) {
- return false;
- }
-
- try {
- if (key) {
- Telemetry.getKeyedHistogramById(histogram).add(key, delta);
- } else {
- Telemetry.getHistogramById(histogram).add(delta);
- }
- } catch (e) {
- Cu.reportError("TelemetryStopwatch: failed to update the Histogram " +
- `"${histogram}", using key: "${key}", ` +
- `exception: ${Log.exceptionStr(e)}`);
- return false;
- }
-
- return Timers.delete(histogram, object, key);
- }
-}
diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build
index 118d61b71..7765c59b4 100644
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -64,7 +64,6 @@ EXTRA_JS_MODULES += [
'TelemetryReportingPolicy.jsm',
'TelemetrySend.jsm',
'TelemetrySession.jsm',
- 'TelemetryStopwatch.jsm',
'TelemetryStorage.jsm',
'TelemetryTimestamps.jsm',
'TelemetryUtils.jsm',
diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js b/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
deleted file mode 100644
index d162d9b17..000000000
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var tmpScope = {};
-Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", tmpScope);
-var TelemetryStopwatch = tmpScope.TelemetryStopwatch;
-
-const HIST_NAME = "TELEMETRY_SEND_SUCCESS";
-const HIST_NAME2 = "RANGE_CHECKSUM_ERRORS";
-const KEYED_HIST = { id: "TELEMETRY_INVALID_PING_TYPE_SUBMITTED", key: "TEST" };
-
-var refObj = {}, refObj2 = {};
-
-var originalCount1, originalCount2;
-
-function run_test() {
- let histogram = Telemetry.getHistogramById(HIST_NAME);
- let snapshot = histogram.snapshot();
- originalCount1 = snapshot.counts.reduce((a, b) => a += b);
-
- histogram = Telemetry.getHistogramById(HIST_NAME2);
- snapshot = histogram.snapshot();
- originalCount2 = snapshot.counts.reduce((a, b) => a += b);
-
- histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id);
- snapshot = histogram.snapshot(KEYED_HIST.key);
- originalCount3 = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_false(TelemetryStopwatch.start(3));
- do_check_false(TelemetryStopwatch.start({}));
- do_check_false(TelemetryStopwatch.start("", 3));
- do_check_false(TelemetryStopwatch.start("", ""));
- do_check_false(TelemetryStopwatch.start({}, {}));
-
- do_check_true(TelemetryStopwatch.start("mark1"));
- do_check_true(TelemetryStopwatch.start("mark2"));
-
- do_check_true(TelemetryStopwatch.start("mark1", refObj));
- do_check_true(TelemetryStopwatch.start("mark2", refObj));
-
- // Same timer can't be re-started before being stopped
- do_check_false(TelemetryStopwatch.start("mark1"));
- do_check_false(TelemetryStopwatch.start("mark1", refObj));
-
- // Can't stop a timer that was accidentaly started twice
- do_check_false(TelemetryStopwatch.finish("mark1"));
- do_check_false(TelemetryStopwatch.finish("mark1", refObj));
-
- do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM"));
- do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM"));
-
- do_check_true(TelemetryStopwatch.start("NON-EXISTENT_HISTOGRAM", refObj));
- do_check_false(TelemetryStopwatch.finish("NON-EXISTENT_HISTOGRAM", refObj));
-
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj2));
- do_check_true(TelemetryStopwatch.start(HIST_NAME2, refObj2));
-
- do_check_true(TelemetryStopwatch.finish(HIST_NAME));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj2));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME2, refObj2));
-
- // Verify that TS.finish deleted the timers
- do_check_false(TelemetryStopwatch.finish(HIST_NAME));
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- // Verify that they can be used again
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME));
- do_check_true(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- do_check_false(TelemetryStopwatch.finish("unknown-mark")); // Unknown marker
- do_check_false(TelemetryStopwatch.finish("unknown-mark", {})); // Unknown object
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, {})); // Known mark on unknown object
-
- // Test cancel
- do_check_true(TelemetryStopwatch.start(HIST_NAME));
- do_check_true(TelemetryStopwatch.start(HIST_NAME, refObj));
- do_check_true(TelemetryStopwatch.cancel(HIST_NAME));
- do_check_true(TelemetryStopwatch.cancel(HIST_NAME, refObj));
-
- // Verify that can not cancel twice
- do_check_false(TelemetryStopwatch.cancel(HIST_NAME));
- do_check_false(TelemetryStopwatch.cancel(HIST_NAME, refObj));
-
- // Verify that cancel removes the timers
- do_check_false(TelemetryStopwatch.finish(HIST_NAME));
- do_check_false(TelemetryStopwatch.finish(HIST_NAME, refObj));
-
- // Verify that keyed stopwatch reject invalid keys.
- for (let key of [3, {}, ""]) {
- do_check_false(TelemetryStopwatch.startKeyed(KEYED_HIST.id, key));
- }
-
- // Verify that keyed histograms can be started.
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1"));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2"));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj));
- do_check_true(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY2", refObj));
-
- // Restarting keyed histograms should fail.
- do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1"));
- do_check_false(TelemetryStopwatch.startKeyed("HISTOGRAM", "KEY1", refObj));
-
- // Finishing a stopwatch of a non existing histogram should return false.
- do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2"));
- do_check_false(TelemetryStopwatch.finishKeyed("HISTOGRAM", "KEY2", refObj));
-
- // Starting & finishing a keyed stopwatch for an existing histogram should work.
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
- // Verify that TS.finish deleted the timers
- do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- // Verify that they can be used again
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- do_check_false(TelemetryStopwatch.finishKeyed("unknown-mark", "unknown-key"));
- do_check_false(TelemetryStopwatch.finishKeyed(KEYED_HIST.id, "unknown-key"));
-
- // Verify that keyed histograms can only be canceled through "keyed" API.
- do_check_true(TelemetryStopwatch.startKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_false(TelemetryStopwatch.cancel(KEYED_HIST.id, KEYED_HIST.key));
- do_check_true(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key));
- do_check_false(TelemetryStopwatch.cancelKeyed(KEYED_HIST.id, KEYED_HIST.key));
-
- finishTest();
-}
-
-function finishTest() {
- let histogram = Telemetry.getHistogramById(HIST_NAME);
- let snapshot = histogram.snapshot();
- let newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount1, 5, "The correct number of histograms were added for histogram 1.");
-
- histogram = Telemetry.getHistogramById(HIST_NAME2);
- snapshot = histogram.snapshot();
- newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount2, 3, "The correct number of histograms were added for histogram 2.");
-
- histogram = Telemetry.getKeyedHistogramById(KEYED_HIST.id);
- snapshot = histogram.snapshot(KEYED_HIST.key);
- newCount = snapshot.counts.reduce((a, b) => a += b);
-
- do_check_eq(newCount - originalCount3, 2, "The correct number of histograms were added for histogram 3.");
-}
diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini
index 42354c4cd..224516f57 100644
--- a/toolkit/components/telemetry/tests/unit/xpcshell.ini
+++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini
@@ -41,7 +41,6 @@ tags = addons
[test_TelemetryController_idle.js]
[test_TelemetryControllerShutdown.js]
tags = addons
-[test_TelemetryStopwatch.js]
[test_TelemetryControllerBuildID.js]
[test_TelemetrySendOldPings.js]
skip-if = os == "android" # Disabled due to intermittent orange on Android
diff --git a/toolkit/content/widgets/tabbox.xml b/toolkit/content/widgets/tabbox.xml
index 02adb70b3..60c395c13 100644
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -792,19 +792,6 @@
<field name="arrowKeysShouldWrap" readonly="true">
/Mac/.test(navigator.platform)
</field>
- <property name="TelemetryStopwatch" readonly="true">
- <getter><![CDATA[
- let module = {};
- Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", module);
- Object.defineProperty(this, "TelemetryStopwatch", {
- configurable: true,
- enumerable: true,
- writable: true,
- value: module.TelemetryStopwatch
- });
- return module.TelemetryStopwatch;
- ]]></getter>
- </property>
</implementation>
<handlers>
@@ -814,11 +801,6 @@
return;
if (this != this.parentNode.selectedItem) { // Not selected yet
- let stopwatchid = this.parentNode.getAttribute("stopwatchid");
- if (stopwatchid) {
- this.TelemetryStopwatch.start(stopwatchid);
- }
-
// Call this before setting the 'ignorefocus' attribute because this
// will pass on focus if the formerly selected tab was focused as well.
this.parentNode._selectNewTab(this);
@@ -836,10 +818,6 @@
this.setAttribute("ignorefocus", "true");
setTimeout(tab => tab.removeAttribute("ignorefocus"), 0, this);
}
-
- if (stopwatchid) {
- this.TelemetryStopwatch.finish(stopwatchid);
- }
}
// Otherwise this tab is already selected and we will fall
// through to mousedown behavior which sets focus on the current tab,