author | Mike Conley <mconley@mozilla.com> |
Thu, 19 Dec 2013 16:46:39 -0500 | |
changeset 161370 | c3239da6de33702feebd4fc08213fb0027ecbe95 |
parent 161369 | 2ca129946a54657667d918640633794ea8236b62 |
child 161371 | 3d5a97333964d5aa28e88e32e731075d6388a4c2 |
push id | 25878 |
push user | kwierso@gmail.com |
push date | Fri, 20 Dec 2013 03:09:21 +0000 |
treeherder | mozilla-central@599100c4ebfe [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jaws |
bugs | 952180 |
milestone | 29.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/browser/modules/BrowserUITelemetry.jsm +++ b/browser/modules/BrowserUITelemetry.jsm @@ -179,17 +179,27 @@ this.BrowserUITelemetry = { let buttonKey = BUTTONS[aButton]; if (buttonKey) { let countObject = this._ensureObjectChain([aCategory, aAction, buttonKey], 0); countObject[buttonKey]++; } }, + _firstWindowMeasurements: null, _registerWindow: function(aWindow) { + // We'll gather measurements on the first non-popup window that opens + // after it has painted. We do this here instead of waiting for + // UITelemetry to ask for our measurements because at that point + // all browser windows have probably been closed, since the vast + // majority of saved-session pings are gathered during shutdown. + if (!this._firstWindowMeasurements && aWindow.toolbar.visible) { + this._firstWindowMeasurements = this._getWindowMeasurements(aWindow); + } + aWindow.addEventListener("unload", this); let document = aWindow.document; for (let areaID of CustomizableUI.areas) { let areaNode = document.getElementById(areaID); if (areaNode) { (areaNode.customizationTarget || areaNode).addEventListener("mouseup", this); } @@ -306,30 +316,18 @@ this.BrowserUITelemetry = { // being clicked. if (ALL_BUILTIN_ITEMS.indexOf(item.id) != -1) { // Base case - we clicked directly on one of our built-in items, // and we can go ahead and register that click. this._countMouseUpEvent("click-builtin-item", item.id, aEvent.button); } }, - 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; + _getWindowMeasurements: function(aWindow) { + let document = aWindow.document; let result = {}; // Determine if the Bookmarks bar is currently visible let bookmarksBar = document.getElementById("PersonalToolbar"); result.bookmarksBarEnabled = bookmarksBar && !bookmarksBar.collapsed; // Examine all customizable areas and see what default items // are present and missing. @@ -359,27 +357,31 @@ this.BrowserUITelemetry = { } // else, it's provided by an add-on, and we won't record it. } } // Now go through the items in the palette to see what default // items are in there. let paletteItems = - CustomizableUI.getUnusedWidgets(win.gNavToolbox.palette); + CustomizableUI.getUnusedWidgets(aWindow.gNavToolbox.palette); let defaultRemoved = [item.id for (item of paletteItems) if (DEFAULT_ITEMS.indexOf(item.id) != -1)]; result.defaultKept = defaultKept; result.defaultMoved = defaultMoved; result.nondefaultAdded = nondefaultAdded; result.defaultRemoved = defaultRemoved; + return result; + }, + + getToolbarMeasures: function() { + let result = this._firstWindowMeasurements || {}; result.countableEvents = this._countableEvents; - return result; }, }; /** * Returns the id of the first ancestor of aNode that has an id. If aNode * has no parent, or no ancestor has an id, returns null. *