Bug 942244 - [Australis] Add BrowserUiTelemetry module for collecting toolbar measurements. r=dao.

This commit is contained in:
Mike Conley 2013-12-10 14:49:02 -05:00
parent 9da681c2b2
commit 0047869f02
3 changed files with 48 additions and 0 deletions

View File

@ -79,6 +79,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
"resource:///modules/sessionstore/SessionStore.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
"resource:///modules/BrowserUITelemetry.jsm");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -476,6 +479,7 @@ BrowserGlue.prototype = {
webrtcUI.init();
AboutHome.init();
SessionStore.init();
BrowserUITelemetry.init();
if (Services.prefs.getBoolPref("browser.tabs.remote"))
ContentClick.init();

View File

@ -0,0 +1,43 @@
// 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";
this.EXPORTED_SYMBOLS = ["BrowserUITelemetry"];
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
"resource://gre/modules/UITelemetry.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
"resource:///modules/RecentWindow.jsm");
this.BrowserUITelemetry = {
init: function() {
UITelemetry.addSimpleMeasureFunction("toolbars",
this.getToolbarMeasures.bind(this));
},
getToolbarMeasures: function() {
// Grab the most recent non-popup, non-private browser window for us to
// analyze the toolbars in...
let win = RecentWindow.getMostRecentBrowserWindow({
private: false,
allowPopups: false
});
// If there are no such windows, we're out of luck. :(
if (!win) {
return {};
}
let document = win.document;
let result = {};
return result;
},
};

View File

@ -8,6 +8,7 @@ TEST_DIRS += ['test']
EXTRA_JS_MODULES += [
'BrowserNewTabPreloader.jsm',
'BrowserUITelemetry.jsm',
'CharsetMenu.jsm',
'ContentClick.jsm',
'NetworkPrioritizer.jsm',