From bd15455765e5a6ae47cfc3f529e72af4d0d5d257 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 8 Apr 2015 04:09:42 -0500 Subject: [PATCH] Bug 1134166 - Restart toolbox if selected app re-opens. r=ochameau --- browser/devtools/webide/content/webide.js | 41 ++++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/browser/devtools/webide/content/webide.js b/browser/devtools/webide/content/webide.js index d1f111807adf..cab9d839c7f4 100644 --- a/browser/devtools/webide/content/webide.js +++ b/browser/devtools/webide/content/webide.js @@ -179,13 +179,18 @@ let UI = { UI.updateCommands(); UI.updateProjectButton(); UI.openProject(); - UI.autoStartProject(); + yield UI.autoStartProject(); + UI.autoOpenToolbox(); UI.saveLastSelectedProject(); projectList.update(); }); return; - case "project-stopped": case "project-started": + this.updateCommands(); + projectList.update(); + UI.autoOpenToolbox(); + break; + case "project-stopped": case "runtime-global-actors": this.updateCommands(); projectList.update(); @@ -657,7 +662,7 @@ let UI = { }, console.error); }, - autoStartProject: function() { + autoStartProject: Task.async(function*() { let project = AppManager.selectedProject; if (!project) { @@ -669,15 +674,27 @@ let UI = { 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;