Bug 1255565 - Close extraneous browser window when running reftests, r?dholbert draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 13 Apr 2016 10:23:47 -0400
changeset 350902 63b74a295cf9ab69b0bb7dfaf33307f70b89c603
parent 350335 564b225d553547fe4aa9a1039278f695c9507db9
child 518427 a660b7c97a26365a61431b5053e54d9874eac4a3
push id15444
push userahalberstadt@mozilla.com
push dateThu, 14 Apr 2016 13:32:17 +0000
reviewersdholbert
bugs1255565
milestone48.0a1
Bug 1255565 - Close extraneous browser window when running reftests, r?dholbert This extra window was initially left open because closing it was causing memory leaks on debug e10s crashtests. There was pressure to get the regressing patch landed due to addon signing, so it got landed with this extra window hanging around (as it didn't impact test results). But it is a UX wart for several reasons. Upon testing it again recently, the leaks all seem to have vanished. I'm not sure why, possibly it was a bug fixed in e10s. MozReview-Commit-ID: CEI2enKAOyv
layout/tools/reftest/bootstrap.js
--- a/layout/tools/reftest/bootstrap.js
+++ b/layout/tools/reftest/bootstrap.js
@@ -39,26 +39,31 @@ function startup(data, reason) {
   }
 
   if (Services.appinfo.OS == "Android") {
     Cm.addBootstrappedManifestLocation(data.installPath);
     Services.wm.addListener(WindowListener);
     return;
   }
 
+  let orig = Services.wm.getMostRecentWindow("navigator:browser");
+
   let ios = Cc["@mozilla.org/network/io-service;1"]
             .getService(Ci.nsIIOService2);
   ios.manageOfflineStatus = false;
   ios.offline = false;
 
   let wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
                 .getService(Ci.nsIWindowWatcher);
   let dummy = wwatch.openWindow(null, "about:blank", "dummy",
                                 "chrome,dialog=no,left=800,height=200,width=200,all",null);
   dummy.onload = function() {
+    // Close pre-existing window
+    orig.close();
+
     dummy.focus();
     wwatch.openWindow(null, "chrome://reftest/content/reftest.xul", "_blank",
                       "chrome,dialog=no,all", {});
   };
 }
 
 function shutdown(data, reason) {
   if (Services.appinfo.widgetToolkit == "gonk") {