Bug 1281341 - devtools tests: force gc/cc after closing tab and toolbox;r=ochameau
☠☠ backed out by 33b47c4a5836 ☠ ☠
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 13 Sep 2016 11:59:28 +0200
changeset 355198 8d59556d361f3266ae39a3c26ddb8ddd97f8c4d3
parent 355021 27c6658b2a9004dd996ce79b35a40bb66ce98feb
child 355199 39ebab543e1f86e6c8d80cbcf5da7dbdeda901c0
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1281341
milestone51.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 1281341 - devtools tests: force gc/cc after closing tab and toolbox;r=ochameau MozReview-Commit-ID: EFhxukfX3dP
devtools/client/framework/test/shared-head.js
devtools/client/framework/toolbox.js
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -97,16 +97,20 @@ registerCleanupFunction(() => {
   Services.prefs.clearUserPref("devtools.toolbox.host");
   Services.prefs.clearUserPref("devtools.toolbox.previousHost");
 });
 
 registerCleanupFunction(function* cleanup() {
   while (gBrowser.tabs.length > 1) {
     yield closeTabAndToolbox(gBrowser.selectedTab);
   }
+
+  // Force GC and CC to get rid of disconnected docshells and windows (see Bug 1281341).
+  Cu.forceGC();
+  Cu.forceCC();
 });
 
 /**
  * Add a new test tab in the browser and load the given url.
  * @param {String} url The url to be loaded in the new tab
  * @return a promise that resolves to the tab object when the url is loaded
  */
 var addTab = Task.async(function* (url) {
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -2158,24 +2158,16 @@ Toolbox.prototype = {
           return target.destroy();
         }, console.error).then(() => {
           this.emit("destroyed");
 
           // Free _host after the call to destroyed in order to let a chance
           // to destroyed listeners to still query toolbox attributes
           this._host = null;
           this._toolPanels.clear();
-
-          // Force GC to prevent long GC pauses when running tests and to free up
-          // memory in general when the toolbox is closed.
-          if (flags.testing) {
-            win.QueryInterface(Ci.nsIInterfaceRequestor)
-              .getInterface(Ci.nsIDOMWindowUtils)
-              .garbageCollect();
-          }
         }).then(null, console.error);
 
     let leakCheckObserver = ({wrappedJSObject: barrier}) => {
       // Make the leak detector wait until this toolbox is properly destroyed.
       barrier.client.addBlocker("DevTools: Wait until toolbox is destroyed",
                                 this._destroyer);
     };