Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue 5857: Firebug command does not go away when disabled

  • Loading branch information...
commit 2eb59a6d9f1ace7743ee743383ba3cd9c45c79bb 1 parent af1d741
@janodvarko janodvarko authored
Showing with 73 additions and 37 deletions.
  1. +4 −0 extension/bootstrap.js
  2. +69 −37 extension/modules/gcli.js
View
4 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;
View
106 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 = [];
+}
// ********************************************************************************************* //
}
Please sign in to comment.
Something went wrong with that request. Please try again.