Bug 1134166 - Restart toolbox if selected app re-opens. r=ochameau
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 08 Apr 2015 04:09:42 -0500
changeset 238179 c8066e57077eef5e9909d814fc7b67ecf7b63e10
parent 238178 77303df92debade87a0c412fbf3eeb8b372d5a32
child 238180 665b9fb029e19dae0fd4563227d975b6bdd2efa2
push id58133
push userryanvm@gmail.com
push dateWed, 08 Apr 2015 16:59:36 +0000
treeherdermozilla-inbound@8911c111a6ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1134166
milestone40.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 1134166 - Restart toolbox if selected app re-opens. r=ochameau
browser/devtools/webide/content/webide.js
--- a/browser/devtools/webide/content/webide.js
+++ b/browser/devtools/webide/content/webide.js
@@ -174,23 +174,28 @@ let UI = {
         break;
       case "project":
         this._updatePromise = Task.spawn(function() {
           UI.updateTitle();
           yield UI.destroyToolbox();
           UI.updateCommands();
           UI.updateProjectButton();
           UI.openProject();
-          UI.autoStartProject();
+          yield UI.autoStartProject();
+          UI.autoOpenToolbox();
           UI.saveLastSelectedProject();
           projectList.update();
         });
         return;
+      case "project-started":
+        this.updateCommands();
+        projectList.update();
+        UI.autoOpenToolbox();
+        break;
       case "project-stopped":
-      case "project-started":
       case "runtime-global-actors":
         this.updateCommands();
         projectList.update();
         break;
       case "runtime-details":
         this.updateRuntimeButton();
         break;
       case "runtime":
@@ -652,37 +657,49 @@ let UI = {
 
     this.selectDeckPanel("projecteditor");
 
     this.getProjectEditor().then(() => {
       this.updateProjectEditorHeader();
     }, console.error);
   },
 
-  autoStartProject: function() {
+  autoStartProject: Task.async(function*() {
     let project = AppManager.selectedProject;
 
     if (!project) {
       return;
     }
     if (!(project.type == "runtimeApp" ||
           project.type == "mainProcess" ||
           project.type == "tab")) {
       return; // For something that is not an editable app, we're done.
     }
 
-    Task.spawn(function() {
-      // Do not force opening apps that are already running, as they may have
-      // some activity being opened and don't want to dismiss them.
-      if (project.type == "runtimeApp" && !AppManager.isProjectRunning()) {
-        yield UI.busyUntil(AppManager.launchRuntimeApp(), "running app");
-      }
-      yield UI.createToolbox();
-    });
-  },
+    // Do not force opening apps that are already running, as they may have
+    // some activity being opened and don't want to dismiss them.
+    if (project.type == "runtimeApp" && !AppManager.isProjectRunning()) {
+      yield UI.busyUntil(AppManager.launchRuntimeApp(), "running app");
+    }
+  }),
+
+  autoOpenToolbox: Task.async(function*() {
+    let project = AppManager.selectedProject;
+
+    if (!project) {
+      return;
+    }
+    if (!(project.type == "runtimeApp" ||
+          project.type == "mainProcess" ||
+          project.type == "tab")) {
+      return; // For something that is not an editable app, we're done.
+    }
+
+    yield UI.createToolbox();
+  }),
 
   importAndSelectApp: Task.async(function* (source) {
     let isPackaged = !!source.path;
     let project;
     try {
       project = yield AppProjects[isPackaged ? "addPackaged" : "addHosted"](source);
     } catch (e) {
       if (e === "Already added") {