Bug 1285638 - Network monitor leaks window when a parent-side tab is closed. r=ochameau, a=lizzard
authorJarda Snajdr <jsnajdr@gmail.com>
Sun, 10 Jul 2016 10:37:00 +0200
changeset 325437 65aee59b180854a503b0642e708bd7081785b31a
parent 325436 383d49d1d47096aae43b49e5d94cbfe90a1ef3e7
child 325438 a1269ccfe4c13e0b2ea9334ad42f292d910b90bf
push id9791
push usercbook@mozilla.com
push dateSat, 16 Jul 2016 07:27:01 +0000
treeherdermozilla-aurora@65aee59b1808 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau, lizzard
bugs1285638
milestone49.0a2
Bug 1285638 - Network monitor leaks window when a parent-side tab is closed. r=ochameau, a=lizzard
devtools/client/netmonitor/test/browser.ini
devtools/client/netmonitor/test/browser_net_leak_on_tab_close.js
devtools/server/actors/webconsole.js
--- a/devtools/client/netmonitor/test/browser.ini
+++ b/devtools/client/netmonitor/test/browser.ini
@@ -92,16 +92,17 @@ skip-if = (os == 'linux' && e10s && debu
 [browser_net_icon-preview.js]
 [browser_net_image-tooltip.js]
 [browser_net_json-long.js]
 [browser_net_json-malformed.js]
 [browser_net_json_custom_mime.js]
 [browser_net_json_text_mime.js]
 [browser_net_jsonp.js]
 [browser_net_large-response.js]
+[browser_net_leak_on_tab_close.js]
 [browser_net_open_request_in_tab.js]
 [browser_net_page-nav.js]
 [browser_net_pane-collapse.js]
 [browser_net_pane-toggle.js]
 [browser_net_post-data-01.js]
 [browser_net_post-data-02.js]
 [browser_net_post-data-03.js]
 [browser_net_prefs-and-l10n.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/netmonitor/test/browser_net_leak_on_tab_close.js
@@ -0,0 +1,18 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Tests that netmonitor doesn't leak windows on parent-side pages (bug 1285638)
+ */
+
+add_task(function* () {
+  // Tell initNetMonitor to enable cache. Otherwise it will assert that there were more
+  // than zero network requests during the page load. But when loading about:config,
+  // there are none.
+  let [,, monitor] = yield initNetMonitor("about:config", null, true);
+  ok(monitor, "The network monitor was opened");
+  yield teardown(monitor);
+  finish();
+});
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -351,16 +351,20 @@ WebConsoleActor.prototype =
     if (this.networkMonitor) {
       this.networkMonitor.destroy();
       this.networkMonitor = null;
     }
     if (this.networkMonitorChild) {
       this.networkMonitorChild.destroy();
       this.networkMonitorChild = null;
     }
+    if (this.stackTraceCollector) {
+      this.stackTraceCollector.destroy();
+      this.stackTraceCollector = null;
+    }
     if (this.consoleProgressListener) {
       this.consoleProgressListener.destroy();
       this.consoleProgressListener = null;
     }
     if (this.consoleReflowListener) {
       this.consoleReflowListener.destroy();
       this.consoleReflowListener = null;
     }