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 849bf3c58408d0eed43114fcd16d76a6eece1c2d
parent 258531 4a98323f8e688917ae113a07d61b4dc9b6f538c4
child 258533 44de10db57a66fd4d365a8bce41d69e9cfecf8c9
push id4690
push userryanvm@gmail.com
push dateMon, 20 Apr 2015 16:04:38 +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) {