Bug 1124217 - Don't gather telemetry for windows that have died. r=mconley, a=sledru
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 16 Apr 2015 11:41:19 +0100
changeset 258532 849bf3c58408
parent 258531 4a98323f8e68
child 258533 44de10db57a6
push id4690
push userryanvm@gmail.com
push date2015-04-20 16:04 +0000
treeherdermozilla-beta@eb5e2063637b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, sledru
bugs1124217
milestone38.0
Bug 1124217 - Don't gather telemetry for windows that have died. r=mconley, a=sledru
browser/modules/BrowserUITelemetry.jsm
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -282,19 +282,21 @@ this.BrowserUITelemetry = {
     // probably been closed, since the vast majority of saved-session
     // pings are gathered during shutdown.
     let win = RecentWindow.getMostRecentBrowserWindow({
       private: false,
       allowPopups: false,
     });
 
     Services.search.init(rv => {
-      // If there are no such windows, we're out of luck. :(
-      this._firstWindowMeasurements = win ? this._getWindowMeasurements(win, rv)
-                                          : {};
+      // If there are no such windows (or we've just about found one
+      // but it's closed already), we're out of luck. :(
+      let hasWindow = win && !win.closed;
+      this._firstWindowMeasurements = hasWindow ? this._getWindowMeasurements(win, rv)
+                                                : {};
     });
   },
 
   _registerWindow: function(aWindow) {
     aWindow.addEventListener("unload", this);
     let document = aWindow.document;
 
     for (let areaID of CustomizableUI.areas) {