Bug 913234 - Close toolboxes on disconnect. r=ochameau
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 10 Sep 2013 12:57:48 -0500
changeset 146661 99f92e712d48c6df8087020530c2405bf9ce3a20
parent 146660 22374252348314a0c9d8db01312323e322c026bf
child 146662 d9b79f9842c15cc966820f46bebad5b43903ad29
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersochameau
bugs913234
milestone26.0a1
Bug 913234 - Close toolboxes on disconnect. r=ochameau
browser/devtools/app-manager/content/device.js
browser/devtools/app-manager/content/projects.js
--- a/browser/devtools/app-manager/content/device.js
+++ b/browser/devtools/app-manager/content/device.js
@@ -162,17 +162,23 @@ let UI = {
         });
       }
     });
     return deferred.promise;
   },
 
   openToolbox: function(manifest) {
     this._getTargetForApp(manifest).then((target) => {
-      gDevTools.showToolbox(target, "webconsole", devtools.Toolbox.HostType.WINDOW);
+      gDevTools.showToolbox(target,
+                            null,
+                            devtools.Toolbox.HostType.WINDOW).then(toolbox => {
+        this.connection.once(Connection.Events.DISCONNECTED, () => {
+          toolbox.destroy();
+        });
+      });
     }, console.error);
   },
 
   startApp: function(manifest) {
     let deferred = promise.defer();
 
     if (!this.listTabsResponse) {
       deferred.reject();
--- a/browser/devtools/app-manager/content/projects.js
+++ b/browser/devtools/app-manager/content/projects.js
@@ -218,18 +218,21 @@ let UI = {
   },
 
   openToolbox: function(location) {
     let project = AppProjects.get(location);
     let manifest = this._getProjectManifestURL(project);
     this._getTargetForApp(manifest).then((target) => {
       gDevTools.showToolbox(target,
                             null,
-                            devtools.Toolbox.HostType.WINDOW,
-                            this.connection.uid);
+                            devtools.Toolbox.HostType.WINDOW).then(toolbox => {
+        this.connection.once(Connection.Events.DISCONNECTED, () => {
+          toolbox.destroy();
+        });
+      });
     }, console.error);
   },
 
 
   reveal: function(location) {
     let project = AppProjects.get(location);
     if (project.type == "packaged") {
       let projectFolder = FileUtils.File(project.location);