[Pkg-mozext-commits] [firebug] 27/28: Issue 5857: Firebug command does not go away when disabled

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:46:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag firebug-1.10.3
in repository firebug.

commit 9ea45e4980d7e6d93169c7f8410218383c86c94c
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Thu Aug 23 09:20:11 2012 +0200

    Issue 5857: 	Firebug command does not go away when disabled
---
 extension/bootstrap.js    |   4 ++
 extension/modules/gcli.js | 106 ++++++++++++++++++++++++++++++----------------
 2 files changed, 73 insertions(+), 37 deletions(-)

diff --git a/extension/bootstrap.js b/extension/bootstrap.js
index 30cc756..0432247 100644
--- a/extension/bootstrap.js
+++ b/extension/bootstrap.js
@@ -73,6 +73,7 @@ function startup(params, reason)
 
     // GCLI commands
     Cu.import("resource://firebug/gcli.js");
+    FirebugGCLICommands.startup();
 }
 
 function shutdown(params, reason)
@@ -94,6 +95,9 @@ function shutdown(params, reason)
         Cu.reportError(e);
     }
 
+    // Unregister all GCLI commands
+    FirebugGCLICommands.shutdown();
+
     // xxxHonza: I think this shouldn't be here (perhaps in firebug-service.js)
     // Shutdown Firebug's JSD debugger service.
     var fbs = Cu.import("resource://firebug/firebug-service.js", {}).fbs;
diff --git a/extension/modules/gcli.js b/extension/modules/gcli.js
index c8210af..b3d0e62 100644
--- a/extension/modules/gcli.js
+++ b/extension/modules/gcli.js
@@ -7,7 +7,7 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 
-var EXPORTED_SYMBOLS = [];
+var EXPORTED_SYMBOLS = ["FirebugGCLICommands"];
 
 // ********************************************************************************************* //
 // GCLI
@@ -24,12 +24,25 @@ catch (err)
         FBTrace.sysout("GCLI not available");
 }
 
+var Locale = Cu.import("resource://firebug/locale.js").Locale;
+
 if (scope.gcli) {
 
 // ********************************************************************************************* //
-// Services
+// FirebugGCLICommands
 
-var Locale = Cu.import("resource://firebug/locale.js").Locale;
+var FirebugGCLICommands =
+{
+    startup: function()
+    {
+        registerCommands();
+    },
+
+    shutdown: function()
+    {
+        unregisterCommands();
+    }
+}
 
 // ********************************************************************************************* //
 // Command Implementation
@@ -99,40 +112,59 @@ var FirebugController =
 // ********************************************************************************************* //
 // Registration
 
-scope.gcli.addCommand({
-    name: "firebug",
-    description: "Web Development Evolved"
-});
-
-scope.gcli.addCommand({
-    name: "firebug open",
-    description: Locale.$STR("firebug.menu.tip.Open_Firebug"),
-    exec: FirebugController.openFirebug.bind(FirebugController)
-});
-
-scope.gcli.addCommand({
-    name: "firebug hide",
-    description: Locale.$STR("firebug.menu.tip.Minimize_Firebug"),
-    exec: FirebugController.hideFirebug.bind(FirebugController)
-});
-
-scope.gcli.addCommand({
-    name: "firebug close",
-    description: Locale.$STR("firebug.shortcut.tip.closeFirebug"),
-    exec: FirebugController.closeFirebug.bind(FirebugController)
-});
-
-scope.gcli.addCommand({
-    name: "firebug detach",
-    description: Locale.$STR("firebug.DetachFirebug"),
-    exec: FirebugController.detachFirebug.bind(FirebugController)
-});
-
-scope.gcli.addCommand({
-    name: "firebug attach",
-    description: Locale.$STR("firebug.AttachFirebug"),
-    exec: FirebugController.attachFirebug.bind(FirebugController)
-});
+var commands = [];
+
+function addCommand(command)
+{
+    scope.gcli.addCommand(command);
+    commands.push(command);
+}
+
+function registerCommands()
+{
+    addCommand({
+        name: "firebug",
+        description: "Web Development Evolved"
+    });
+
+    addCommand({
+        name: "firebug open",
+        description: Locale.$STR("firebug.menu.tip.Open_Firebug"),
+        exec: FirebugController.openFirebug.bind(FirebugController)
+    });
+
+    addCommand({
+        name: "firebug hide",
+        description: Locale.$STR("firebug.menu.tip.Minimize_Firebug"),
+        exec: FirebugController.hideFirebug.bind(FirebugController)
+    });
+
+    addCommand({
+        name: "firebug close",
+        description: Locale.$STR("firebug.shortcut.tip.closeFirebug"),
+        exec: FirebugController.closeFirebug.bind(FirebugController)
+    });
+
+    addCommand({
+        name: "firebug detach",
+        description: Locale.$STR("firebug.DetachFirebug"),
+        exec: FirebugController.detachFirebug.bind(FirebugController)
+    });
+
+    addCommand({
+        name: "firebug attach",
+        description: Locale.$STR("firebug.AttachFirebug"),
+        exec: FirebugController.attachFirebug.bind(FirebugController)
+    });
+}
+
+function unregisterCommands()
+{
+    for (var i=0; i<commands.length; i++)
+        scope.gcli.removeCommand(commands[i]);
+
+    commands = [];
+}
 
 // ********************************************************************************************* //
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list