author | Tom Tromey <tom@tromey.com> |
Fri, 15 Jul 2016 14:04:02 -0600 | |
changeset 305565 | 4553ad09496a74d6d613d60ceefc22367cd4ee9b |
parent 305564 | 98a277292d0b8a76e068a17d23fa0defda4334d1 |
child 305566 | c96249f34046211c1f9884479eb5e53e07ff976f |
push id | 30466 |
push user | cbook@mozilla.com |
push date | Wed, 20 Jul 2016 09:18:48 +0000 |
treeherder | mozilla-central@a6ca57085257 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gregtatum |
bugs | 1266839 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -487,17 +487,18 @@ Toolbox.prototype = { get ReactDOM() { return this.browserRequire("devtools/client/shared/vendor/react-dom"); }, _pingTelemetry: function () { this._telemetry.toolOpened("toolbox"); this._telemetry.logOncePerBrowserVersion(OS_HISTOGRAM, system.getOSCPU()); - this._telemetry.logOncePerBrowserVersion(OS_IS_64_BITS, system.is64Bit ? 1 : 0); + this._telemetry.logOncePerBrowserVersion(OS_IS_64_BITS, + Services.appinfo.is64Bit ? 1 : 0); this._telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM, system.getScreenDimensions()); }, /** * Because our panels are lazy loaded this is a good place to watch for * "pref-changed" events. * @param {String} event * The event type, "pref-changed".
--- a/devtools/client/netmonitor/har/har-builder.js +++ b/devtools/client/netmonitor/har/har-builder.js @@ -1,23 +1,20 @@ /* 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/. */ "use strict"; -const { Ci, Cc } = require("chrome"); const { defer, all } = require("promise"); const { LocalizationHelper } = require("devtools/client/shared/l10n"); +const Services = require("Services"); +const appInfo = Services.appinfo; loader.lazyRequireGetter(this, "NetworkHelper", "devtools/shared/webconsole/network-helper"); -loader.lazyGetter(this, "appInfo", () => { - return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo); -}); - loader.lazyGetter(this, "L10N", () => { return new LocalizationHelper("chrome://devtools/locale/har.properties"); }); const HAR_VERSION = "1.1"; /** * This object is responsible for building HAR file. See HAR spec:
--- a/devtools/client/shared/shim/Services.js +++ b/devtools/client/shared/shim/Services.js @@ -478,17 +478,33 @@ const Services = { return "Linux"; } else if (os.includes("Windows")) { return "WINNT"; } else if (os.includes("Mac")) { return "Darwin"; } } return "Unknown"; - } + }, + + // It's fine for this to be an approximation. + get name() { + return window.navigator.userAgent; + }, + + // It's fine for this to be an approximation. + get version() { + return window.navigator.appVersion; + }, + + // This is only used by telemetry, which is disabled for the + // content case. So, being totally wrong is ok. + get is64Bit() { + return true; + }, }, }; /** * Create a new preference. This is used during startup (see * devtools/client/preferences/devtools.js) to install the * default preferences. *
--- a/devtools/client/shared/telemetry.js +++ b/devtools/client/shared/telemetry.js @@ -51,19 +51,17 @@ this.Telemetry = function () { this.logOncePerBrowserVersion = this.logOncePerBrowserVersion.bind(this); this.destroy = this.destroy.bind(this); this._timers = new Map(); }; module.exports = Telemetry; -var {Cc, Ci, Cu} = require("chrome"); var Services = require("Services"); -var {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); Telemetry.prototype = { _histograms: { toolbox: { histogram: "DEVTOOLS_TOOLBOX_OPENED_COUNT", userHistogram: "DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", timerHistogram: "DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS" }, @@ -352,17 +350,17 @@ Telemetry.prototype = { /** * Log info about usage once per browser version. This allows us to discover * how many individual users are using our tools for each browser version. * * @param {String} perUserHistogram * Histogram in which the data is to be stored. */ logOncePerBrowserVersion: function (perUserHistogram, value) { - let currentVersion = appInfo.version; + let currentVersion = Services.appinfo.version; let latest = Services.prefs.getCharPref(TOOLS_OPENED_PREF); let latestObj = JSON.parse(latest); let lastVersionHistogramUpdated = latestObj[perUserHistogram]; if (typeof lastVersionHistogramUpdated == "undefined" || lastVersionHistogramUpdated !== currentVersion) { latestObj[perUserHistogram] = currentVersion; @@ -373,12 +371,8 @@ Telemetry.prototype = { }, destroy: function () { for (let histogramId of this._timers.keys()) { this.stopTimer(histogramId); } } }; - -XPCOMUtils.defineLazyGetter(this, "appInfo", function () { - return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo); -});
--- a/devtools/shared/system.js +++ b/devtools/shared/system.js @@ -326,15 +326,14 @@ function getSetting(name) { handleError: (error) => deferred.reject(error), }); } else { deferred.reject(new Error("No settings service")); } return deferred.promise; } -exports.is64Bit = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).is64Bit; exports.getSystemInfo = Task.async(getSystemInfo); exports.getAppIniString = getAppIniString; exports.getSetting = getSetting; exports.getScreenDimensions = getScreenDimensions; exports.getOSCPU = getOSCPU; exports.constants = AppConstants;