From 7da7b1c11bd042c17fe8f12623b149afb66316c6 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 16 Mar 2015 13:32:00 -0400 Subject: [PATCH] Bug 1143028 - Make AppMan reinitable; update tab list when sidebars disabled. r=past --- browser/devtools/webide/content/webide.js | 7 ++++--- browser/devtools/webide/modules/app-manager.js | 14 +++++++++++++- browser/devtools/webide/modules/project-list.js | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/browser/devtools/webide/content/webide.js b/browser/devtools/webide/content/webide.js index e2f3284ea3e7..f31eafae0c58 100644 --- a/browser/devtools/webide/content/webide.js +++ b/browser/devtools/webide/content/webide.js @@ -49,7 +49,7 @@ window.addEventListener("load", function onLoad() { window.addEventListener("unload", function onUnload() { window.removeEventListener("unload", onUnload); - UI.uninit(); + UI.destroy(); }); let projectList; @@ -118,10 +118,10 @@ let UI = { gDevToolsBrowser.isWebIDEInitialized.resolve(); }, - uninit: function() { + destroy: function() { window.removeEventListener("focus", this.onfocus, true); AppManager.off("app-manager-update", this.appManagerUpdate); - AppManager.uninit(); + AppManager.destroy(); projectList = null; window.removeEventListener("message", this.onMessage); this.updateConnectionTelemetry(); @@ -186,6 +186,7 @@ let UI = { case "project-is-running": case "list-tabs-response": this.updateCommands(); + projectList.update(); break; case "runtime-details": this.updateRuntimeButton(); diff --git a/browser/devtools/webide/modules/app-manager.js b/browser/devtools/webide/modules/app-manager.js index 77a0e2e660ce..286ba69877ff 100644 --- a/browser/devtools/webide/modules/app-manager.js +++ b/browser/devtools/webide/modules/app-manager.js @@ -34,7 +34,14 @@ let AppManager = exports.AppManager = { DEFAULT_PROJECT_ICON: "chrome://browser/skin/devtools/app-manager/default-app-icon.png", DEFAULT_PROJECT_NAME: "--", + _initialized: false, + init: function() { + if (this._initialized) { + return; + } + this._initialized = true; + let port = Services.prefs.getIntPref("devtools.debugger.remote-port"); this.connection = ConnectionManager.createConnection("localhost", port); this.onConnectionChanged = this.onConnectionChanged.bind(this); @@ -57,7 +64,12 @@ let AppManager = exports.AppManager = { this._telemetry = new Telemetry(); }, - uninit: function() { + destroy: function() { + if (!this._initialized) { + return; + } + this._initialized = false; + this.selectedProject = null; this.selectedRuntime = null; RuntimeScanners.off("runtime-list-updated", this._rebuildRuntimeList); diff --git a/browser/devtools/webide/modules/project-list.js b/browser/devtools/webide/modules/project-list.js index b4929092f094..9421f67b69a5 100644 --- a/browser/devtools/webide/modules/project-list.js +++ b/browser/devtools/webide/modules/project-list.js @@ -28,6 +28,8 @@ module.exports = ProjectList = function(window, parentWindow) { this._panelNodeEl = "div"; } + AppManager.init(); + return this; };