Bug 1255565 - Close extraneous browser window when running reftests, r=dholbert
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 13 Apr 2016 10:23:47 -0400
changeset 331261 91762496f97ce5d87e88a0231bf1a76dc2a0871d
parent 331260 1b668f16ac1e92ca400d4438c24346f3d486bb30
child 331262 7922c7e1a69eb117431de3b2241a1ea1dc3fac08
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1255565
milestone48.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
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") {